Example usage for org.springframework.http HttpStatus value

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

Introduction

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

Prototype

int value

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

Click Source Link

Usage

From source file:org.wheelmap.android.net.ApiKeyExecutor.java

@Override
protected void checkApiCallClientErrors(HttpClientErrorException e) throws RestServiceException {
    HttpStatus status = e.getStatusCode();
    if (status.value() == statusAuthFailed) {
        Log.e(getTag(), "authorization failed - email or password not valid");
        processException(RestServiceException.ERROR_AUTHORIZATION_ERROR, e, false);
    } else if (status.value() == statusOSMFailed) {
        Log.e(getTag(), "osm failed");
        processException(RestServiceException.ERROR_NOT_OSM_CONNECTED, e, false);
    }/*from www .  ja  v a 2 s.  com*/
}

From source file:marytts.http.controllers.MaryErrorController.java

@RequestMapping
@ResponseBody/*from  w w w .jav  a  2 s  .c o  m*/
public ResponseEntity<Object> error(HttpServletRequest request) {
    HttpStatus status = getStatus(request);
    return new ResponseEntity<Object>(new ErrorResponse(status.value(), status.name()), status);
}

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

private Map<String, Object> createDefaultResponseBody(Exception ex, HttpStatus status) {
    Map<String, Object> body = Maps.newLinkedHashMap();
    body.put("status", status.value());
    body.put("message", ex.getMessage());
    return body;/*from ww  w .  j av a2  s .c  o  m*/
}

From source file:org.smigo.comment.CommentController.java

@PreAuthorize("isAuthenticated()")
@RequestMapping(value = "/rest/comment/{id}", produces = "application/json", method = RequestMethod.DELETE)
@ResponseBody/*w  w  w  .j ava2s .  c  o  m*/
public void removeMessage(@PathVariable int id, @AuthenticationPrincipal AuthenticatedUser user,
        HttpServletResponse response) {
    HttpStatus httpStatus = commentHandler.removeComment(id, user);
    response.setStatus(httpStatus.value());
}

From source file:org.jasig.springframework.web.client.PortletResourceProxyResponse.java

@Override
public void setHttpStatus(HttpStatus status) {
    this.resourceResponse.setProperty(ResourceResponse.HTTP_STATUS_CODE, Integer.toString(status.value()));
}

From source file:org.openlmis.fulfillment.service.DataRetrievalException.java

/**
 * Constructs the exception./*from www.j a v a  2s . co m*/
 *
 * @param resource the resource that we were trying to retrieve
 * @param status   the http status that was returned
 * @param response the response from referencedata service
 */
DataRetrievalException(String resource, HttpStatus status, String response) {
    super(String.format("Unable to retrieve %s. Error code: %d, response message: %s", resource, status.value(),
            response));
    this.resource = resource;
    this.status = status;
    this.response = response;
}

From source file:com.orange.clara.tool.controllers.AbstractDefaultController.java

protected ResponseEntity<String> generateEntityFromStatus(HttpStatus httpStatus) {
    return ResponseEntity.status(httpStatus).body(httpStatus.value() + " " + httpStatus.getReasonPhrase());
}

From source file:app.api.swagger.SwaggerConfig.java

private ResponseMessage response(final HttpStatus status, final String ref) {
    return new ResponseMessage(status.value(), status.getReasonPhrase(), new ModelRef(ref));
}

From source file:com.envision.envservice.rest.PushConfigResource.java

@SuppressWarnings("rawtypes")
@POST//from   w  w  w  . j  a v  a  2  s.c  om
@Path("/addPushConfig")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response addPushConfig(PushConfigBo pushConfigBo) throws Exception {
    HttpStatus status = HttpStatus.CREATED;
    Map response = pcService.addPushConfig(pushConfigBo);
    return Response.status(status.value()).entity(response).build();

}

From source file:edu.pitt.dbmi.ccd.anno.error.ErrorMessage.java

/**
 * Constructor/*from   w  w  w . j  a  v  a 2s.  c o m*/
 *
 * @param http http status
 * @param message error message
 * @param req http servlet request
 * @return ErrorMessage with current timestamp, status and error from
 * HttpStatus, message, and path from HttpServletRequest
 */
public ErrorMessage(HttpStatus http, String message, HttpServletRequest req) {
    this.timestamp = new Date();
    this.status = http.value();
    this.error = http.getReasonPhrase();
    this.message = message;
    this.path = req.getRequestURI();
}