RE: Convert URL path from directory/ to directory/index.htm (Spring related)

2005-06-29 Thread Allistair Crossley
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:[EMAIL PROTECTED]
 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-nameabc/servlet-name
 
 servlet-classorg.springframework.web.servlet.DispatcherServl
 et/servlet-cl
 ass
 load-on-startup1/load-on-startup
 /servlet
 
 servlet-mapping
 servlet-nameabc/servlet-name
 url-pattern*.htm/url-pattern
 /servlet-mapping
 
 
 Thanks,
 
 Andy.
 
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Convert URL path from directory/ to directory/index.htm (Spring related)

2005-06-29 Thread Tim Diggins

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-namedefault/servlet-name
url-pattern*.gif/url-pattern
/servlet-mapping
servlet-mapping
servlet-namedefault/servlet-name
url-pattern*.png/url-pattern
/servlet-mapping
servlet-mapping
servlet-namedefault/servlet-name
url-pattern*.css/url-pattern
/servlet-mapping
servlet-mapping
servlet-namemy_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-nameabc/servlet-name

servlet-classorg.springframework.web.servlet.DispatcherServlet/servlet-cl
ass
load-on-startup1/load-on-startup
/servlet

servlet-mapping
servlet-nameabc/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]



Re: Convert URL path from directory/ to directory/index.htm (Spring related)

2005-06-29 Thread David Smith

This is also done in Tomcat via welcome-file element in web.xml. Ex.:

welcome-file-list
welcome-fileindex.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:[EMAIL PROTECTED]
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-nameabc/servlet-name

servlet-classorg.springframework.web.servlet.DispatcherServl
et/servlet-cl
ass
   load-on-startup1/load-on-startup
   /servlet

   servlet-mapping
   servlet-nameabc/servlet-name
   url-pattern*.htm/url-pattern
   /servlet-mapping


Thanks,

Andy.






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


   




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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

 




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