dev@glassfish.java.net

Re: [v3] Still having problems w/ deploy

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Wed, 13 Aug 2008 16:45:11 -0700

Marina Vatkina wrote:
> Kedar,
>
> This is what Jeanfrancois mentioned on the issue at the time when he
> found the work around:
>
>> it seems the virtual-server hosts="" value in domain.xml is missing the
>> machine's name. Recently asadmin has changed the way the host:value
>> header is
>> computed, and it seems the value send by asadmin is not the same as
>> the one
>> computed on the server side.

I think I understand what's going on. :)

GrizzlyService now uses the same com.sun.grizzly.util.http.mapper.Mapper
("Mapper") instance for mapping all kinds of requests.

There is one Mapper instance per GrizzlyProxy (listener).

As part of its request mapping logic, a Mapper attempts to match the
request's host name against a virtual server that was added to it.

If there is no match (as there won't be if you compare
"localhost" with the local host name),
it will delegate to the default-virtual-server, but only if one has been
configured - which is not the case right now.

The attached patch should fix the issue.

Since I never ran into the issue myself, I'd like to ask someone who
did (Marina, Shing-Wai, Kedar) to apply the attached diffs to their ws
and see if that fixes the problem.

Please let me know.

Thanks,


Jan



Index: core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/GrizzlyProxy.java
===================================================================
--- core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/GrizzlyProxy.java (revision 21716)
+++ core/kernel/src/main/java/com/sun/enterprise/v3/services/impl/GrizzlyProxy.java (working copy)
@@ -124,7 +124,7 @@
             logger.severe("Cannot parse port value : " + port + ", using port 8080");
         }
 
- configureGrizzly();
+ configureGrizzly(httpListener.getDefaultVirtualServer());
     }
 
 
@@ -133,7 +133,7 @@
      * configuration object.
      * @param port the port on which we need to listen.
      */
- private void configureGrizzly() {
+ private void configureGrizzly(String defaultVirtualServer) {
         grizzlyListener = new GrizzlyServiceListener(grizzlyService);
 
         GrizzlyListenerConfigurator.configure(
@@ -144,6 +144,7 @@
         Mapper mapper = new V3Mapper(logger);
         mapper.setPort(portNumber);
         geh.getContainerMapper().setMapper(mapper);
+ geh.getContainerMapper().setDefaultHost(defaultVirtualServer);
         geh.getContainerMapper().configureMapper();
 
         onePortMapper = new ExistingSingletonInhabitant<Mapper>(mapper);