On Aug 19, 2014, at 1:12 PM, Bill O'Neil <bill(a)dartalley.com> wrote:
I have been having trouble figuring out how to set request timeouts
and how to handle them.
I have been messing around with the following.
Undertow server = Undertow.builder()
.addHttpListener(8080, "localhost")
.setSocketOption(UndertowOptions.IDLE_TIMEOUT, 1000)
.setSocketOption(Options.READ_TIMEOUT, 1000)
.setSocketOption(Options.WRITE_TIMEOUT, 1000)
These options go on the server via the setUndertowOptions() method. Note that idle timeout
acts as a default for read and write options if not explicitly set. You don’t have to set
all three of these.
When setting a HttpHandler that sleeps this will return an empty reply from server.
curl -v localhost:8080
* Adding handle: conn: 0x7f81a900ee00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f81a900ee00) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 8080 (#0)
* Trying ::1...
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.30.0
> Host: localhost:8080
> Accept: */*
>
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server
1. What is the proper way to handle time outs?
2. Is it possible to set different timeouts per HttpHandler?
Thanks,
Bill
_______________________________________________
undertow-dev mailing list
undertow-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev
--
Jason T. Greene
WildFly Lead / JBoss EAP Platform Architect
JBoss, a division of Red Hat