Example usage for org.springframework.http HttpStatus INTERNAL_SERVER_ERROR

List of usage examples for org.springframework.http HttpStatus INTERNAL_SERVER_ERROR

Introduction

In this page you can find the example usage for org.springframework.http HttpStatus INTERNAL_SERVER_ERROR.

Prototype

HttpStatus INTERNAL_SERVER_ERROR

To view the source code for org.springframework.http HttpStatus INTERNAL_SERVER_ERROR.

Click Source Link

Document

500 Internal Server Error .

Usage

From source file:org.kaaproject.kaa.sandbox.web.controller.SandboxController.java

@ExceptionHandler(SandboxServiceException.class)
public ResponseEntity<String> handleSandboxServiceException(SandboxServiceException ex) {
    ResponseEntity<String> entity = new ResponseEntity<>(ex.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
    return entity;
}

From source file:org.openmhealth.dsu.controller.GenericExceptionHandlingControllerAdvice.java

@ExceptionHandler(Exception.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public void handleException(Exception e, HttpServletRequest request) {

    log.warn("A {} request for '{}' failed.", request.getMethod(), request.getPathInfo(), e);
}

From source file:org.ng200.openolympus.controller.errors.ExceptionHandlingController.java

@ExceptionHandler(GeneralNestedRuntimeException.class)
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
public String handleNestedException(GeneralNestedRuntimeException ex) throws Throwable {
    throw ex.getCause();
}

From source file:com.lixiaocong.exception.ExceptionControllerAdvice.java

@ResponseBody
@ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(RestParamException.class)
public Map<String, Object> handleRestParamException() {
    return ResponseMsgFactory.createFailedResponse("?");
}

From source file:com.culturedear.counterpoint.XmlRestController.java

@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_XML_VALUE)
public ResponseEntity<Object> write(@RequestBody CounterpointModel counterpointModel) {

    // prepare response XML out
    CounterpointGenerator cg = new CounterpointGenerator();
    cg.fillRhyPat();/*from   www.j  ava2  s  .  c om*/
    int[] cf = counterpointModel.getMainMelody();
    cg.setCantusFirmus(cf);
    int[] vbs = counterpointModel.getPartsInitialNotes();

    CounterpointSolution counterpointSolution = cg.anySpecies(counterpointModel.getScaleMode(), vbs, cf.length,
            counterpointModel.getCounterpointSpecies(), counterpointModel.getRulePenalties());

    ScorePartwise scorePartwise = null;

    try {
        scorePartwise = counterpointSolution.toScorePartwise();
    } catch (NullPointerException ex) {
        scorePartwise = null;
    }

    return Optional.ofNullable(scorePartwise).map(cm -> new ResponseEntity<>((Object) cm, HttpStatus.OK))
            .orElse(new ResponseEntity<>("Could not compute the counterpoint.",
                    HttpStatus.INTERNAL_SERVER_ERROR));
}

From source file:com.citibanamex.api.locator.atm.exceptions.GlobalExceptionHandler.java

/**
 * This method is to handle BaseException category
 * //from   ww  w. j  a  va 2s.  co m
 * @param ServerError
 * @return Response
 */
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(value = ServerError.class)
public ResponseEntity<?> handleBaseException(ServerError e) {
    Response response = new Response();
    response.setTimeStamp(new Date().getTime());
    response.setStatus("FAILURE");
    response.setErrorCode(HttpStatus.INTERNAL_SERVER_ERROR.value());
    response.setMessage("Internal Server Error");
    response.setDescription("Internal Server Error");
    logger.info("Http response -" + response.getErrorCode() + "-" + response.getDescription() + "-"
            + response.getMessage());
    return new ResponseEntity<Response>(response, HttpStatus.INTERNAL_SERVER_ERROR);
}

From source file:au.id.hazelwood.sos.web.controller.framework.GlobalExceptionHandler.java

@ExceptionHandler(value = Exception.class)
public ResponseEntity<Object> handleAllUnknown(Exception ex, WebRequest request) {
    return handleExceptionInternal(ex, null, new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR, request);
}

From source file:com.intel.databackend.handlers.ErrorHandler.java

@ExceptionHandler(VcapEnvironmentException.class)
public ResponseEntity handleError(VcapEnvironmentException ex) {
    logger.error("Unable to parse Cloud Foundry env variables", ex);
    return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
}

From source file:com.blstream.patronage.ctf.common.web.controller.AbstractRestController.java

/**
 * Returns error message when Exception occured.
 * @param e//from   www  .ja  v a  2 s. com
 * @return
 */
@ExceptionHandler(Exception.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public MessageUI handleException(Exception e) {
    MessageUI messageUI = new MessageUI();

    messageUI.setErrorDescription(e.getMessage());
    messageUI.setError(failedMessage);
    messageUI.setErrorCode(ErrorCodeType.FAILED);

    return messageUI;
}