Correctly shutting down a websocket handler
by Robin Anil
When a client disconnects, I see that onClose is not being fired. The only
way this seems to be firing if client sents a close frame.
Is there any way to detect disconnection and immediately close all the
opened resources.
Robin
Robin Anil | Software Engineer
1 year, 2 months
Resizing undertow thread pool size dynamically
by Mohammed ElGhaouat
Hi,
I would like to know if there is a way to make undertow reducing the size
of the thread pool when the server is less loaded. Is there any
parameter(or other way) that make an idle thread die after some inactivity
time ?
Thanks.
Mohammed.
8 years, 12 months
SSE close task
by Nel Taurisson
Hi,
I'm playing with the SSE handler and I can't figure how the close task is
working. I thought the close task would be invoked when the client closes
the connection but it doesn't seem to be the case.
I slightly modified the example code to register a close task when a
connection is initiated, here's the code :
ServerSentEventConnectionCallback callback = new
ServerSentEventConnectionCallback() {
@Override
public void connected(ServerSentEventConnection connection,
String lastEventId) {
System.out.println("adding close task on connection...");
connection.addCloseTask(channel ->
System.out.println("goodbye cruel world..."));
}
};
final ServerSentEventHandler sseHandler =
Handlers.serverSentEvents(callback);
It appears to me that the close task is only invoked when the server stops,
but now when the client closes. Is it the expected behavior ? If so, is
there any other way to be notified of a client disconnection ?
Thanks a lot.
Nel
9 years
Unified SecurityContext/Exchange/Session for Http and Websockets
by Robin Anil
Currently the code path requires separate mechanisms for http and
websockets. This means the guice scoping logic gets complicated for all
business objects derived from SecurityContext/Exchange
For example lets say we are sending a cookie containing a JWT token. For
Http we have written an Authentication mechanism which creates a security
context and then a guice injector which gets the authenticated data from
the security context Principal.
Now if we need to support websockets, firstly the authentication mechanism
is non existent.
Another example is the Headers. In HttpServerExchange the headers are in a
HeaderMap but for websockets it is a Map<String, List<String>>. The
injection code that worked off HeaderMap now no longer work in Websocket
context.
I feel like this can be improved if there are shared interfaces for these
core objects across Http and Websockets so that it becomes easy for
downstream code to re-use business object injection logic across the two
Thoughts?
Robin
9 years
way to call sendError within AuthMech?
by Bill Burke
Is there a way to call HttpServletResponse.sendError() within a
AuthenticationMechanism? I'm getting the following after calling
sendError and returning AuthenticationMechanismOutcome.NOT_AUTHENTICATED
java.lang.IllegalStateException: UT010019: Response already commited
at
io.undertow.servlet.spec.HttpServletResponseImpl.sendError(HttpServletResponseImpl.java:124)
at
io.undertow.servlet.spec.HttpServletResponseImpl.sendError(HttpServletResponseImpl.java:167)
at
io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:61)
at
io.undertow.server.handlers.DisableCacheHandler.handleRequest(DisableCacheHandler.java:33)
at
io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at
io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:51)
at
io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
9 years
HTTP/2 Response Header in Java
by jorge lima
Hi,
Is there already a way to get the HTTP/2 response header in Java using
Undertow? I really need to know. I'm using JDK 7 on my Java Project. Thank
you very much!
9 years
ServerSentEventConnection async?
by Sven Kubiak
Hey,
I am writing a service where I keep a list of ServerSentEventConnections.
Is the .send(String data) method async? Or in other words: Can I loop through the list of connections and call the send method without it blocking the loop?
Cheers,
Sven
9 years, 1 month
Proxy Protocol/Layer-4 load balancing/AWS ELB
by Christopher Smith
I was curious if anyone had set up undertow to work with a layer-4 proxy
server with undertow. I'm looking at using undertow behind an AWS ELB, but
it's layer-7 load balancing logic kills any shot I have of taking advantage
of undertow's awesome HTTP/2 & SPDY support.
ELB supports layer-4 load balancing, which would just multiplex inbound TCP
connections (with an added bonus of offloading TLS), but I'm concerned
about losing client IP addresses. ELB actually has a way to address this
with HAProxy's PROXY protocol:
http://www.haproxy.org/download/1.6/doc/proxy-protocol.txt
However, I haven't found a place for setting up the PROXY protocol support
in undertow. Has anyone done this? Is there a way I should be going about
it?
It feels like I'd just need to wrapper the existing Listener implementation
with some kind of delegate that first parsed the PROXY header, extracted
the client address/port/protocol/etc., and then passed on the rest of the
logic to the HTTP2 handler. Is that about right?
--
Chris
9 years, 1 month