List of usage examples for org.springframework.http HttpStatus getReasonPhrase
public String getReasonPhrase()
From source file:org.trustedanalytics.utils.errorhandling.ErrorFormatter.java
public static String formatErrorMessage(HttpStatus httpStatus, long errorId) { return formatErrorMessage(httpStatus.getReasonPhrase(), errorId); }
From source file:org.trustedanalytics.utils.errorhandling.ErrorLogger.java
public static void logAndSendErrorResponse(Logger logger, HttpServletResponse response, HttpStatus status, Exception ex) throws IOException { logAndSendErrorResponse(logger, response, status, status.getReasonPhrase(), ex); }
From source file:org.trustedanalytics.user.common.WebErrorHandlers.java
private static void logAndSendErrorResponse(HttpServletResponse response, HttpStatus status, Exception ex) throws IOException { logAndSendErrorResponse(response, status, status.getReasonPhrase(), ex); }
From source file:storage.StorageServiceWrapperController.java
static protected ResponseEntity<String> seleniumFriendlyResponse(@Nonnull final HttpStatus status) { return new ResponseEntity<>(status.getReasonPhrase(), status); }
From source file:urlshortener2014.oldBurgundy.web.errorcontroler.ErrorMvcAutoConfiguration.java
public static ResponseEntity<?> responseError(HttpStatus httpStatus) { StringWriter writer = new StringWriter(); VelocityContext context = new VelocityContext(); context.put("error", httpStatus.getReasonPhrase()); context.put("status", httpStatus); context.put("img", "http://localhost:8080/img/" + httpStatus + ".jpg"); Velocity.mergeTemplate("err.vm", "ISO-8859-1", context, writer); HttpHeaders h = new HttpHeaders(); h.setContentType(MediaType.TEXT_HTML); return new ResponseEntity<>(writer.toString(), h, HttpStatus.NOT_FOUND); }
From source file:com.onedrive.api.exception.OneDriveException.java
public OneDriveException(ErrorResponse errorResponse, HttpHeaders headers, HttpStatus status, Throwable cause) { super(status.value() + " [" + status.getReasonPhrase() + "] " + errorResponse.toString(), cause); this.errorResponse = errorResponse; this.headers = headers; this.status = status; }
From source file:web.logging.ExceptionLoggerAdvice.java
protected void sendStatus(HttpServletResponse response, HttpStatus status) throws IOException { response.sendError(status.value(), status.getReasonPhrase()); }
From source file:com.github.marceloverdijk.spring.security.jwt.web.JwtAuthenticationEntryPoint.java
@Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { HttpStatus unauthorized = HttpStatus.UNAUTHORIZED; response.sendError(unauthorized.value(), unauthorized.getReasonPhrase()); }
From source file:cucumber.api.spring.test.web.servlet.StatusResultMatchersStepdefs.java
@Then("^the response status should be \"(.*?)\"$") public void the_repsonse_status_should_be(String reasonPhrase) throws Throwable { for (HttpStatus status : HttpStatus.values()) { if (status.getReasonPhrase().equalsIgnoreCase(reasonPhrase)) { mockMvcStepdefs.getResultActions().andExpect(status().is(status.value())); return; }//from w w w . j av a2 s . co m } throw new IllegalArgumentException("No matching status code found for reason phrase: " + reasonPhrase); }
From source file:org.frat.common.controller.ErrorController.java
private String getExceptionMessage(Throwable throwable, Integer statusCode) { if (throwable != null) { return throwable.getMessage(); }/*from w w w .j a va2 s . c o m*/ HttpStatus httpStatus = HttpStatus.valueOf(statusCode); return httpStatus.getReasonPhrase(); }