Hi Andy -

Control of what to handle in tomcat and how to forward is fairly limited. (someone posted the relevant parts of the servlet spec)

What I do is have tomcat forward all requests to spring, except for ones I really want tomcat's "default" servlet to handle (static stuff like images, css), so I have the following in the web.xml

    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>*.gif</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>*.png</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>default</servlet-name>
        <url-pattern>*.css</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>my_spring_dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

The control you have on url-mapping is much finer in spring - so why not do everything you want there... This __does__ mean you have to handle 404 etc type problems within spring (but again, quite easy to have a catch-all handler for these).

I only do the "default" mappings so spring doesn't need to handle obviously static resouces.

hth

Tim

Andy wrote:
Hi,

Is there anyway to get Tomcat to convert a request such as
myserver.com/directory into myserver.com/directory/index.htm.

The reason for this is that in Spring you have to specify a
wild card to match against the URL path in order to invoke
the DispatcherServlet, if this wild card is *.htm then a
requested without index.htm in it results in a 404 from Tomcat.

i.e. myserver.com/directory
     - gives a 404 response
     myserver.com/directory/index.htm
     - invokes Spring to deal with the request

Perhaps this is an issue I can solve within Spring but
thought I'd try the Tomcat angle first.

This is what I have in my web.xml for Spring -

    <servlet>
        <servlet-name>abc</servlet-name>

<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-cl
ass>
        <load-on-startup>1</load-on-startup>
    </servlet>

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


Thanks,

Andy.






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to