dev@grizzly.java.net

Sometimes a static content is not served

From: Bongjae Chang <carryel_at_korea.com>
Date: Wed, 1 Jul 2009 12:03:10 +0900

Hi,

I deploy the attached war with grizzly-http-servlet-deployer, sometimes static content is not served.

Here is the script.

>java -jar grizzly-http-servlet-deployer-1.9.17-SNAPSHOT.jar --port=8080 --application=./examples.war

When I debugged the strange behavior, I could see some interesting result.

I added the debug code to GrizzlyWebServer#updateGrizzlyAdapters()
---
private void updateGrizzlyAdapters() {
   if( adapters.size() == 0 ) {
      ...
   } else {
      for(Entry<GrizzlyAdapter,String[]> entry: adapters.entrySet()) {
         System.out.println( "isHandleStaticResources()=" + entry.getKey().isHandleStaticResources() );
         ...
      }
      ...
   }
}
---

When the problem was reproduced, the following message is printed.
---
isHandleStaticResources()=true
isHandleStaticResources()=false
---

When the problem was not reproduced, the following message is printed.
---
isHandleStaticResources()=false
isHandleStaticResources()=true
---

I tested it, default two ServletAdapter was created.

1. handleStaticResources = false, servletPath = "", contextPath = "/examples"
2. handleStaticResources = true, servletPath = "/", contextPath = "/examples"

And when I request "/examples/1k.jpg" with IE, above 2 should be served.

But according to adapter's initialization, above 1 used to serve the request, then the problem is reproduced.

When the war is deployed, default wrapper and context seem to be overwritten according to adapter's memory value's order.

Thanks.

--
Bongjae Chang