tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: Convert URL path from directory/ to directory/index.htm (Spring related)
Date Wed, 29 Jun 2005 15:13:32 GMT
This is also done in Tomcat via <welcome-file> element in web.xml. Ex.:

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

In servlet spec 2.4 (Tomcat 5.0,5.5), this can map to either a physical 
file or a servlet mapped to that URL. I think in earlier servlet specs, 
it had to be a physical file. SRV.9.10 of the spec has more info.

 --David

Allistair Crossley wrote:

>Hi,
>
>You'd normally attempt to do this with URL rewriting at the web server side. I read that
tomcat does not really offer URL rewriting at this time if used as a web server, I could be
wrong.
>
>For what it's worth, we place index.jsp documents in folders that the user may request
that do a erquest forward to index.htm which is then picked up by Spring. If using IIS you
can also specifying default documents like index.htm which the web server will try until it
gets a bite from Tomcat
>
>All the best, Allistair.
>
>  
>
>>-----Original Message-----
>>From: Andy [mailto:andy@fritter.net]
>>Sent: 29 June 2005 14:18
>>To: tomcat-user@jakarta.apache.org
>>Subject: Convert URL path from directory/ to 
>>directory/index.htm (Spring
>>related)
>>
>>
>>
>>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.DispatcherServl
>>et</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: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>
><FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
>-------------------------------------------------------
>QAS Ltd.
>Registered in England: No 2582055
>Registered in Australia: No 082 851 474
>-------------------------------------------------------
></FONT>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message