List of usage examples for org.springframework.http HttpStatus ACCEPTED
HttpStatus ACCEPTED
To view the source code for org.springframework.http HttpStatus ACCEPTED.
Click Source Link
From source file:com.vmware.bdd.rest.RestResource.java
/** * Turn on or off some compute nodes//www . j a va2 s . c o m * @param clusterName * @param requestBody * @param request * @return Return a response with Accepted status and put task uri in the Location of header that can be used to monitor the progress */ @RequestMapping(value = "/cluster/{clusterName}/param_wait_for_result", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.ACCEPTED) public void asyncSetParam(@PathVariable("clusterName") String clusterName, @RequestBody ElasticityRequestBody requestBody, HttpServletRequest request, HttpServletResponse response) throws Exception { verifyInitialized(); validateInput(clusterName, requestBody); ClusterRead cluster = clusterMgr.getClusterByName(clusterName, false); if (!cluster.needAsyncUpdateParam(requestBody)) { throw BddException.BAD_REST_CALL(null, "invalid input to cluster."); } Long taskId = clusterMgr.asyncSetParam(clusterName, null, null, null, null, requestBody.getIoPriority()); redirectRequest(taskId, request, response); }
From source file:com.vmware.bdd.rest.RestResource.java
/** * Replace some failed disks with new disks * @param clusterName//from w ww . ja v a 2s . c o m * @param fixDiskSpec * @param request * @return Return a response with Accepted status and put task uri in the Location of header that can be used to monitor the progress */ @RequestMapping(value = "/cluster/{clusterName}/fix/disk", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.ACCEPTED) public void fixCluster(@PathVariable("clusterName") String clusterName, @RequestBody FixDiskRequestBody fixDiskSpec, HttpServletRequest request, HttpServletResponse response) throws Exception { verifyInitialized(); Long taskId = clusterMgr.fixDiskFailures(clusterName, fixDiskSpec.getNodeGroupName()); redirectRequest(taskId, request, response); }
From source file:com.vmware.bdd.rest.RestResource.java
/** * Add nodeGroup to a cluster/*from ww w . j a v a 2 s .com*/ * @param nodeGroupAddSpec create specification * @param request * @return Return a response with Accepted status and put task uri in the Location of header that can be used to monitor the progress */ @RequestMapping(value = "/cluster/{clusterName}/nodegroups", method = RequestMethod.POST, consumes = "application/json") @ResponseStatus(HttpStatus.ACCEPTED) public void expandCluster(@RequestBody NodeGroupAdd nodeGroupAddSpec, @PathVariable("clusterName") String clusterName, HttpServletRequest request, HttpServletResponse response) throws Exception { verifyInitialized(); List<String> failedMsgList = new ArrayList<String>(); List<String> warningMsgList = new ArrayList<String>(); nodeGroupAddSpec.validateNodeGroupAdd(failedMsgList, warningMsgList); NodeGroupCreate[] nodeGroupsAdd = nodeGroupAddSpec.getNodeGroups(); if (!CommonUtil.validateClusterName(clusterName)) { throw BddException.INVALID_PARAMETER("cluster name", clusterName); } logger.info("call rest for expand node groups into a cluster"); Long taskId = clusterMgr.expandCluster(clusterName, nodeGroupsAdd); redirectRequest(taskId, request, response); }
From source file:de.hybris.platform.ycommercewebservices.v2.controller.UsersController.java
/** * Change Customer's password./*from w ww . j av a 2 s . c o m*/ * * @formparam new New password * @formparam old Old password. Required only for ROLE_CUSTOMERGROUP */ @Secured({ "ROLE_CUSTOMERGROUP", "ROLE_TRUSTED_CLIENT", "ROLE_CUSTOMERMANAGERGROUP" }) @RequestMapping(value = "/{userId}/password", method = RequestMethod.PUT) @ResponseStatus(value = HttpStatus.ACCEPTED) public void changePassword(@PathVariable final String userId, @RequestParam(required = false) final String old, @RequestParam(value = "new") final String newPassword) { final Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (containsRole(auth, "ROLE_TRUSTED_CLIENT") || containsRole(auth, "ROLE_CUSTOMERMANAGERGROUP")) { userService.setPassword(userId, newPassword); } else { if (StringUtils.isEmpty(old)) { throw new RequestParameterException("Request parameter 'old' is missing.", RequestParameterException.MISSING, "old"); } customerFacade.changePassword(old, newPassword); } }
From source file:fi.vm.sade.eperusteet.ylops.resource.dokumentti.DokumenttiController.java
@RequestMapping(method = RequestMethod.POST) public ResponseEntity<DokumenttiDto> create(@RequestParam final long opsId, @RequestParam(defaultValue = "fi") final String kieli) throws DokumenttiException { HttpStatus status;//from w ww .ja va2 s.c o m DokumenttiDto dtoForDokumentti = service.getDto(opsId, Kieli.of(kieli)); // Jos dokumentti ei lydy valmiiksi niin koitetaan tehd uusi if (dtoForDokumentti == null) dtoForDokumentti = service.createDtoFor(opsId, Kieli.of(kieli)); // Jos tila eponnistunut, opsia ei lytynyt if (dtoForDokumentti == null) return new ResponseEntity<>(HttpStatus.NOT_FOUND); // Aloitetaan luonti jos luonti ei ole jo pll tai maksimi luontiaika ylitetty if (isTimePass(dtoForDokumentti) || dtoForDokumentti.getTila() != DokumenttiTila.LUODAAN) { // Vaihdetaan dokumentin tila luonniksi service.setStarted(dtoForDokumentti); // Generoidaan dokumentin data sislt // Asynkroninen metodi service.generateWithDto(dtoForDokumentti); status = HttpStatus.ACCEPTED; } else { status = HttpStatus.FORBIDDEN; } // Uusi objekti dokumentissa, jossa pivitetyt tiedot final DokumenttiDto dtoDokumentti = service.getDto(dtoForDokumentti.getId()); audit.withAudit(LogMessage.builder(opsId, OPETUSSUUNNITELMA, GENEROI)); return new ResponseEntity<>(dtoDokumentti, status); }
From source file:org.apache.servicecomb.demo.springmvc.server.CodeFirstSpringmvc.java
@ResponseHeaders({ @ResponseHeader(name = "h1", response = String.class), @ResponseHeader(name = "h2", response = String.class) }) @RequestMapping(path = "/responseEntity", method = RequestMethod.POST) public ResponseEntity<Date> responseEntity(InvocationContext c1, @RequestAttribute("date") Date date) { HttpHeaders headers = new HttpHeaders(); headers.add("h1", "h1v " + c1.getContext().get(Const.SRC_MICROSERVICE)); InvocationContext c2 = ContextUtils.getInvocationContext(); headers.add("h2", "h2v " + c2.getContext().get(Const.SRC_MICROSERVICE)); return new ResponseEntity<>(date, headers, HttpStatus.ACCEPTED); }
From source file:org.apache.servicecomb.demo.springmvc.tests.endpoints.CodeFirstSpringmvcBase.java
public ResponseEntity<Date> responseEntity(InvocationContext c1, Date date) { HttpHeaders headers = new HttpHeaders(); headers.add("h1", "h1v " + c1.getContext().toString()); InvocationContext c2 = ContextUtils.getInvocationContext(); headers.add("h2", "h2v " + c2.getContext().toString()); return new ResponseEntity<Date>(date, headers, HttpStatus.ACCEPTED); }
From source file:org.craftercms.deployer.impl.rest.TargetController.java
/** * Deploys the {@link Target} with the specified environment and site name. * * @param env the target's environment * @param siteName the target's site name * @param params any additional parameters that can be used by the {@link org.craftercms.deployer.api.DeploymentProcessor}s, for * example {@code reprocess_all_files} * * @return the response entity with a 200 OK status * * @throws DeployerException if an error occurred *///from w ww. j a v a2 s .c om @RequestMapping(value = DEPLOY_TARGET_URL, method = RequestMethod.POST) public ResponseEntity<Result> deployTarget(@PathVariable(ENV_PATH_VAR_NAME) String env, @PathVariable(SITE_NAME_PATH_VAR_NAME) String siteName, @RequestBody(required = false) Map<String, Object> params) throws DeployerException, ExecutionException, InterruptedException { if (params == null) { params = new HashMap<>(); } boolean waitTillDone = false; if (MapUtils.isNotEmpty(params)) { waitTillDone = BooleanUtils.toBoolean(params.remove(WAIT_TILL_DONE_PARAM_NAME)); } deploymentService.deployTarget(env, siteName, waitTillDone, params); return ResponseEntity.status(HttpStatus.ACCEPTED).body(Result.OK); }
From source file:org.craftercms.deployer.impl.rest.TargetController.java
/** * Deploys all current {@link Target}s.//from ww w. j av a 2s . com * * @param params any additional parameters that can be used by the {@link org.craftercms.deployer.api.DeploymentProcessor}s, for * example {@code reprocess_all_files} * * @return the response entity with a 200 OK status * * @throws DeployerException if an error occurred */ @RequestMapping(value = DEPLOY_ALL_TARGETS_URL, method = RequestMethod.POST) public ResponseEntity<Result> deployAllTargets(@RequestBody(required = false) Map<String, Object> params) throws DeployerException { if (params == null) { params = new HashMap<>(); } boolean waitTillDone = false; if (MapUtils.isNotEmpty(params)) { waitTillDone = BooleanUtils.toBoolean(params.remove(WAIT_TILL_DONE_PARAM_NAME)); } deploymentService.deployAllTargets(waitTillDone, params); return ResponseEntity.status(HttpStatus.ACCEPTED).body(Result.OK); }
From source file:org.geoserver.importer.rest.ImportTaskController.java
@PutMapping(path = "/{taskId}/layer") @ResponseStatus(HttpStatus.ACCEPTED) public ImportWrapper layerPut(@PathVariable Long id, @PathVariable Integer taskId, @RequestParam(required = false) String expand, @RequestBody LayerInfo layer) { ImportTask task = task(id, taskId);/*from w ww . j av a 2s . c om*/ return (writer, builder, converter) -> { updateLayer(task, layer, importer, converter); importer.changed(task); converter.task(builder, task, true, converter.expand(expand, 1)); }; }