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.trenako.web.controllers.ImagesController.java
@ExceptionHandler(UploadRenderingException.class) @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR) public void handleIOException(UploadRenderingException ex, HttpServletResponse response) { log.error(ex.toString());//from ww w . j a va 2s . co m }
From source file:org.fede.calculator.web.controller.MoneyCalculator.java
@ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public MoneyDTO errorHandler(Exception ex) { LOG.log(Level.SEVERE, "Error al calcular IPC", ex); MoneyDTO dto = new MoneyDTO(); dto.setValid(false);/*from w ww .ja va 2s .c om*/ dto.setMessage("El monto o la fecha ingresados son vlidos."); return dto; }
From source file:com.devicehive.handler.RequestDispatcher.java
@Override @SuppressWarnings("unchecked") public Response handle(Request request) { final Action action = Action.valueOf(request.getBody().getAction()); try {//from w ww. j a va 2 s . co m return Optional.ofNullable(handlerMap.get(action)).map(handler -> handler.handle(request)) .orElseThrow(() -> new RuntimeException("Action '" + action + "' is not supported.")); } catch (Exception e) { logger.error("Unable to handle request.", e); return Response.newBuilder().withBody(new ErrorResponse(e.getMessage())).withLast(true) .buildFailed(HttpStatus.INTERNAL_SERVER_ERROR.value()); } }
From source file:alfio.controller.api.admin.UsersApiController.java
@ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ResponseBody// w w w. j a v a2 s. c o m public String unhandledException(Exception e) { log.error("unhandled exception", e); return e.getMessage(); }
From source file:com.zuoxiaolong.blog.cache.controller.ArticleRankController.java
/** * ???//from w w w. ja v a 2 s .c om * * @return */ @RequestMapping(value = "/article/rank") public ResponseEntity articleRank() { logger.info("Starting get article rank..."); List<ArticleRankResponseDto> articleRankResponseDtoList; try { articleRankResponseDtoList = userArticleServiceManager.getArticlesRank(); } catch (Exception e) { logger.error("Getting article rank occur an error.", e); Map<String, String> map = Maps.newHashMap(); map.put("error", e.getMessage()); return new ResponseEntity(map, HttpStatus.INTERNAL_SERVER_ERROR); } return new ResponseEntity(articleRankResponseDtoList, HttpStatus.OK); }
From source file:io.sevenluck.chat.controller.ChatRoomController.java
@ExceptionHandler @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public ResponseEntity<?> handleException(ChatRoomAlreadyExists e) { logger.error("validate:", e.getMessage()); return new ResponseEntity<>(ExceptionDTO.newConflictInstance(e.getMessage()), new HttpHeaders(), HttpStatus.CONFLICT);//from ww w . j av a2 s . c o m }
From source file:com.auditbucket.registration.endpoint.RegistrationEP.java
@RequestMapping(value = "/", consumes = "application/json", method = RequestMethod.POST) @ResponseBody/*from w w w . j a v a 2 s.com*/ public ResponseEntity<SystemUser> registerSystemUser(@RequestBody RegistrationBean regBean) throws DatagioException { // curl -u mike:123 -H "Content-Type:application/json" -X PUT http://localhost:8080/ab/profiles/register -d '{"name":"mikey", "companyName":"Monowai Dev","password":"whocares"}' SystemUser su = regService.registerSystemUser(regBean); if (su == null) return new ResponseEntity<>(su, HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(su, HttpStatus.CREATED); }
From source file:com.jwt.exceptions.GlobalExceptionHandler.java
@ExceptionHandler() @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ResponseBody/*from w w w .j av a 2s . c om*/ public ErrorResponse handleException(Exception exception, HttpServletResponse httpResponse) { exception.printStackTrace(); ErrorResponse errorResponse = errorResponseFactory.getErrorResponse(); if (errorResponse != null && errorResponse.getMessage() == null) { String msg = messageProvider.getDefaultErrorMessage(); errorResponse = ErrorResponse.of(msg, GlobalErrCodes.GLOBAL, HttpStatus.INTERNAL_SERVER_ERROR); } errorResponseFactory.unregisterErrorResponse(); httpResponse.addHeader("IS-FLASH", "true"); return errorResponse; }
From source file:io.sevenluck.chat.controller.UserController.java
@ExceptionHandler @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public ResponseEntity<?> handleException(Exception ex) { logger.error("error:", ex); return new ResponseEntity<>(new User(0L, "b", "a"), new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR); }