Java Code Examples for javax.servlet.http.HttpServletResponse#SC_GATEWAY_TIMEOUT

The following examples show how to use javax.servlet.http.HttpServletResponse#SC_GATEWAY_TIMEOUT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TitusExceptionMapper.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
private Response fromTimeoutException(TimeoutException e) {
    int status = HttpServletResponse.SC_GATEWAY_TIMEOUT;

    Throwable cause = e.getCause() == null ? e : e.getCause();
    String errorMessage = toStandardHttpErrorMessage(status, cause);

    ErrorResponse errorResponse = ErrorResponse.newError(status, errorMessage)
            .clientRequest(httpServletRequest)
            .serverContext()
            .exceptionContext(cause)
            .build();
    return Response.status(status).entity(errorResponse).build();
}
 
Example 2
Source File: ManagementException.java    From qpid-broker-j with Apache License 2.0 4 votes vote down vote up
private static ManagementException createGatewayTimeoutManagementException(final RuntimeException e)
{
    return new ManagementException(HttpServletResponse.SC_GATEWAY_TIMEOUT, e.getMessage(), e, null);
}
 
Example 3
Source File: RetryOnGatewayTimeout.java    From cloudbreak with Apache License 2.0 4 votes vote down vote up
private static boolean isResponseGatewayTimedOut(WebApplicationException e) {
    try (Response response = e.getResponse()) {
        return response.getStatus() == HttpServletResponse.SC_GATEWAY_TIMEOUT;
    }
}