Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Http response in case of timeout

Currently solved this by creating a custom TimeoutHander that wraps and executes our existing handlers using an ExecutorService. We expect the future response with a timeout. When we don't have a timely response we return our custom http response code + error message.

Kristof



On Tuesday, 17 February 2015, 20:28, Kristof <kr_adr@xxxxxxxxxxx> wrote:


Hi all,

I configured Jetty Server to time out by configuring 'maxIdleTime' on a Connector that we register with the server.
The timeout works but I don't like the response that is being returned when the timeout occurs (curl output) ->

* Connected to localhost (::1) port 58272 (#0)
> GET /metrics HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:58272
> Accept: */*
>
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server

This is an example of using curl. It basically returns an empty reply which is confusing and not very helpful for the user.
Instead I would want to return a 504 response code so we know a timeout occurs and not another error.

Is there a way to do this without having to write code ourselves in the Handler?
I'm currently using Jetty 8.1.8 in embedded mode. 


Thanks!
Kristof 



Back to the top