Send HTTP 408 on idle timeout

This commit is contained in:
Chris Eager 2023-11-20 13:31:08 -06:00 committed by Chris Eager
parent e04b5e5c9f
commit d6ade0e1ac
1 changed files with 3 additions and 0 deletions

View File

@ -21,7 +21,10 @@ public class IOExceptionMapper implements ExceptionMapper<IOException> {
public Response toResponse(IOException e) {
if (!(e.getCause() instanceof java.util.concurrent.TimeoutException)) {
logger.warn("IOExceptionMapper", e);
} else if (e.getCause().getMessage().startsWith("Idle timeout expired")) {
return Response.status(Response.Status.REQUEST_TIMEOUT).build();
}
return Response.status(503).build();
}
}