tags:

views:

328

answers:

1

Is is possible for Resin (3.0.27) to map a welcome-file to a Servlet?

I can't find anything in the Caucho documentation that says this is not supported. Your help would be greatly appreciated.

<servlet-mapping>
    <servlet-name>td</servlet-name>
    <url-pattern>*.htm</url-pattern>
</servlet-mapping>

<welcome-file-list>
    <welcome-file>index.htm</welcome-file>
</welcome-file-list>

Edit: If it isn't obvious from my post, the above isn't working. :)

Edit: If I place the index.htm in the file system, the servlet-mapping works. It's as if Resin terminates the request if it can't find the physical file.

+1  A: 

Due to the way that caucho_module loads its configuration, it very well may ignore welcome files. The welcome file mapping is done by the servlet container (e.g., Resin in your case). But caucho_module seems to be looking for an explicit mapping to exist to help it decide what goes and what doesn't go to Resin, vs what Apache will try to serve itself.

Perhaps this is a bug in caucho_module that it doesn't account for welcome file handling?

If this is true, then one kludgey way you could work around this would be to use Apache's mod_rewrite for the URLs that you wish to be mapped to a "welcome file." Indeed, trying this may well prove the case. For example, something like:

RewriteEngine on
RewriteRule ^/your/url/$  /your/url/index.htm [R=permanent,L]

You may want to try versions of the URL that do and do not end in a final slash ... I'm not familiar enough with mod_rewrite to know if that will make a difference. Anyway, this will tell Apache to tell the client to redirect (reload the page to) a URL that ends in your welcome page. If this kind of thing fixes the problem, then IMO this is a bug in cacho_module.

Another thing to try as a test is to go directly to Resin -- often on port 8888 -- to bypass Apache HTTP to see if going directly to Resin the welcome page is correctly handled.

Eddie
Yes, I've tried the rewrite rule and it does work. Unfortunately, sometimes, the index file is a .jsp and not a .htm so my rewrite rule list could get quite long.
BacMan
Well, now we know what the problem is. Next step is finding out if there is an acknowledged bug or workaround in caucho_module to handle this kind of problem.
Eddie
I think it's a bug with Resin. I will try to contact Caucho.
BacMan
Do you have the "DirectoryIndex index.htm" directive in your Apache HTTP configuration file for the virtual host you are using? If not, does this make any difference?
Eddie
I have it there. Doesn't change anything.
BacMan