List of usage examples for org.springframework.http HttpStatus INTERNAL_SERVER_ERROR
HttpStatus INTERNAL_SERVER_ERROR
To view the source code for org.springframework.http HttpStatus INTERNAL_SERVER_ERROR.
Click Source Link
From source file:com.ogaclejapan.dotapk.WebApiController.java
@ExceptionHandler(value = { Exception.class }) @ResponseBody/*w ww .j a v a2s. co m*/ public ResponseEntity<WebApiErrorReturns> handleException(Exception e, HttpServletRequest request) { return error(HttpStatus.INTERNAL_SERVER_ERROR); }
From source file:com.hp.autonomy.frontend.find.core.web.GlobalExceptionHandler.java
@ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ResponseBody//from ww w.jav a 2 s.c om public <E extends Exception> ErrorResponse handler(final E exception) throws E { // boilerplate - see http://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc if (AnnotationUtils.findAnnotation(exception.getClass(), ResponseStatus.class) != null) { throw exception; } final ErrorResponse errorResponse = new ErrorResponse(exception.getMessage()); log.error("Unhandled exception with uuid {}", errorResponse.getUuid()); log.error("Stack trace", exception); return errorResponse; }
From source file:fr.itldev.koya.services.impl.util.AlfrescoRestErrorHandler.java
@Override public void handleError(ClientHttpResponse clienthttpresponse) throws IOException { if (!statusOK.contains(clienthttpresponse.getStatusCode())) { AlfrescoServiceException ex;/*from ww w .jav a2s . c o m*/ if (clienthttpresponse.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR)) { java.util.Scanner s = new java.util.Scanner(clienthttpresponse.getBody()).useDelimiter("\\A"); String message = s.hasNext() ? s.next() : ""; /* Try to get any Koya Error code if exists */ Integer koyaErrorCode = null; Matcher matcher = ERRORCODEPATTERN.matcher(message); if (matcher.find()) { koyaErrorCode = Integer.valueOf(matcher.group(1)); } ex = new AlfrescoServiceException( "Erreur " + clienthttpresponse.getStatusCode() + " : " + clienthttpresponse.getStatusText(), koyaErrorCode); ex.setHttpErrorCode(clienthttpresponse.getStatusCode().value()); } else if (clienthttpresponse.getStatusCode().equals(HttpStatus.FORBIDDEN)) { ex = new AlfrescoServiceException("Acces Denied"); ex.setHttpErrorCode(clienthttpresponse.getStatusCode().value()); } else { ex = new AlfrescoServiceException(); ex.setHttpErrorCode(clienthttpresponse.getStatusCode().value()); throw ex; } throw ex; } }
From source file:com.ogaclejapan.dotapk.WebApiException.java
public static WebApiException asInternalServerError(String message, Throwable cause) { return new WebApiException(HttpStatus.INTERNAL_SERVER_ERROR, message, cause); }
From source file:io.kahu.hawaii.util.exception.ServerException.java
@Override public HttpStatus getStatus() { return HttpStatus.INTERNAL_SERVER_ERROR; // 500 }
From source file:com.boxedfolder.carrot.Application.java
@Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return new EmbeddedServletContainerCustomizer() { @Override/*from ww w. j a va2 s.co m*/ public void customize(ConfigurableEmbeddedServletContainer container) { ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html"); ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html"); ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html"); container.addErrorPages(error401Page, error404Page, error500Page); } }; }
From source file:br.edu.ifpb.blogsoon.webapp.controller.avaliacao.AvaliacaoController.java
@RequestMapping(value = "/add", method = RequestMethod.POST) public ResponseEntity<String> addAvaliacao(@RequestParam("idPost") String idPost, @RequestParam("tipo") String tipo, HttpSession session) { Usuario usuario = (Usuario) session.getAttribute("usuario"); if (usuario != null) { if (avaliacaoService.buscarPorIdPostEUsuario(idPost, usuario).size() >= 1) return new ResponseEntity<>(HttpStatus.FORBIDDEN); Avaliacao avaliacao = new Avaliacao(); avaliacao.setIdPost(idPost);/*from ww w. j av a 2 s . c o m*/ avaliacao.setUsuario(usuario); avaliacao.setTipo(AvaliacaoEnum.valueOf(tipo)); avaliacaoService.salvar(avaliacao); return new ResponseEntity<>(HttpStatus.OK); } return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); }
From source file:marytts.http.controllers.MaryErrorController.java
private HttpStatus getStatus(HttpServletRequest request) { Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code"); if (statusCode == null) { return HttpStatus.INTERNAL_SERVER_ERROR; }/*from w ww. j a v a 2 s . com*/ return HttpStatus.valueOf(statusCode); }
From source file:com.bennavetta.appsite.serve.ResourceServlet.java
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { log.info("Handling request {}", req); URI actual = base.relativize(URI.create(req.getRequestURI())); try {//from w w w .j a v a2 s.c om processor.handle(new RedirectedRequest(actual, new HttpServletReq(req)), new HttpServletResp(resp), req.getInputStream(), resp.getOutputStream()); } catch (Exception e) { log.error("Error handling request", e); resp.sendError(HttpStatus.INTERNAL_SERVER_ERROR.value()); } }
From source file:sample.actuator.EndpointsPropertiesSampleActuatorApplicationTests.java
@Test public void testCustomErrorPath() throws Exception { @SuppressWarnings("rawtypes") ResponseEntity<Map> entity = new TestRestTemplate("user", getPassword()) .getForEntity("http://localhost:" + this.port + "/oops", Map.class); assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, entity.getStatusCode()); @SuppressWarnings("unchecked") Map<String, Object> body = entity.getBody(); assertEquals("None", body.get("error")); assertEquals(999, body.get("status")); }