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.acc.controller.CartController.java
/** * Web service for authorizing cart's credit cart payment.<br> * Sample call: https://localhost:9002/rest/v1/mysite/cart/authorizePayment <br> * authorization security code - ccv - must be sent as a post body.<br> * Response contains a set-cookie header with the jsessionId associated with the cart.<br> * This method requires authentication and is restricted to <code>HTTPS<code> channel only.<br> * Method type : <code>POST</code>. * //from ww w . ja v a 2 s .c om * @return true if the payment was authorized * @throws PaymentAuthorizationException */ @Secured("ROLE_CUSTOMERGROUP") @RequestMapping(value = "/authorize", method = RequestMethod.POST) @ResponseBody @ResponseStatus(HttpStatus.ACCEPTED) public CartData authorizePayment(@RequestParam(required = true) final String securityCode) throws PaymentAuthorizationException { if (LOG.isDebugEnabled()) { LOG.debug("authorizePayment"); } if (checkoutFacade.authorizePayment(securityCode)) { return getSessionCart(); } throw new PaymentAuthorizationException(); }
From source file:com.acc.controller.CustomersController.java
/** * Client should pass old and new password in Body. Content-Type needs to be set to * application/x-www-form-urlencoded; charset=UTF-8 and sample body (urlencoded) is: new=1111 * // ww w . j a v a 2 s. c o m * @param newPassword * - new password */ @Secured("ROLE_TRUSTED_CLIENT") @RequestMapping(value = "/{customerId}/password", method = { RequestMethod.PUT, RequestMethod.POST }) @ResponseBody @ResponseStatus(value = HttpStatus.ACCEPTED, reason = "Password changed.") public void changeCustomerPassword(@PathVariable final String customerId, @RequestParam(value = "new") final String newPassword) { userService.setPassword(customerId, newPassword); }
From source file:com.grizzly.rest.GenericRestCall.java
/** * Delete call. Sends a String and retrieves another String. * * @param singleArgument//from w ww .ja va 2s .c om */ public void doDelete(String singleArgument) { try { HttpEntity<String> requestEntity = new HttpEntity<String>(singleArgument, requestHeaders); List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>(); /* * commented: testing GSON instead of Jackson as a message converter * */ messageConverters.add(new MappingJackson2HttpMessageConverter()); //messageConverters.create(new GsonHttpMessageConverter()); restTemplate.setMessageConverters(messageConverters); try { ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.DELETE, requestEntity, String.class); HttpStatus status = response.getStatusCode(); if (status == HttpStatus.OK || status == HttpStatus.ACCEPTED || status == HttpStatus.CREATED) { this.result = true; } else { this.result = false; } } catch (Exception e) { failure = e; //e.printStackTrace(); this.result = false; } } catch (Exception e) { failure = e; //e.printStackTrace(); this.result = false; } }
From source file:org.openbaton.nfvo.api.RestNetworkServiceRecord.java
@RequestMapping(value = "{id}/vnfdependencies/{id_vnfd}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.ACCEPTED) public VNFRecordDependency updateVNFD(@RequestBody @Valid VNFRecordDependency vnfDependency, @PathVariable("id") String id, @PathVariable("id_vnfd") String id_vnfd, @RequestHeader(value = "project-id") String projectId) throws NotFoundException { NetworkServiceRecord nsr = networkServiceRecordManagement.query(id, projectId); nsr.getVnf_dependency().add(vnfDependency); networkServiceRecordManagement.update(nsr, id, projectId); return vnfDependency; }
From source file:com.gooddata.dataload.processes.ProcessService.java
private FutureResult<DataloadProcess> postProcess(DataloadProcess process, URI postUri, HttpMethod method) { try {/*from www . java2 s . c o m*/ ResponseEntity<String> exchange = restTemplate.exchange(postUri, method, new HttpEntity<>(process), String.class); if (exchange.getStatusCode() == HttpStatus.ACCEPTED) { //deployment worker will create process AsyncTask asyncTask = mapper.readValue(exchange.getBody(), AsyncTask.class); return new PollResult<>(this, new SimplePollHandler<DataloadProcess>(asyncTask.getUri(), DataloadProcess.class) { @Override public void handlePollException(GoodDataRestException e) { throw new GoodDataException("Creating process failed", e); } }); } else if (exchange.getStatusCode() == HttpStatus.OK) { //object has been found in package registry, deployment worker is not triggered final DataloadProcess dataloadProcess = mapper.readValue(exchange.getBody(), DataloadProcess.class); return new PollResult<>(this, new SimplePollHandler<DataloadProcess>(dataloadProcess.getUri(), DataloadProcess.class) { @Override public void handlePollException(GoodDataRestException e) { throw new GoodDataException("Creating process failed", e); } }); } else { throw new IllegalStateException( "Unexpected status code from resource: " + exchange.getStatusCode()); } } catch (RestClientException | IOException e) { throw new GoodDataException("Creating process failed", e); } }
From source file:org.openbaton.nfvo.api.RestNetworkServiceRecord.java
/** * Edits the PhysicalNetworkFunctionRecord * * @param pRecord : The PhysicalNetworkFunctionRecord to be edited * @param id : The NSD id// w w w .j ava 2 s . c o m * @return PhysicalNetworkFunctionRecord: The PhysicalNetworkFunctionRecord edited */ @RequestMapping(value = "{id}/pnfrecords/{id_pnf}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.ACCEPTED) public PhysicalNetworkFunctionRecord updatePNFD(@RequestBody @Valid PhysicalNetworkFunctionRecord pRecord, @PathVariable("id") String id, @PathVariable("id_pnf") String id_pnf, @RequestHeader(value = "project-id") String projectId) throws NotFoundException { NetworkServiceRecord nsd = networkServiceRecordManagement.query(id, projectId); nsd.getPnfr().add(pRecord); networkServiceRecordManagement.update(nsd, id, projectId); return pRecord; }
From source file:com.nagarro.core.v1.controller.CartController.java
/** * Web service for authorizing cart's credit cart payment.<br> * Sample call: https://localhost:9002/rest/v1/mysite/cart/authorizePayment <br> * authorization security code - ccv - must be sent as a post body.<br> * Response contains a set-cookie header with the jsessionId associated with the cart.<br> * This method requires authentication and is restricted to <code>HTTPS<code> channel only.<br> * Method type : <code>POST</code>. * //from ww w . ja va 2s .c om * @return true if the payment was authorized * @throws PaymentAuthorizationException */ @Secured({ "ROLE_CUSTOMERGROUP", "ROLE_GUEST" }) @RequestMapping(value = "/authorize", method = RequestMethod.POST) @ResponseBody @ResponseStatus(HttpStatus.ACCEPTED) public CartData authorizePayment(@RequestParam(required = true) final String securityCode) throws PaymentAuthorizationException { if (LOG.isDebugEnabled()) { LOG.debug("authorizePayment"); } if (checkoutFacade.authorizePayment(securityCode)) { return getSessionCart(); } throw new PaymentAuthorizationException(); }
From source file:com.nagarro.core.v1.controller.CustomersController.java
/** * Client should pass old and new password in Body. Content-Type needs to be set to * application/x-www-form-urlencoded; charset=UTF-8 and sample body (urlencoded) is: old=1234&new=1111 * //from w w w . j a va 2 s . c om * @param old * - old password * @param newPassword * - new password */ @Secured("ROLE_CUSTOMERGROUP") @RequestMapping(value = "/current/password", method = { RequestMethod.PUT, RequestMethod.POST }) @ResponseBody @ResponseStatus(value = HttpStatus.ACCEPTED) public void changePassword(@RequestParam final String old, @RequestParam(value = "new") final String newPassword) { customerFacade.changePassword(old, newPassword); }
From source file:com.nagarro.core.v1.controller.CustomersController.java
/** * Client should pass old and new password in Body. Content-Type needs to be set to * application/x-www-form-urlencoded; charset=UTF-8 and sample body (urlencoded) is: new=1111 * /*from ww w . j ava 2s . co m*/ * @param newPassword * - new password */ @Secured("ROLE_TRUSTED_CLIENT") @RequestMapping(value = "/{customerId}/password", method = { RequestMethod.PUT, RequestMethod.POST }) @ResponseBody @ResponseStatus(value = HttpStatus.ACCEPTED) public void changeCustomerPassword(@PathVariable final String customerId, @RequestParam(value = "new") final String newPassword) { userService.setPassword(customerId, newPassword); }