当前位置: 首页>>代码示例>>Java>>正文


Java RequestMethod类代码示例

本文整理汇总了Java中org.springframework.web.bind.annotation.RequestMethod的典型用法代码示例。如果您正苦于以下问题:Java RequestMethod类的具体用法?Java RequestMethod怎么用?Java RequestMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RequestMethod类属于org.springframework.web.bind.annotation包,在下文中一共展示了RequestMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBlogDetail

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.GET, path = "/getblogdetail")
public ModelAndView getBlogDetail(Integer blogid) {       //博客具体内容
    ModelAndView modelAndView = new ModelAndView();
    Blog blog = blogService.getBlogDetail(blogid);
    Blog preblog = blogService.preBlog(blogid);
    if (preblog != null) {
        modelAndView.addObject("preblog", preblog);
    }
    Blog nextblog = blogService.nextBlog(blogid);
    if (nextblog != null) {
        modelAndView.addObject("nextblog", nextblog);
    }
    modelAndView.addObject("blog", blog);
    modelAndView.setViewName("blogdetail");
    return modelAndView;
}
 
开发者ID:Zephery,项目名称:newblog,代码行数:17,代码来源:BlogController.java

示例2: updateCiStateBulk

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
@RequestMapping(value="/cm/simple/cis/states", method = RequestMethod.PUT)
@ResponseBody
public String updateCiStateBulk(
		@RequestParam(value="ids", required = true) String ids,
		@RequestParam(value="newState", required = true) String newState,
		@RequestParam(value="relationName", required = false) String relName,
		@RequestParam(value="direction", required = false) String direction,
		@RequestParam(value="recursive", required = false) Boolean recursive,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope,
		@RequestHeader(value="X-Cms-User", required = false)  String userId) {
	
	String[] idsStr = ids.split(",");
    Long[] ciIds = new Long[idsStr.length];
    for (int i=0; i<idsStr.length; i++) {
            ciIds[i] = Long.valueOf(idsStr[i]);
    }
	cmManager.updateCiStateBulk(ciIds, newState, relName, direction, recursive != null, userId);
	return "{\"updated\"}";	
}
 
开发者ID:oneops,项目名称:oneops,代码行数:20,代码来源:CmRestController.java

示例3: update

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
@RequestMapping(value = "/update", method = { RequestMethod.POST })
public String update(@ModelAttribute User user) {
   User persistentUser = userService.findByPK(user.getId());
   boolean expireUserSession = !user.isActive() || !CollectionUtils.isEqualCollection(user.getRoles(), persistentUser.getRoles());
   persistentUser.setFirstname(user.getFirstname());
   persistentUser.setLastname(user.getLastname());
   persistentUser.setEmail(user.getEmail());
   persistentUser.setRoles(user.getRoles());
   persistentUser.setActive(user.isActive());
   persistentUser.setPasswordExpired(user.isPasswordExpired());
   userService.update(persistentUser);
   
   if (expireUserSession){
      // expire user session
      sessionService.expireUserSession(persistentUser);
   }else{
      // update user information without expiring her session
      sessionService.updateUserSession(persistentUser);
   }
   
   return "redirect:/administration/user/list?success=true";
}
 
开发者ID:alexander-perucci,项目名称:spring-grow,代码行数:23,代码来源:AdministrationUserController.java

示例4: exportSelect

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
/**
 * 选择表下的字段列表
 * @param tableName 表名
 * @return
 */
@ResponseBody
@RequestMapping(value={"/select"},method=RequestMethod.GET)
public List<SysDBField> exportSelect(String tableName){
	List<SysDBField> fields=null;
	if(tableName==null||"".equals(tableName)){
		//获取所有的表
		List<SysDBTable> tables = commonService.getAllTable();
		if(tables!=null&&tables.size()>0){
			fields = commonService.getAllField(tables.get(0).getTableName());
		}
	}else{
		fields = commonService.getAllField(tableName);
	}
	return fields;
}
 
开发者ID:babymm,项目名称:mumu,代码行数:21,代码来源:SystemExportModelController.java

示例5: infoMachine

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
/**
 * Is a wrapper to cAdvisor API
 *
 * @return
 * @throws ServiceException
 * @throws CheckException
 */
@RequestMapping(value = "/api/machine", method = RequestMethod.GET)
public void infoMachine(HttpServletRequest request, HttpServletResponse response)
		throws ServiceException, CheckException {
	String responseFromCAdvisor = monitoringService.getJsonMachineFromCAdvisor();
	try {
		response.getWriter().write(responseFromCAdvisor);
		response.flushBuffer();
	} catch (Exception e) {
		logger.error("error during write and flush response", responseFromCAdvisor);
	}

}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:20,代码来源:MonitoringController.java

示例6: addEmployee

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
@RequestMapping(value = "/employee", method = { RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<MyResponse> addEmployee(@RequestBody Employee employee) {
	MyResponse resp = new MyResponse();
	empService.create(employee);
	if(HttpStatus.OK.is2xxSuccessful()){
		resp.setStatus(HttpStatus.OK.value());
		resp.setMessage("Succesfuly created an employee object");
		return new ResponseEntity<MyResponse>(resp, HttpStatus.OK);
	}
	else{
		resp.setStatus(HttpStatus.OK.value());
		resp.setMessage("Error while creating an employee object");
		return new ResponseEntity<MyResponse>(resp, HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}
 
开发者ID:sarojrout,项目名称:spring-tutorial,代码行数:17,代码来源:EmployeeController.java

示例7: hasRole

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
@PreAuthorize("hasRole('ROLE_MANAGER') or hasRole('ROLE_LIVREUR')")
@RequestMapping(value="/multiDelivery", method=RequestMethod.POST)
@Transactional
public String multiDelivery(@RequestParam List<Long> listeIds, Model uiModel) {
	
	for(Long id : listeIds){
		try {
			Card card = Card.findCard(id);
			card.setDeliveredDate(new Date());
			card.merge();
		} catch (Exception e) {
			log.info("La carte avec l'id suivant n'a pas été marquée comme livrée : " + id, e);
		}
	}
	uiModel.asMap().clear();
	return "redirect:/manager/";
}
 
开发者ID:EsupPortail,项目名称:esup-sgc,代码行数:18,代码来源:ManagerCardController.java

示例8: actionChatList

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
@RequestMapping(method=RequestMethod.POST, path="/admin/chat-list", produces = "application/json")
public @ResponseBody List<ChatList> actionChatList(@RequestParam String userId, @RequestParam String page) {
    try {
        return helper.getChatDB().getViewRequestBuilder("chats", "getChatList")
                .newRequest(Key.Type.COMPLEX, ChatList.class)
                .startKey(Key.complex(userId))
                .endKey(Key.complex(userId, "\ufff0"))
                .inclusiveEnd(true)
                .limit(MAX_SIZE)
                .skip((Integer.parseInt(page) - 1) * MAX_SIZE)
                .build().getResponse().getValues();
    }
    catch (Exception e) {
        e.printStackTrace();
    }
    return new ArrayList<ChatList>();
}
 
开发者ID:dbpedia,项目名称:chatbot,代码行数:18,代码来源:AdminController.java

示例9: auth

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
@RequestMapping(value = "auth", method = RequestMethod.POST)
public ResponseEntity<?> auth(@RequestBody AuthRequest ar) {
	
	final Authentication authentication = authenticationManager.authenticate(
		new UsernamePasswordAuthenticationToken(ar.getUsername(), ar.getPassword())
	);
	SecurityContextHolder.getContext().setAuthentication(authentication);
	
	User u = userRepository.findByUsername(ar.getUsername());
	if (u != null) {
		String token = jwtTokenUtil.generateToken(u);
		return ResponseEntity.ok(new AuthResponse(token));
	} else {
		return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
	}
}
 
开发者ID:ard333,项目名称:spring-boot-jjwt,代码行数:17,代码来源:AuthenticationREST.java

示例10: unassignAssetFromCustomer

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
@RequestMapping(value = "/customer/asset/{assetId}", method = RequestMethod.DELETE)
@ResponseBody
public Asset unassignAssetFromCustomer(@PathVariable("assetId") String strAssetId) throws IoTPException {
  checkParameter("assetId", strAssetId);
  try {
    AssetId assetId = new AssetId(toUUID(strAssetId));
    Asset asset = checkAssetId(assetId);
    if (asset.getCustomerId() == null || asset.getCustomerId().getId().equals(ModelConstants.NULL_UUID)) {
      throw new IncorrectParameterException("Asset isn't assigned to any customer!");
    }
    return checkNotNull(assetService.unassignAssetFromCustomer(assetId));
  } catch (Exception e) {
    throw handleException(e);
  }
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:17,代码来源:AssetController.java

示例11: details

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
@RequestMapping(value = "/sdoc/api/detail/{groupIndex}/{beanName}/{apiIndex}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public Options details(HttpServletRequest req, @PathVariable Integer groupIndex, @PathVariable String beanName,
        @PathVariable int apiIndex) throws Exception {
    Options options = new Options();
    Documentation documentation = documentScanner.getDocumentations().get(groupIndex);
    if (documentation == null) {
        return options;
    }
    List<Options> optionsList = documentation.getOptionsMap().get(beanName);
    if (optionsList != null) {
        options = optionsList.get(apiIndex);
    }
    return options;
}
 
开发者ID:apcc4m,项目名称:sdoc,代码行数:16,代码来源:SdocController.java

示例12: updateCIRelation

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
@RequestMapping(method=RequestMethod.PUT, value="/cm/simple/relations/{ciRelId}")
@ResponseBody
public CmsCIRelationSimple updateCIRelation(
		@PathVariable long ciRelId,
		@RequestParam(value="value", required = false)  String valueType, 
		@RequestBody CmsCIRelationSimple relSimple,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope,
		@RequestHeader(value="X-Cms-User", required = false)  String userId) throws CIValidationException {
	
	scopeVerifier.verifyScope(scope, relSimple);
	
	relSimple.setCiRelationId(ciRelId);
	CmsCIRelation rel = cmsUtil.custCIRelationSimple2CIRelation(relSimple, valueType);
	rel.setUpdatedBy(userId);
	CmsCIRelation newRel = cmManager.updateRelation(rel);
	String[] attrProps = null;
	if (relSimple.getRelationAttrProps().size() >0) {
		attrProps = relSimple.getRelationAttrProps().keySet().toArray(new String[relSimple.getRelationAttrProps().size()]);
	}
	return cmsUtil.custCIRelation2CIRelationSimple(newRel, valueType,false, attrProps);
}
 
开发者ID:oneops,项目名称:oneops,代码行数:22,代码来源:CmRestController.java

示例13: getCIById

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
@RequestMapping(value="/cm/cis/{ciId}", method = RequestMethod.GET)
@ResponseBody
@ReadOnlyDataAccess
public CmsCI getCIById(
		@PathVariable long ciId,
		@RequestHeader(value="X-Cms-Scope", required = false)  String scope) {

	CmsCI ci = cmManager.getCiById(ciId);

	if (ci == null) throw new CmsException(CmsError.CMS_NO_CI_WITH_GIVEN_ID_ERROR,
                                           "There is no ci with this id");

	scopeVerifier.verifyScope(scope, ci);
	
	return ci;
}
 
开发者ID:oneops,项目名称:oneops,代码行数:17,代码来源:CmRestController.java

示例14: create

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
@RequestMapping(value = "/", method = RequestMethod.POST)
public
@ResponseBody
String create(@RequestBody WidgetModel model, HttpServletRequest request) {
  SecureUserDetails sUser = SecurityUtils.getUserDetails(request);
  Locale locale = sUser.getLocale();
  ResourceBundle backendMessages = Resources.get().getBundle("BackendMessages", locale);
  long domainId = SessionMgr.getCurrentDomain(request.getSession(), sUser.getUsername());
  try {
    IWidget wid = builder.buildWidget(model, domainId, sUser.getUsername());
    IDashboardService ds = Services.getService(DashboardService.class);
    ds.createWidget(wid);
    model.config.wId = wid.getwId();
    IWidget widConfig = builder.updateWidgetConfig(ds, model.config);
    ds.updateWidgetConfig(widConfig);
  } catch (ServiceException e) {
    xLogger.severe("Error creating Widget for " + domainId);
    throw new InvalidServiceException("Error creating Widget for " + domainId);
  }
  return "Widget " + MsgUtil.bold(model.nm) + " " + backendMessages.getString("created.success");
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:22,代码来源:WidgetController.java

示例15: edit

import org.springframework.web.bind.annotation.RequestMethod; //导入依赖的package包/类
/**
 * 更新角色信息
 * @param role
 * @return
 */
@RequestMapping(value = "edit",method = RequestMethod.POST)
@ResponseBody
public WebResult edit(Role role,HttpSession session){
    boolean success = false;
    AdminUser loginUser = (AdminUser) session.getAttribute("loginUser");

    if(role.getId() != null){
        role.setCreator(loginUser.getId());
        success = roleService.update(role);
    }else {
        role.setUpdateUser(loginUser.getId());
        role.setUpdateTime(new Date());
        success = roleService.insert(role);
    }
    if(success){
        return WebResult.success();
    }else{
        return WebResult.unKnown();
    }
}
 
开发者ID:RayeWang,项目名称:easyadmin,代码行数:26,代码来源:RoleController.java


注:本文中的org.springframework.web.bind.annotation.RequestMethod类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。