本文整理汇总了Java中org.springframework.web.bind.annotation.RequestMapping类的典型用法代码示例。如果您正苦于以下问题:Java RequestMapping类的具体用法?Java RequestMapping怎么用?Java RequestMapping使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestMapping类属于org.springframework.web.bind.annotation包,在下文中一共展示了RequestMapping类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adminAddRentHouseDeal
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping(value="adminAddRentHouseDeal.do", method={RequestMethod.GET,RequestMethod.POST})
public ModelAndView adminAddRentHouseDeal(@RequestParam(value ="inputTime") @DateTimeFormat(pattern="yyyy-MM-dd") Date date,HttpServletRequest request, RentHouseDeal rentHouseDeal) {
ModelAndView modelAndView = new ModelAndView();
HttpSession session = request.getSession();
rentHouseDeal.setRentTime(date);
System.err.println("ctbb");
System.err.println(date);
System.err.println(rentHouseDeal.getRentHouseDay());
System.err.println(rentHouseDeal.getRentTime());
rentHouseDealDao.insertRentHouseDeal(rentHouseDeal);
List<RentHouseDeal> rentHouseDealList = rentHouseDealDao.selectAll();
session.setAttribute("rentHouseDealList", rentHouseDealList);
modelAndView.setViewName("SystemUser/managerRentHistory");
return modelAndView;
}
示例2: create
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
@ResponseStatus(HttpStatus.CREATED)
@RequestMapping(method = RequestMethod.POST)
HttpHeaders create(@RequestBody NoteInput noteInput) {
Note note = new Note();
note.setTitle(noteInput.getTitle());
note.setBody(noteInput.getBody());
note.setTags(getTags(noteInput.getTagUris()));
this.noteRepository.save(note);
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders
.setLocation(linkTo(NotesController.class).slash(note.getId()).toUri());
return httpHeaders;
}
示例3: retryEvent
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping(value = "/retryEvent")
public void retryEvent(HttpServletRequest request, HttpServletResponse response) throws IOException {
logger.info("Inside retryEvent");
String syncEventStr = SyncConstants.EMPTY_STRING;
String eventId = request.getParameter(EVENT_ID).trim().equalsIgnoreCase(SyncConstants.EMPTY_STRING)
? SyncConstants.EMPTY_STRING : request.getParameter(EVENT_ID).trim();
boolean retryFailed = Boolean.valueOf(request.getParameter(RETRY_FAILED));
boolean retryEntire = Boolean.valueOf(request.getParameter(RETRY_ENTIRE));
boolean dropCollection = Boolean.valueOf(request.getParameter(DROP_COLLECTION));
SyncEvent event = eventService.retryEvent(eventId, retryFailed, retryEntire, dropCollection);
if (event != null) {
syncEventStr = SyncMapAndEventEncoder.getEventJson(event);
}
response.setContentType(SyncConstants.CONTENT_TYPE_JSON);
response.getWriter().println(syncEventStr);
logger.info("retryEvent Completed");
}
示例4: completeMultipartUpload
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
/**
* Adds an object to a bucket.
*
* http://docs.aws.amazon.com/AmazonS3/latest/API/mpUploadComplete.html
*
* @param bucketName the Bucket in which to store the file in.
* @param uploadId id of the upload. Has to match all other part's uploads.
* @param request {@link HttpServletRequest} of this request
* @return {@link CompleteMultipartUploadResult}
* @throws IOException in case of an error.
*/
@RequestMapping(
value = "/{bucketName:.+}/**",
params = {"uploadId"},
method = RequestMethod.POST)
public ResponseEntity<CompleteMultipartUploadResult> completeMultipartUpload(
@PathVariable final String bucketName,
@RequestParam final String uploadId,
final HttpServletRequest request) throws IOException {
final String filename = filenameFrom(bucketName, request);
final String eTag =
fileStore.completeMultipartUpload(bucketName, filename, uploadId);
return new ResponseEntity<>(
new CompleteMultipartUploadResult(request.getRequestURL().toString(), bucketName,
filename, eTag), new HttpHeaders(), HttpStatus.OK);
}
示例5: deleteTaskList
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping(value = "/task/list/delete", method = RequestMethod.POST)
@ResponseBody
public String deleteTaskList(HttpServletResponse response, HttpServletRequest request) {
String json = request.getParameter("JSON");
Set<String> args = new HashSet<>();
List<GroupDefineDto> list = new GsonBuilder().create().fromJson(json,
new TypeToken<List<GroupDefineDto>>() {
}.getType());
for (GroupDefineDto m : list) {
args.add(m.getJobKey());
}
RetMsg retMsg = groupTaskService.deleteTask(args);
if (retMsg.checkCode()) {
return Hret.success(retMsg);
}
response.setStatus(retMsg.getCode());
return Hret.error(retMsg);
}
示例6: validateRoleName
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("withoutAuth/validateRoleName.html")
@ResponseBody
public Object validateRoleName(@RequestParam(value="name")String roleName){
try
{
roleName = new String(roleName.getBytes("iso-8859-1"),"utf-8");
RoleEntity roleEntity = roleService.findByName(roleName);
if(roleEntity == null)
{
return true;
}else
{
return false;
}
}catch(Exception e)
{
throw new AjaxException(e);
}
}
示例7: searchInLog
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
/**
*
* @param date - если даты нет - текущий день. За какой день взять лог
* @param logName - обязательный параметр. Какой лог читать
* @param entry - совпадение, по которому осуществляется поиск
* @return - возвращается данные из лога по заданным параметрам в виде "text/plain"
*/
@RequestMapping(value="/logs/search", method = RequestMethod.GET, produces="text/plain")
public String searchInLog(
@RequestParam(value="date", defaultValue="none") String date
,@RequestParam(value="logName", defaultValue="none") String logName
,@RequestParam(value="entry", defaultValue="none") String entry
) throws IOException, ParseException {
LOG.info("\nИнициирован запрос \"/logs/search\" с параметрами:\nDate: "+date+"\nlogName: "+logName + "\nentry: "+entry);
ArrayList<String> listOfAllDailyLogs;
int consilence;//вхождение
if(date.equals("none"))date = DATE_FORMAT.format(new Date());
if(logName.equals("none")){return "Необходимо указать имя сервиса, лог которого вы ожидаете получить, в параметре logName, пример: ?date=2017-02-17&logName=core";}
logModel = new LogModel(date);
listOfAllDailyLogs = logModel.getListOfAllDailyLogs();
consilence = logModel.getEntryIndex(listOfAllDailyLogs,logName);
String logPath = listOfAllDailyLogs.get(consilence);
ArrayList<String> logsResult = logModel.searchInLogByEntry(logPath,entry);
return logModel.convertLogToString(logsResult,"\n");
}
示例8: loginDemo
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
/**
* New Login get method
* @return the user object
*/
@CrossOrigin(origins = "*")
@RequestMapping(value = "/User/LoginDemo/{key}", produces = "application/json")
@ResponseBody
public ServerUser loginDemo(@PathVariable String key) {
if (users.get(key) != null) {
final ParseQuery<ParseObject> query = ParseQuery.getQuery("PMUser");
try {
ParseObject o = query.get(users.get(key).getUserId());
return (o == null) ? new ServerUser() : new ServerUser(new User(o));
} catch (final Exception e) {
return null;
}
}
return new ServerUser();
}
示例9: validateAccount
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("withoutAuth/validateAccountName.html")
@ResponseBody
public Object validateAccount(String accountName){
try
{
UserEntity userEntity = userService.findByName(accountName);
if(userEntity == null)
{
return true;
}else
{
return false;
}
}catch(Exception e)
{
throw new AjaxException(e);
}
}
示例10: cityList
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
/**
* 获取城市列表
*/
@RequestMapping(value = "/cityList", produces = "application/json;charset=UTF-8")
@ResponseBody
public JSONArray cityList(HttpServletRequest req, String areaCode) {
// 省份列表
List<Area> citys = bankService.getAreaLabel(areaCode);
JSONArray array = new JSONArray();
if (citys != null) {
for (Area item : citys) {
JSONObject json = new JSONObject();
json.put("areaCode", item.getAreaCode());
json.put("areaName", item.getAreaName());
array.add(json);
}
}
return array;
}
示例11: list
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("party-struct-list")
public String list(@ModelAttribute Page page,
@RequestParam Map<String, Object> parameterMap, Model model) {
String tenantId = tenantHolder.getTenantId();
List<PropertyFilter> propertyFilters = PropertyFilter
.buildFromMap(parameterMap);
propertyFilters.add(new PropertyFilter("EQS_tenantId", tenantId));
page = partyStructManager.pagedQuery(page, propertyFilters);
List<PartyStructType> partyStructTypes = partyStructTypeManager.findBy(
"tenantId", tenantId);
model.addAttribute("page", page);
model.addAttribute("partyStructTypes", partyStructTypes);
return "party/party-struct-list";
}
示例12: updateGeneralNotificationsConfig
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping(value="general-notifications", method = RequestMethod.POST)
public
@ResponseBody
String updateGeneralNotificationsConfig(@RequestBody String language, HttpServletRequest request)
throws ServiceException, ConfigurationException {
SecureUserDetails sUser = getUserDetails();
ResourceBundle backendMessages = Resources.get().getBundle("BackendMessages", sUser.getLocale());
if(!GenericAuthoriser.authoriseAdmin(request)) {
throw new UnauthorizedException(backendMessages.getString("permission.denied"));
}
Long domainId = SecurityUtils.getCurrentDomainId();
ConfigContainer cc = getDomainConfig(domainId, sUser.getUsername(), sUser.getLocale());
cc.dc.setLangPreference(language);
saveDomainConfig(sUser.getLocale(), domainId, cc, backendMessages);
xLogger.info("General notifications configuration updated successfully for domain " + domainId);
return backendMessages.getString("general.notifications.update.success");
}
示例13: faqWxcard
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("/insertfaq")
private @ResponseBody Map faqWxcard(HttpServletResponse resp,HttpServletRequest req) throws Exception{
Map map = (Map) req.getAttribute("info");
Userinfo user = (Userinfo) req.getAttribute("user");
String openid = (String) map.get("openid");
String email = (String) map.get("email");
String description = (String) map.get("description");
if(openid == null || "".equals(openid) || "null".equals(openid) || email == null || "".equals(email) || "null".equals(email) || description == null || "".equals(description) || "null".equals(description) ){
throw new GlobalErrorInfoException(KeyvalueErrorInfoEnum.KEYVALUE_ERROR);
}
map.put("userid", user.getUserid());
try{
userinfoService.insertFaq(map);
}catch(Exception e){
throw new GlobalErrorInfoException(NodescribeErrorInfoEnum.NODESCRIBE_ERROR);
}
map.clear();
map.put("code", "0");
map.put("message", "operation success");
return map;
}
示例14: review
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
/**
* Displays a review apply.
*
* @param model
* @param id
* @return
* @throws ShepherException
*/
@RequestMapping(value = "reviews/{id}", method = RequestMethod.GET)
public String review(Model model, @PathVariable(value = "id") long id) throws ShepherException {
ReviewRequest reviewRequest = reviewService.get(id);
if (reviewRequest == null) {
throw ShepherException.createNoSuchReviewException();
}
reviewService.rejectIfExpired(reviewRequest);
model.addAttribute("clusters", ClusterUtil.getClusters());
model.addAttribute("cluster", reviewRequest.getCluster());
model.addAttribute("paths", reviewRequest.getPath().split("/"));
model.addAttribute("reviewRequest", reviewRequest);
model.addAttribute("content", StringEscapeUtils.escapeHtml4(reviewRequest.getSnapshotContent()));
model.addAttribute("newContent", StringEscapeUtils.escapeHtml4(reviewRequest.getNewSnapshotContent()));
String backPath = reviewRequest.getPath();
if (reviewRequest.getAction() == Action.DELETE.getValue()) {
backPath = ParentPathParser.getParent(backPath);
}
model.addAttribute("backPath", backPath);
model.addAttribute("canReview", permissionService.isPathMaster(userHolder.getUser().getName(),
reviewRequest.getCluster(), reviewRequest.getPath()));
return "review/review";
}
示例15: showCommentsReplyMe
import org.springframework.web.bind.annotation.RequestMapping; //导入依赖的package包/类
@RequestMapping("/comment/receive")
public String showCommentsReplyMe(HttpSession session,HttpServletRequest request){
User user = SecurityUtil.getUser(session);
if(user==null){
session.setAttribute("message", "你已经退出登录,请登录后重试" );
return "error";
}
String currentPage =request.getParameter("currentPage");
Pagination<PublicCourseComment> pagination = new Pagination<PublicCourseComment>();
pagination.setPageSize(Constants.PageSize.MY_COMMENT.getSize());
if(currentPage==null || !RegExpValidator.IsIntNumber(currentPage)){
pagination.setCurrentPage(1);
}else{
pagination.setCurrentPage(Integer.valueOf(currentPage));
}
List<PublicCourseComment> comments = publicCourseCommentService.getPublicCourseCommentReplyByUid(user.getUid());
pagination.setPageDataList(comments);
request.setAttribute("pagination", pagination);
for(PublicCourseComment comment :comments){
if(comment.getState()==0){
comment.setState(1);
publicCourseCommentService.updatePublicCourseComment(comment);
}
}
return "commentReplyMe";
}