You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Cox, Charlie" <cc...@cincom.com> on 2002/02/21 16:08:03 UTC

RE: Need root mapping for servlet but want to be able to retrieve ima ges... pls help

If you are using tomcat4, you can  use a filter to help with this.

you can map a directory to your servlet
<url-pattern>/myservlet/*</urlPattern>

then you can create a filter that maps '/*' and checks the requested URL
itself to see if it should be passed on(call doChain()) or
forwarded to /servlet/ to process it within the servlet(forward() without
calling doChain()).


Another alternative is you can map file types to a servlet
<url-pattern>*.html</urlPattern>

This allows you to leave images and jsp files alone.
Charlie

> -----Original Message-----
> From: Donie Kelly [mailto:donie.kelly@tecnomen.ie]
> Sent: Thursday, February 21, 2002 5:23 AM
> To: 'Tomcat Users List'
> Subject: Need root mapping for servlet but want to be able to 
> retrieve ima ges... pls help
> 
> 
> Hi all
> 
> I'm asking this question again because I still don't have a working
> solution. My servlet is mapped to / as shown below. However, 
> when I use jsp
> pages the images in the page are invoking a request from this servlet
> instead of getting the image. Anybody got a solution for this?
> 
> My images are in ../context/images
> Thanks
> Donie
> 
> 
>   <servlet>
>         <servlet-name>myservlet</servlet-name>
>         <display-name>myservlet</display-name>
>         <servlet-class>com.company.mm.y.myservlet</servlet-class>
>         <load-on-startup>50</load-on-startup>
>   </servlet>
> 
>   <servlet-mapping>
>         <servlet-name>myservlet</servlet-name>
>         <url-pattern>/</url-pattern>
>   </servlet-mapping> 
> 
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
> 

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>