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


Java RequestMethod.POST属性代码示例

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


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

示例1: login

@RequestMapping(value = "/login",method = RequestMethod.POST)
    public @ResponseBody
    LoginResponse login(@RequestBody LoginBody loginBody, HttpServletRequest request, HttpServletResponse response){
//        Authentication arequest = tokenServices.autoLogin(request,response);
//        Authentication result = am.authenticate(arequest);
//        SecurityContextHolder.getContext().setAuthentication(result);
//        return new LoginResponse("success",arequest.getCredentials().toString());


        try {
            Authentication arequest = new UsernamePasswordAuthenticationToken(loginBody.getUsername(),loginBody.getPassword());
            Authentication result = am.authenticate(arequest);
            SecurityContextHolder.getContext().setAuthentication(result);
            return new LoginResponse("success",arequest.getCredentials().toString());
        } catch(AuthenticationException e) {
            System.out.println("Authentication failed: " + e.getMessage());
        }
        return new LoginResponse("fail");
    }
 
开发者ID:AgainstWind,项目名称:spring-cloud-demos,代码行数:19,代码来源:AuthController.java

示例2: loginDo

@RequestMapping(value="login", method=RequestMethod.POST)
@ResponseBody
@PermessionLimit(limit=false)
public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember){
	if (!PermissionInterceptor.ifLogin(request)) {
		if (StringUtils.isNotBlank(userName) && StringUtils.isNotBlank(password)
				&& PropertiesUtil.getString("xxl.job.login.username").equals(userName)
				&& PropertiesUtil.getString("xxl.job.login.password").equals(password)) {
			boolean ifRem = false;
			if (StringUtils.isNotBlank(ifRemember) && "on".equals(ifRemember)) {
				ifRem = true;
			}
			PermissionInterceptor.login(response, ifRem);
		} else {
			return new ReturnT<String>(500, "账号或密码错误");
		}
	}
	return ReturnT.SUCCESS;
}
 
开发者ID:kevinKaiF,项目名称:xxl-job,代码行数:19,代码来源:IndexController.java

示例3: createConsumer

@Transactional
@PreAuthorize(value = "@permissionValidator.isSuperAdmin()")
@RequestMapping(value = "/consumers", method = RequestMethod.POST)
public ConsumerToken createConsumer(@RequestBody Consumer consumer,
                                    @RequestParam(value = "expires", required = false)
                                    @DateTimeFormat(pattern = "yyyyMMddHHmmss") Date
                                        expires) {

  if (StringUtils.isContainEmpty(consumer.getAppId(), consumer.getName(),
                                 consumer.getOwnerName(), consumer.getOrgId())) {
    throw new BadRequestException("Params(appId、name、ownerName、orgId) can not be empty.");
  }

  Consumer createdConsumer = consumerService.createConsumer(consumer);

  if (expires == null) {
    expires = DEFAULT_EXPIRES;
  }

  return consumerService.generateAndSaveConsumerToken(createdConsumer, expires);
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:21,代码来源:ConsumerController.java

示例4: getChildList

/**
 *
 * @param body JSon в виде: {"filePath":"path"}
 * @return FileOperationModel/ Код ошибки, описание и содержимое каталога: директории и файлы в виде перечисления
 */
@RequestMapping(value = "file/getChills", method = RequestMethod.POST
        ,produces = "application/json"
        ,consumes = MediaType.APPLICATION_JSON_VALUE
)
public FileOperationModel getChildList(@RequestBody String body){
    FileOperationModel model = new FileOperationModel();
    FileOperation fo = new FileOperation();
    JSONObject jsonObject = new JSONObject(body);
    String filePath = jsonObject.getString("filePath");
    ArrayList<String> chills = fo.setFilePath(filePath).getChills();
    model.setErrorCode(0);
    model.setCodeDescription("Успех");
    model.setFileContent(chills.toString());
    return model;
}
 
开发者ID:asmodeirus,项目名称:BackOffice,代码行数:20,代码来源:FileOperationController.java

示例5: startProcess

@RequestMapping(value = "api/processes/startProcess", method = RequestMethod.POST)
public @ResponseBody Callable<ResponseEntity<ProcessStartedDTO>> startProcess(
    @RequestBody final ProcessStartDTO processStartDTO, final HttpServletRequest request) {

  return () -> {
    final HttpHeaderUser user = new HttpHeaderUser(request);
    return processEngineCaller.startProcess(processStartDTO, user).get();
  };
}
 
开发者ID:stefanstaniAIM,项目名称:IPPR2016,代码行数:9,代码来源:ProcessEngineGatewayController.java

示例6: signup

@RequestMapping(value="/signup/new", method=RequestMethod.POST)
public String signup(final @Valid SignupForm signupForm,
                     final BindingResult result,
                     RedirectAttributes redirectAttributes) {
    if(result.hasErrors()) {
        return "signup/form";
    }

    String email = signupForm.getEmail();
    if(calendarService.findUserByEmail(email) != null) {
        result.rejectValue("email", "errors.signup.email", "Email address is already in use. FOO");
        redirectAttributes.addFlashAttribute("error", "Email address is already in use. FOO");
        return "signup/form";
    }

    CalendarUser user = new CalendarUser();
    user.setEmail(email);
    user.setFirstName(signupForm.getFirstName());
    user.setLastName(signupForm.getLastName());
    user.setPassword(signupForm.getPassword());

    int id = calendarService.createUser(user);
    user.setId(id);
    userContext.setCurrentUser(user);

    redirectAttributes.addFlashAttribute("message", "You have successfully signed up and logged in.");
    return "redirect:/";
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:28,代码来源:SignupController.java

示例7: instanceRestart

@ApiOperation(value = "Restart an instance selected by its ID", notes = "", response = Void.class, tags={ "Instance", })
@ApiResponses(value = { 
    @ApiResponse(code = 200, message = "successful operation", response = Void.class) })

@RequestMapping(value = "/connections/{connection}/instance/{id}/restart",
    produces = { "application/json" }, 
    method = RequestMethod.POST)
ResponseEntity<Void> instanceRestart(@ApiParam(value = "name of selected container", required = true) @PathVariable("id") String id, @ApiParam(value = "", required = true) @PathVariable("connection") String connection);
 
开发者ID:petrleocompel,项目名称:docker-dash,代码行数:8,代码来源:ConnectionsApi.java

示例8: scanCode

@RequestMapping(value = "/scanCode", method = RequestMethod.POST)
public ResponseEntity<ScanResult> scanCode(@RequestBody Map<String, Object> map) {
  if (!map.containsKey("apiKey") || !map.containsKey("image")) {
    return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
  }

  String base64 = (String)map.get("image");
  String userApiKey = (String)map.get("apiKey");
  if (API_KEY.equals(userApiKey)) {
    // Authorised access
    try {
      Image myImage = new Image(base64);
      CornerAnalyzer analyzer = new CornerAnalyzer(new PictureUtils(myImage.getImage()));
      analyzer.scanCorners();
      Code code = new Code(myImage, new ArrayList<Point<Double>>() {{
          add(new Point<>((double) analyzer.getTopLeft().getY(),
              (double)analyzer.getTopLeft().getX()));
          add(new Point<>((double) analyzer.getTopRight().getY(),
              (double)analyzer.getTopRight().getX()));
          add(new Point<>((double) analyzer.getBottomLeft().getY(),
              (double)analyzer.getBottomLeft().getX()));
          add(new Point<>((double) analyzer.getBottomRight().getY(),
              (double)analyzer.getBottomRight().getX()));
      }});

      return new ResponseEntity<>(
          new ScanResult(storage.getData(code.getCode())),
          HttpStatus.OK);
    } catch (IOException e) {
      Logger.getGlobal().log(Level.SEVERE, String.valueOf(e));
    }
  }
  return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);
}
 
开发者ID:catalincraciun,项目名称:scancode,代码行数:34,代码来源:ScanCodeController.java

示例9: deleteFromButton

@RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
public RedirectView deleteFromButton(@PathVariable Long id, Model model, RedirectAttributes red) {
    Category category = categoriesService.findOne(id);

    if (category == null)
        red.addFlashAttribute("msg", "not found");
    else {
        categoriesService.delete(category);
        red.addFlashAttribute("msg", "Succes");
    }
    Iterable<Category> categories = categoriesService.findAll();
    model.addAttribute("categories", categories);

    return new RedirectView(ApplicationProperties.PROJECT_NAME + "administratorSite/categories/delete");
}
 
开发者ID:xSzymo,项目名称:Spring-web-shop-project,代码行数:15,代码来源:DeleteCategories.java

示例10: save

@RequestMapping(value = "/agents", method = RequestMethod.POST)
@ResponseBody
public Agent save(@RequestBody Agent agent) throws Exception {
  try {
    return repository.save(agent);
  } catch (Exception e) {
    e.printStackTrace();
    throw e;
  }
}
 
开发者ID:osswangxining,项目名称:conversationinsights-service,代码行数:10,代码来源:AgentController.java

示例11: modifica

@RequestMapping(value = "/update", method = { RequestMethod.POST })
public String modifica(@ModelAttribute User user) {
   if (isPasswordChanged(user)) {
      user.setPassword(DigestUtils.md5Hex(user.getPassword()));
   }
   userService.update(user);

   // authenticate the user and redirect on the welcome page
   new AuthenticationHolder().updateUser(user);

   return "redirect:/dashboard";
}
 
开发者ID:dantel19,项目名称:profile-manager,代码行数:12,代码来源:LayoutController.java

示例12: runScript

@RequestMapping(value = "/{moduleName}/run-script", method = RequestMethod.POST,
        consumes = "multipart/form-data")
public ResponseEntity<?> runScript(@PathVariable String moduleName, @RequestPart("file") MultipartFile file)
        throws ServiceException, CheckException {
    String result = moduleService.runScript(moduleName, file);
    
    return ResponseEntity.ok(result);
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:8,代码来源:ModuleController.java

示例13: importProcess

@RequestMapping(value = "api/import", method = RequestMethod.POST)
public @ResponseBody Callable<ResponseEntity<Boolean>> importProcess(
    final @RequestBody ImportProcessModelDTO processModelDTO, final HttpServletRequest request) {
  return () -> {
    final HttpHeaderUser user = new HttpHeaderUser(request);
    return owlImportGatewayCaller.importProcessModel(processModelDTO, user).get();
  };
}
 
开发者ID:stefanstaniAIM,项目名称:IPPR2016,代码行数:8,代码来源:OwlImportGatewayController.java

示例14: searchGenesInProject

@ResponseBody
@RequestMapping(value = "/project/{projectId}/filter/vcf/searchGenes", method = RequestMethod.POST)
@ApiOperation(
        value = "Searches for IDs of genes, that are affected by variations",
        notes = "Searches for IDs of genes, that are affected by variations located in VCF files, specified by " +
                "ids, in a given project, specified by project ID",
        produces = MediaType.APPLICATION_JSON_VALUE)
@ApiResponses(
        value = {@ApiResponse(code = HTTP_STATUS_OK, message = API_STATUS_DESCRIPTION)
        })
public Result<Set<String>> searchGenesInProject(@PathVariable(value = PROJECT_ID_PARAM) long projectId,
                                                @RequestBody GeneSearchQuery geneQuery) throws IOException {
    return Result.success(featureIndexManager.searchGenesInVcfFilesInProject(projectId, geneQuery.getSearch(),
            geneQuery.getVcfIds()));
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:15,代码来源:ProjectController.java

示例15: loginout

@RequestMapping(value = "logout", method = { RequestMethod.GET,
        RequestMethod.POST })
public String loginout(HttpSession session)
{
    return "redirect:"+ShiroCasConfiguration.logoutUrl;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:6,代码来源:CasLoginController.java


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