List of usage examples for javax.servlet.http HttpServletResponse SC_EXPECTATION_FAILED
int SC_EXPECTATION_FAILED
To view the source code for javax.servlet.http HttpServletResponse SC_EXPECTATION_FAILED.
Click Source Link
From source file:com.tamnd.app.config.security.EntryPointAuthenticationHandler.java
@Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException ex) throws IOException, ServletException { if (ex instanceof BadCredentialsException) { response.sendError(HttpServletResponse.SC_EXPECTATION_FAILED, "User name or password is wrong!"); }/*from w w w .j a v a 2s .c o m*/ }
From source file:com.graphaware.module.resttest.RestTestApi.java
@RequestMapping(value = "/assertSameGraph", method = RequestMethod.POST) @ResponseBody// ww w. j a v a 2 s .c o m public String assertSameGraph(@RequestBody RestTestRequest request, HttpServletResponse response) throws IOException { if (request.getCypher() == null) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Cypher statement must be provided"); } try { GraphUnit.assertSameGraph(database, request.getCypher(), resolveInclusionPolicies(request)); response.setStatus(HttpServletResponse.SC_OK); return null; } catch (AssertionError error) { response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); return error.getMessage(); } }
From source file:com.eureka.v1_0.account.information.api.AccountInformationController.java
@ResponseBody @RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE) public CreateAccountResponse createAccount(@RequestBody CreateAccountRequest createAccountRequest, HttpServletRequest request, HttpServletResponse response) { if (createAccountRequest != null) { try {/*from w ww .j a va 2 s.c om*/ CreateAccountResponse createAccountResponse = this.accountInformationApiService .createAccount(createAccountRequest); witLoggerService.debug(JaxbHandler.toXml(createAccountRequest)); if (createAccountResponse != null) { witLoggerService.debug(JaxbHandler.toXml(createAccountResponse)); response.setStatus(HttpServletResponse.SC_OK); return createAccountResponse; } else { response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); } } catch (Exception ex) { witLoggerService.warn(ex); ex.printStackTrace(); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return null; }
From source file:com.graphaware.module.resttest.RestTestApi.java
@RequestMapping(value = "/assertSubgraph", method = RequestMethod.POST) @ResponseBody/*w w w. j av a 2 s . com*/ public String assertSubgraph(@RequestBody RestTestRequest request, HttpServletResponse response) throws IOException { if (request.getCypher() == null) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Cypher statement must be provided"); } try { GraphUnit.assertSubgraph(database, request.getCypher(), resolveInclusionPolicies(request)); response.setStatus(HttpServletResponse.SC_OK); return null; } catch (AssertionError error) { response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); return error.getMessage(); } }
From source file:com.graphaware.module.resttest.RestTestApi.java
@RequestMapping(value = "/assertEmpty", method = RequestMethod.POST) @ResponseBody/* w w w . j a va 2 s. c o m*/ public String assertEmpty(@RequestBody(required = false) RestTestRequest request, HttpServletResponse response) throws IOException { try { GraphUnit.assertEmpty(database, resolveInclusionPolicies(request)); response.setStatus(HttpServletResponse.SC_OK); return null; } catch (AssertionError error) { response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); return error.getMessage(); } }
From source file:com.eureka.v1_0.account.information.api.AccountInformationController.java
@ResponseBody @RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/resettoken") public CreateResetPasswordTokenResponse createResetPasswordToken( @RequestBody CreateResetPasswordTokenRequest createResetPasswordTokenRequest, HttpServletRequest request, HttpServletResponse response) { if (createResetPasswordTokenRequest != null) { try {/*from ww w . j a va 2s . co m*/ witLoggerService.debug(JaxbHandler.toXml(createResetPasswordTokenRequest)); CreateResetPasswordTokenResponse createResetPasswordTokenResponse = this.accountInformationApiService .createResetPasswordToken(createResetPasswordTokenRequest); if (createResetPasswordTokenResponse != null) { witLoggerService.debug(JaxbHandler.toXml(createResetPasswordTokenResponse)); response.setStatus(HttpServletResponse.SC_OK); return createResetPasswordTokenResponse; } else { response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); } } catch (Exception ex) { witLoggerService.warn(ex); ex.printStackTrace(); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return null; }
From source file:com.eureka.v1_0.account.information.api.AccountInformationController.java
@ResponseBody @RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/resetpassword") public ResetPasswordResponse resetPassword(@RequestBody ResetPasswordRequest resetPasswordRequest, HttpServletRequest request, HttpServletResponse response) { if (resetPasswordRequest != null) { try {// w w w. j av a2 s . c om witLoggerService.debug(JaxbHandler.toXml(resetPasswordRequest)); ResetPasswordResponse resetPasswordResponse = this.accountInformationApiService .resetPassword(resetPasswordRequest); if (resetPasswordResponse != null) { witLoggerService.debug(JaxbHandler.toXml(resetPasswordResponse)); response.setStatus(HttpServletResponse.SC_OK); return resetPasswordResponse; } else { response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); } } catch (Exception ex) { witLoggerService.warn(ex); ex.printStackTrace(); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return null; }
From source file:com.eureka.v1_0.account.information.api.AccountInformationController.java
@ResponseBody @RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/login") public LoginResponse login(@RequestBody LoginRequest loginRequest, HttpServletRequest request, HttpServletResponse response) {/*from w w w .j ava2s .com*/ if (loginRequest != null) { try { witLoggerService.debug(JaxbHandler.toXml(loginRequest)); LoginResponse loginResponse = this.accountInformationApiService.login(loginRequest); if (loginResponse != null) { witLoggerService.debug(JaxbHandler.toXml(loginResponse)); response.setStatus(HttpServletResponse.SC_OK); return loginResponse; } else { response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); } } catch (Exception ex) { witLoggerService.warn(ex); ex.printStackTrace(); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return null; }
From source file:com.eureka.v1_0.kyc.information.api.KycInformationApiController.java
@ResponseBody @RequestMapping(method = RequestMethod.POST, consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE, value = "/createpersonalinformation") public CreatePersonalInformationResponse createPersonalInformation( @RequestBody CreatePersonalInformationRequest createPersonalInformationRequest, HttpServletRequest request, HttpServletResponse response) { if (createPersonalInformationRequest != null) { try {/*from w w w . j a va 2 s . com*/ witLoggerService.debug(JaxbHandler.toXml(createPersonalInformationRequest)); CreatePersonalInformationResponse createPersonalInformationResponse = this.kycInformationApiService .createPersonalInformation(createPersonalInformationRequest); if (createPersonalInformationResponse != null) { witLoggerService.debug(JaxbHandler.toXml(createPersonalInformationResponse)); response.setStatus(HttpServletResponse.SC_OK); return createPersonalInformationResponse; } else { response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); } } catch (Exception ex) { witLoggerService.warn(ex); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return null; }