[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: servlet transport implementation

ataylor do-not-reply at jboss.com
Mon Jan 12 04:49:17 EST 2009


here's a bit more of a detailed explanation to how this will work. This will be implemented in netty as discussed in irc.

A ServletContextListener will create a ClientBootstrap on startup. This will be configured via properties, probably read in from a config file with some sensible defaults. This will be added as an attribute to the ServletTransport. It would be cool if netty had an invm client bootstrap to use however in the absence of this it will be a normal socket connection. Trustin, currently would there be any way of doing this invm?

An HttpSessionListener will be used to create a connection for each session. Since netty doesn't support cookies at the minute we will have to manually check the headers to pull out the session id and add it as a parameter for all further requests. Also at this point we'll set the pipeline factory before creating the connection. a seperate instance of a 'ServletChannelHandler will be set for each connection. Both the Channel and the ServletChannelhandler will be added to the session as attributes.

The ServletChannelHandler will work 2 ways. On MessageReceived it will either 1) store the received buffers to be returned by the next http request (polling) or 2) write directly to the ServletOutputStream (streaming). 

The Servlet itself will decode the http request body and forward it via the channel previously set on the session. It will then set the appropriate headers on the response and return as the body any awaiting responses if using the polling method. 

>From a client side we'll be able to reuse most of what we already have. maybe just a few changes for using sessions and for streaming.

Trustin, how would you like me to package the servlet classes etc. Also i'll include some sample web.xml configurations etc so where should i put these?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4200922#4200922

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4200922



More information about the jboss-dev-forums mailing list