You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Leon Rosenberg <ro...@googlemail.com> on 2009/09/09 20:06:18 UTC
bypassing a servlet mapping to /*
Hi,
I have an ugly situation. I have to inject some code of mine into an
existing spring mvc webapp. The code is a filter which reacts on some
urls and forwards to a jsp for presentation. The application has a
spring dispatcher servlet foo which is mapped to /*.
My problem is following:
my filter grabs the request and does some stuff.
afterwards it forwards the request to the jsp page:
req.getRequestDispatcher(forward.getPath()).forward(req, res);
where forward.getPath returns the absolute path to the jsp on disk
(from the webroot):
/net/java/dev/moskito/webui/jsp/Producers.jsp
now the request is processed by the servlet engine and is grabed by
the spring dispatcher with an error:
no mapping for context/net/java/dev/moskito/webui/jsp/Producers.jsp
is there any way to prevent this, maybe by calling the jsp servlet
directly? I know it wouldn't be nice, but i need a solution quickly,
and it can be as dirty as mud.
thanx in advance
Leon
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: bypassing a servlet mapping to /*
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: André Warnier [mailto:aw@ice-sa.com]
> Subject: Re: bypassing a servlet mapping to /*
>
> Yep (from a dummie) : does that not indeed look like the dispatcher
> thingie you're using does not know how to map wildcards ?
Indeed it does. But my understanding of the dispatcher is that it should be using the mappings in web.xml, which certainly appear to cover the case of interest.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: bypassing a servlet mapping to /*
Posted by André Warnier <aw...@ice-sa.com>.
Leon Rosenberg wrote:
>
> and if i use mapping with asterisk (/net/java/dev/moskito/webui/jsp/*)
> , i see log errors from dispatcher servlet that it doesn't know how to
> map
> /net/java/dev/moskito/webui/jsp/Producer.jsp.
Yep (from a dummie) : does that not indeed look like the dispatcher
thingie you're using does not know how to map wildcards ?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: bypassing a servlet mapping to /*
Posted by Leon Rosenberg <ro...@googlemail.com>.
On Thu, Sep 10, 2009 at 2:56 PM, Caldarale, Charles R
<Ch...@unisys.com> wrote:
>> From: Leon Rosenberg [mailto:rosenberg.leon@googlemail.com]
>> Subject: Re: bypassing a servlet mapping to /*
>>
>> But If I add only the path:
>> <servlet-mapping>
>> <servlet-name>jsp</servlet-name>
>> <url-pattern>/net/java/dev/moskito/webui/jsp/*</url-pattern>
>> </servlet-mapping>
>>
>> it doesn't, and I don't understand why?
>> Shouldn't the most 'matching' mapping win?
>
> Yes.
>
> What are the actual URLs being used here?
the first request comes as
/mui/mskShowAllProducers and is mapped to a filter, which, after
performing some tasks, calls:
if (forward!=null){
req.getRequestDispatcher(forward.getPath()).forward(req, res);
}
forward.getPath() would be ->
"/net/java/dev/moskito/webui/jsp/Producer.jsp" - a string field.
and if i use mapping with asterisk (/net/java/dev/moskito/webui/jsp/*)
, i see log errors from dispatcher servlet that it doesn't know how to
map
/net/java/dev/moskito/webui/jsp/Producer.jsp.
if i use direct mapping "/net/java/dev/moskito/webui/jsp/Producer.jsp"
in the web.xml (namely define EACH jsp, EACH image and EACH other
item)
it works.
regards
Leon
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: bypassing a servlet mapping to /*
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Leon Rosenberg [mailto:rosenberg.leon@googlemail.com]
> Subject: Re: bypassing a servlet mapping to /*
>
> But If I add only the path:
> <servlet-mapping>
> <servlet-name>jsp</servlet-name>
> <url-pattern>/net/java/dev/moskito/webui/jsp/*</url-pattern>
> </servlet-mapping>
>
> it doesn't, and I don't understand why?
> Shouldn't the most 'matching' mapping win?
Yes.
What are the actual URLs being used here?
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: bypassing a servlet mapping to /*
Posted by Leon Rosenberg <ro...@googlemail.com>.
Thanx Chuck, Martin.
chucks solution came first, so I tried it first, and it worked, but
not the way i actually expected.
If I add ALL mappings to the web.xml -> it works:
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>/net/java/dev/moskito/webui/jsp/Producers.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>/net/java/dev/moskito/webui/jsp/ProducersXML.jsp</url-pattern>
</servlet-mapping>
...
But If I add only the path:
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>/net/java/dev/moskito/webui/jsp/*</url-pattern>
</servlet-mapping>
it doesn't, and I don't understand why?
Shouldn't the most 'matching' mapping win?
For /net/java/dev/moskito/webui/jsp/ProducersXML.jsp
Shouldn't
<url-pattern>/net/java/dev/moskito/webui/jsp/ProducersXML.jsp</url-pattern>
win over
<url-pattern>/*</url-pattern>
regards
Leon
On Wed, Sep 9, 2009 at 9:07 PM, Caldarale, Charles R
<Ch...@unisys.com> wrote:
>> From: Leon Rosenberg [mailto:rosenberg.leon@googlemail.com]
>> Subject: bypassing a servlet mapping to /*
>>
>> /net/java/dev/moskito/webui/jsp/Producers.jsp
>> now the request is processed by the servlet engine and is grabed by
>> the spring dispatcher with an error:
>
> You can always put the complete mapping for the .jsp entries of interest into WEB-INF/web.xml and direct it to Tomcat's JSP servlet; since the longest match wins, that will override the Spring mapping.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: bypassing a servlet mapping to /*
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Leon Rosenberg [mailto:rosenberg.leon@googlemail.com]
> Subject: bypassing a servlet mapping to /*
>
> /net/java/dev/moskito/webui/jsp/Producers.jsp
> now the request is processed by the servlet engine and is grabed by
> the spring dispatcher with an error:
You can always put the complete mapping for the .jsp entries of interest into WEB-INF/web.xml and direct it to Tomcat's JSP servlet; since the longest match wins, that will override the Spring mapping.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org