dev@glassfish.java.net

[HEADS UP] networkListener.findProtocol() and port unification

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Wed, 19 Aug 2009 16:50:27 +0200

Hi,

I've just integrated Grizzly 1.9.18-M1, which has initial support for
port unification feature for Glassfish V3.

I found a lot of modules, which retrieve Http protocol configuration
by doing following:

[1]
Protocol protocol = networkListener.findProtocol();
Http http = protocol.getHttp();

After port unification integration, the correct way to retrieve Http
configuration is following:

[2]
Protocol protocol = networkListener.findHttpProtocol();
Http http = protocol.getHttp();


[1] worked fine so far, because in domain.xml, network-listeners were
referring just Http protocols. Like:

           <protocol name="http-listener-1">
             <http chunking-disabled="false" max-connections="250"
default-virtual-server="server" />
           </protocol>

           <network-listener port="8080" protocol="http-listener-1"
transport="tcp" name="http-listener-1" thread-pool="http-thread-pool" />



Having integrated port unification feature, we added possibility to
declare composite protocols like:


           <protocol name="listener-1">
             <port-unification>
               <protocol-finder protocol="http-1"
classname="com.sun.grizzly.http.portunif.HttpProtocolFinder"
name="http-finder" />
               <protocol-finder protocol="soap-tcp"
classname
="org.glassfish.webservices.transport.tcp.WSTCPProtocolFinder"
name="soap-tcp-finder" />
             </port-unification>
           </protocol>
           <protocol name="http-1">
             <http max-connections="250" default-virtual-
server="server" server-name="">
               <file-cache enabled="false" />
             </http>
           </protocol>
           <protocol name="soap-tcp">
             <protocol-chain-instance-handler>
               <protocol-chain>
                 <protocol-filter
classname
="org.glassfish.webservices.transport.tcp.WSTCPProtocolFilter"
name="soap-tcp-filter" />
               </protocol-chain>
             </protocol-chain-instance-handler>
           </protocol>

           <network-listener port="8080" protocol="listener-1"
transport="tcp" name="http-listener-1" thread-pool="http-thread-pool" />


In the latest example network-listener refers to port-unification
protocol.
So call networkListener.findProtocol() will not return http-1 protocol
declaration, but listener-1.
Call networkListener.findHttpProtocol() will return http-1 protocol
declaration.


Before commiting port-unification support I've changed *all*
occurrences of findProtocol to findHttpProtocol to make sure build
will not be broken, but for modules like admin/admingui, which work
with plain network configuration, and not specifically Http, probably
findProtocol() may have more sense...

Thanks.

WBR,
Alexey.