You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Samuel Le Berrigaud <le...@essi.fr> on 2003/11/07 11:56:11 UTC
Access static content ...
Hi all,
I want to map my servlet with /* url pattern except the /resources
directory which contains static content that I want to acces directly.
Is there any particular configuration that could allow me to do so, in
my web.xml file or in the server.xml config file ?
I want to do that on a Tomcat 4.1
Thanks,
SaM
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Access static content ...
Posted by Jack Lauman <jl...@nwcascades.com>.
I'm using JBoss with Tomcat 4.1.27. I manipulate the URL by adding
param-values that are parts of the actual URL to the web.xml file
I think this will work with a stand alone Tomcat. It looks like
'commons-sandbox' project 'chains' is similar.
i.e.
<web-app>
<context-param>
<param-name>baseURL</param-name>
<param-value>www.nwcascades.com</param-value>
</context-param>
...
We include keywords, dropdown selects (as CDATA), almost anything
that is static from one page to the next. Make maintenance a great
deal easier.
In the JSP pages we use things similar to the following to separate
the static content on apache and the dynamic content generated by
JBoss/Tomcat.
<base href="http://<%=application.getInitParameter("baseUrl")%>/">
<title><%=application.getInitParameter("titleText")%></title>
...
We found that the time it takes to do this is well worth it if you
have a global change that affects a large number of pages.
Hope it helps,
Jack
Rodrigo Ruiz wrote:
>
> The problem is the "/resources" entry. If you map it to the default
> servlet, the directory name itself will not be part of the path, but a
> "root" for the actual one, so the default servlet will understand you
> want to get the path following "resources", and it is "". I guess the
> same will happen with the contents of the directory.
>
> It seems that the default servlet cannot be configured to serve files
> from an alternative directory.
>
> You could try one of the following:
> - Create your own servlet for "resources" requests. Perhaps you could
> subclass DefaultServlet, or use it in any other way.
> - Implement a Filter that redirects any request not to "resources" to
> your own servlet, and let the default configuration to work for the
> resources directory.
>
> Samuel Le Berrigaud wrote:
>
> > Thanks for your help,
> >
> > I'll do it another way I think and I'll probably come back on that
> > problem later on.
> >
> > SaM
> >
> > Tim Funk wrote:
> >
> >> Then there is either
> >> - a bug in tomcat
> >> - a config error (most likely) but don't know what could be the culprit
> >>
> >> I never heard of this before. Seems quite odd.
> >>
> >> -Tim
> >>
> >> Samuel Le Berrigaud wrote:
> >>
> >>> Yes
> >>>
> >>> Tim Funk wrote:
> >>>
> >>>> [Need more coffee]
> >>>>
> >>>> Does that mean that http://myserver/context/resources is serving a
> >>>> dir listing of the contents from http://myserver/context ?
> >>>> (instead of /context/resources)
> >>>>
> >>>> -Tim
> >>>
> >>>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
>
> ---------------------------------------------------------------------
> 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
Re: Access static content ...
Posted by Rodrigo Ruiz <rr...@gridsystems.com>.
The problem is the "/resources" entry. If you map it to the default
servlet, the directory name itself will not be part of the path, but a
"root" for the actual one, so the default servlet will understand you
want to get the path following "resources", and it is "". I guess the
same will happen with the contents of the directory.
It seems that the default servlet cannot be configured to serve files
from an alternative directory.
You could try one of the following:
- Create your own servlet for "resources" requests. Perhaps you could
subclass DefaultServlet, or use it in any other way.
- Implement a Filter that redirects any request not to "resources" to
your own servlet, and let the default configuration to work for the
resources directory.
Samuel Le Berrigaud wrote:
> Thanks for your help,
>
> I'll do it another way I think and I'll probably come back on that
> problem later on.
>
> SaM
>
> Tim Funk wrote:
>
>> Then there is either
>> - a bug in tomcat
>> - a config error (most likely) but don't know what could be the culprit
>>
>> I never heard of this before. Seems quite odd.
>>
>> -Tim
>>
>> Samuel Le Berrigaud wrote:
>>
>>> Yes
>>>
>>> Tim Funk wrote:
>>>
>>>> [Need more coffee]
>>>>
>>>> Does that mean that http://myserver/context/resources is serving a
>>>> dir listing of the contents from http://myserver/context ?
>>>> (instead of /context/resources)
>>>>
>>>> -Tim
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Access static content ...
Posted by Samuel Le Berrigaud <le...@essi.fr>.
Thanks for your help,
I'll do it another way I think and I'll probably come back on that
problem later on.
SaM
Tim Funk wrote:
> Then there is either
> - a bug in tomcat
> - a config error (most likely) but don't know what could be the culprit
>
> I never heard of this before. Seems quite odd.
>
> -Tim
>
> Samuel Le Berrigaud wrote:
>
>> Yes
>>
>> Tim Funk wrote:
>>
>>> [Need more coffee]
>>>
>>> Does that mean that http://myserver/context/resources is serving a
>>> dir listing of the contents from http://myserver/context ?
>>> (instead of /context/resources)
>>>
>>> -Tim
>>
>
>
>
> ---------------------------------------------------------------------
> 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
Re: Access static content ...
Posted by Tim Funk <fu...@joedog.org>.
Then there is either
- a bug in tomcat
- a config error (most likely) but don't know what could be the culprit
I never heard of this before. Seems quite odd.
-Tim
Samuel Le Berrigaud wrote:
> Yes
>
> Tim Funk wrote:
>
>> [Need more coffee]
>>
>> Does that mean that http://myserver/context/resources is serving a dir
>> listing of the contents from http://myserver/context ?
>> (instead of /context/resources)
>>
>> -Tim
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Access static content ...
Posted by Samuel Le Berrigaud <le...@essi.fr>.
Yes
Tim Funk wrote:
> [Need more coffee]
>
> Does that mean that http://myserver/context/resources is serving a dir
> listing of the contents from http://myserver/context ?
> (instead of /context/resources)
>
> -Tim
>
> Samuel Le Berrigaud wrote:
>
>> Of course it is a directory but tomcat lists / which contains the
>> resources directory (in fact to list / I would only check
>> http://myserver/context)
>>
>> SaM
>>
>> Tim Funk wrote:
>>
>>> If http://myserver/context/resources is a directory, then that is
>>> the correct behavior on how things work.
>>>
>>> -Tim
>>>
>>> Samuel Le Berrigaud wrote:
>>>
>>>> Hi,
>>>>
>>>> I cannot change the code of my servlet since I use the Turbine
>>>> framework. So I tried your second solution which doesn't work
>>>> anymore. When I now want to access
>>>> http://myserver/context/resources, I have the "directory listing
>>>> for /" page ...
>>>>
>>>> Maybe anyone have an idea of what's hapening, or maybe should I
>>>> give up my idea ?!
>>>>
>>>> Thanks,
>>>>
>>>> SaM
>>>>
>>>> Tim Funk wrote:
>>>>
>>>>> Or you might be able to get away with this to in web.xml ...
>>>>> <servlet-mapping>
>>>>> <url>/resources</url>
>>>>> <servlet>default</servlet>
>>>>> </servlet-mapping>
>>>>> <servlet-mapping>
>>>>> <url>/resources/*</url>
>>>>> <servlet>default</servlet>
>>>>> </servlet-mapping>
>>>>>
>>>>> -Tim
>>>>>
>>>>> Tim Funk wrote:
>>>>>
>>>>>> No, but this *might* work. Place it in your servlet which maps to
>>>>>> /* ...
>>>>>> (assuming your extending javax.servlet.http.HttpServlet)
>>>>>>
>>>>>>
>>>>>> doGet(HttpServletRequest req, HttpServletResponse resp) {
>>>>>> if (req.getRequestURI().indexOf("/resources")>-1) {
>>>>>> //Use the default servlet to serve the static content
>>>>>>
>>>>>> getServletContext().getNamedDispatcher("default").forward(req,
>>>>>> resp);
>>>>>> return;
>>>>>> }
>>>>>>
>>>>>> //Normal logic
>>>>>> }
>>>>>>
>>>>>> -Tim
>>>>>>
>>>>>> Samuel Le Berrigaud wrote:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I want to map my servlet with /* url pattern except the
>>>>>>> /resources directory which contains static content that I want
>>>>>>> to acces directly. Is there any particular configuration that
>>>>>>> could allow me to do so, in my web.xml file or in the server.xml
>>>>>>> config file ?
>>>>>>>
>>>>>>> I want to do that on a Tomcat 4.1
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>>
>>>>>> 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
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Access static content ...
Posted by Tim Funk <fu...@joedog.org>.
[Need more coffee]
Does that mean that http://myserver/context/resources is serving a dir
listing of the contents from http://myserver/context ?
(instead of /context/resources)
-Tim
Samuel Le Berrigaud wrote:
> Of course it is a directory but tomcat lists / which contains the
> resources directory (in fact to list / I would only check
> http://myserver/context)
>
> SaM
>
> Tim Funk wrote:
>
>> If http://myserver/context/resources is a directory, then that is the
>> correct behavior on how things work.
>>
>> -Tim
>>
>> Samuel Le Berrigaud wrote:
>>
>>> Hi,
>>>
>>> I cannot change the code of my servlet since I use the Turbine
>>> framework. So I tried your second solution which doesn't work
>>> anymore. When I now want to access http://myserver/context/resources,
>>> I have the "directory listing for /" page ...
>>>
>>> Maybe anyone have an idea of what's hapening, or maybe should I give
>>> up my idea ?!
>>>
>>> Thanks,
>>>
>>> SaM
>>>
>>> Tim Funk wrote:
>>>
>>>> Or you might be able to get away with this to in web.xml ...
>>>> <servlet-mapping>
>>>> <url>/resources</url>
>>>> <servlet>default</servlet>
>>>> </servlet-mapping>
>>>> <servlet-mapping>
>>>> <url>/resources/*</url>
>>>> <servlet>default</servlet>
>>>> </servlet-mapping>
>>>>
>>>> -Tim
>>>>
>>>> Tim Funk wrote:
>>>>
>>>>> No, but this *might* work. Place it in your servlet which maps to
>>>>> /* ...
>>>>> (assuming your extending javax.servlet.http.HttpServlet)
>>>>>
>>>>>
>>>>> doGet(HttpServletRequest req, HttpServletResponse resp) {
>>>>> if (req.getRequestURI().indexOf("/resources")>-1) {
>>>>> //Use the default servlet to serve the static content
>>>>> getServletContext().getNamedDispatcher("default").forward(req,
>>>>> resp);
>>>>> return;
>>>>> }
>>>>>
>>>>> //Normal logic
>>>>> }
>>>>>
>>>>> -Tim
>>>>>
>>>>> Samuel Le Berrigaud wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I want to map my servlet with /* url pattern except the /resources
>>>>>> directory which contains static content that I want to acces
>>>>>> directly. Is there any particular configuration that could allow
>>>>>> me to do so, in my web.xml file or in the server.xml config file ?
>>>>>>
>>>>>> I want to do that on a Tomcat 4.1
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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
Re: Access static content ...
Posted by Samuel Le Berrigaud <le...@essi.fr>.
Of course it is a directory but tomcat lists / which contains the
resources directory (in fact to list / I would only check
http://myserver/context)
SaM
Tim Funk wrote:
> If http://myserver/context/resources is a directory, then that is the
> correct behavior on how things work.
>
> -Tim
>
> Samuel Le Berrigaud wrote:
>
>> Hi,
>>
>> I cannot change the code of my servlet since I use the Turbine
>> framework. So I tried your second solution which doesn't work
>> anymore. When I now want to access http://myserver/context/resources,
>> I have the "directory listing for /" page ...
>>
>> Maybe anyone have an idea of what's hapening, or maybe should I give
>> up my idea ?!
>>
>> Thanks,
>>
>> SaM
>>
>> Tim Funk wrote:
>>
>>> Or you might be able to get away with this to in web.xml ...
>>> <servlet-mapping>
>>> <url>/resources</url>
>>> <servlet>default</servlet>
>>> </servlet-mapping>
>>> <servlet-mapping>
>>> <url>/resources/*</url>
>>> <servlet>default</servlet>
>>> </servlet-mapping>
>>>
>>> -Tim
>>>
>>> Tim Funk wrote:
>>>
>>>> No, but this *might* work. Place it in your servlet which maps to
>>>> /* ...
>>>> (assuming your extending javax.servlet.http.HttpServlet)
>>>>
>>>>
>>>> doGet(HttpServletRequest req, HttpServletResponse resp) {
>>>> if (req.getRequestURI().indexOf("/resources")>-1) {
>>>> //Use the default servlet to serve the static content
>>>> getServletContext().getNamedDispatcher("default").forward(req,
>>>> resp);
>>>> return;
>>>> }
>>>>
>>>> //Normal logic
>>>> }
>>>>
>>>> -Tim
>>>>
>>>> Samuel Le Berrigaud wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I want to map my servlet with /* url pattern except the /resources
>>>>> directory which contains static content that I want to acces
>>>>> directly. Is there any particular configuration that could allow
>>>>> me to do so, in my web.xml file or in the server.xml config file ?
>>>>>
>>>>> I want to do that on a Tomcat 4.1
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Access static content ...
Posted by Tim Funk <fu...@joedog.org>.
If http://myserver/context/resources is a directory, then that is the correct
behavior on how things work.
-Tim
Samuel Le Berrigaud wrote:
> Hi,
>
> I cannot change the code of my servlet since I use the Turbine
> framework. So I tried your second solution which doesn't work anymore.
> When I now want to access http://myserver/context/resources, I have the
> "directory listing for /" page ...
>
> Maybe anyone have an idea of what's hapening, or maybe should I give up
> my idea ?!
>
> Thanks,
>
> SaM
>
> Tim Funk wrote:
>
>> Or you might be able to get away with this to in web.xml ...
>> <servlet-mapping>
>> <url>/resources</url>
>> <servlet>default</servlet>
>> </servlet-mapping>
>> <servlet-mapping>
>> <url>/resources/*</url>
>> <servlet>default</servlet>
>> </servlet-mapping>
>>
>> -Tim
>>
>> Tim Funk wrote:
>>
>>> No, but this *might* work. Place it in your servlet which maps to /* ...
>>> (assuming your extending javax.servlet.http.HttpServlet)
>>>
>>>
>>> doGet(HttpServletRequest req, HttpServletResponse resp) {
>>> if (req.getRequestURI().indexOf("/resources")>-1) {
>>> //Use the default servlet to serve the static content
>>> getServletContext().getNamedDispatcher("default").forward(req,
>>> resp);
>>> return;
>>> }
>>>
>>> //Normal logic
>>> }
>>>
>>> -Tim
>>>
>>> Samuel Le Berrigaud wrote:
>>>
>>>> Hi all,
>>>>
>>>> I want to map my servlet with /* url pattern except the /resources
>>>> directory which contains static content that I want to acces
>>>> directly. Is there any particular configuration that could allow me
>>>> to do so, in my web.xml file or in the server.xml config file ?
>>>>
>>>> I want to do that on a Tomcat 4.1
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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
Re: Access static content ...
Posted by Samuel Le Berrigaud <le...@essi.fr>.
Hi,
I cannot change the code of my servlet since I use the Turbine
framework. So I tried your second solution which doesn't work anymore.
When I now want to access http://myserver/context/resources, I have the
"directory listing for /" page ...
Maybe anyone have an idea of what's hapening, or maybe should I give up
my idea ?!
Thanks,
SaM
Tim Funk wrote:
> Or you might be able to get away with this to in web.xml ...
> <servlet-mapping>
> <url>/resources</url>
> <servlet>default</servlet>
> </servlet-mapping>
> <servlet-mapping>
> <url>/resources/*</url>
> <servlet>default</servlet>
> </servlet-mapping>
>
> -Tim
>
> Tim Funk wrote:
>
>> No, but this *might* work. Place it in your servlet which maps to /* ...
>> (assuming your extending javax.servlet.http.HttpServlet)
>>
>>
>> doGet(HttpServletRequest req, HttpServletResponse resp) {
>> if (req.getRequestURI().indexOf("/resources")>-1) {
>> //Use the default servlet to serve the static content
>> getServletContext().getNamedDispatcher("default").forward(req,
>> resp);
>> return;
>> }
>>
>> //Normal logic
>> }
>>
>> -Tim
>>
>> Samuel Le Berrigaud wrote:
>>
>>> Hi all,
>>>
>>> I want to map my servlet with /* url pattern except the /resources
>>> directory which contains static content that I want to acces
>>> directly. Is there any particular configuration that could allow me
>>> to do so, in my web.xml file or in the server.xml config file ?
>>>
>>> I want to do that on a Tomcat 4.1
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Access static content ...
Posted by Tim Funk <fu...@joedog.org>.
Or you might be able to get away with this to in web.xml ...
<servlet-mapping>
<url>/resources</url>
<servlet>default</servlet>
</servlet-mapping>
<servlet-mapping>
<url>/resources/*</url>
<servlet>default</servlet>
</servlet-mapping>
-Tim
Tim Funk wrote:
> No, but this *might* work. Place it in your servlet which maps to /* ...
> (assuming your extending javax.servlet.http.HttpServlet)
>
>
> doGet(HttpServletRequest req, HttpServletResponse resp) {
> if (req.getRequestURI().indexOf("/resources")>-1) {
> //Use the default servlet to serve the static content
> getServletContext().getNamedDispatcher("default").forward(req, resp);
> return;
> }
>
> //Normal logic
> }
>
> -Tim
>
> Samuel Le Berrigaud wrote:
>
>> Hi all,
>>
>> I want to map my servlet with /* url pattern except the /resources
>> directory which contains static content that I want to acces directly.
>> Is there any particular configuration that could allow me to do so, in
>> my web.xml file or in the server.xml config file ?
>>
>> I want to do that on a Tomcat 4.1
>>
>
>
> ---------------------------------------------------------------------
> 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
Re: Access static content ...
Posted by Tim Funk <fu...@joedog.org>.
No, but this *might* work. Place it in your servlet which maps to /* ...
(assuming your extending javax.servlet.http.HttpServlet)
doGet(HttpServletRequest req, HttpServletResponse resp) {
if (req.getRequestURI().indexOf("/resources")>-1) {
//Use the default servlet to serve the static content
getServletContext().getNamedDispatcher("default").forward(req, resp);
return;
}
//Normal logic
}
-Tim
Samuel Le Berrigaud wrote:
> Hi all,
>
> I want to map my servlet with /* url pattern except the /resources
> directory which contains static content that I want to acces directly.
> Is there any particular configuration that could allow me to do so, in
> my web.xml file or in the server.xml config file ?
>
> I want to do that on a Tomcat 4.1
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org