jsr340-experts@servlet-spec.java.net

[jsr340-experts] Re: Proposed changes to upgrade mechanism

From: Shing Wai Chan <shing.wai.chan_at_oracle.com>
Date: Fri, 07 Dec 2012 13:50:44 -0800

As I haven't received any feedback on this email thread, I take it that
everyone is ok with the
changes to the upgrade handling as outlined in the email. I will go
ahead and incorporate the
changes in the spec on Friday (today) COB.

Thanks.
Shing Wai Chan

On 11/28/12 4:33 PM, Shing Wai Chan wrote:
> Based on and expert group and other discussions, I propose the
> following changes to upgrade mechanism.
>
> 1. rename ProtocolHandler to HttpUpgradeHandler
>
> 2. add a way for the handler code to end a connection
> public interface WebConnection extends java.io.AutoCloseable;
> (In this case, we need JDK 7.)
>
> 3. add a way to inform the handler code when the client is disconnected
> Add the following API to ProtocolHandler:
> public void destroy();
>
> 4. Change the HttpServletRequest#upgrade from
> public void upgrade(ProtocolHandler handler) throws IOException;
> to
> public<T extends HttpUpgradeHandler> T upgrade(Class<T> handler)
> throws IOException;
> And we will require that the class passed in has a no ops constructor.
> In this case, the user can configure the HttpUpgradeHandler
> instance before upgrade processing
> and will be benefited by dependency injection.
>
> Please let me know if you have any comment.
> Thanks.
> Shing Wai Chan
>