You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Cha <er...@gmail.com> on 2011/04/01 17:19:57 UTC

url-pattern algorithm problem?

Hello,

We are using Tomcat 7.0.11 with the following servlet-mapping

<servlet-mapping>
<servlet-name>app</servlet-name>
<url-pattern>*.htm</url-pattern>
<url-pattern>/en/*</url-pattern
</servlet-mapping>

The problem we find if the incoming url is like 
"http://example.com/en/yp/list/cat/10/1", it will not matched to the 
'app' servlet.  Any ideas?  Could it be a problem in tomcat matching 
algorithm?

Regards,
Cha

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


Re: url-pattern algorithm problem?

Posted by Cha <er...@gmail.com>.
My bad, the app is deployed as 'ROOT' and I did read the url-pattern 
section in the section before posting the question.

Based on what I read, it should match to the 'app', but it is not in 
this case.

Cha.

On 04/01/2011 11:39 AM, Caldarale, Charles R wrote:
>> From: Cha [mailto:eric.cha.read@gmail.com]
>> Subject: url-pattern algorithm problem?
>> <url-pattern>*.htm</url-pattern>
>> <url-pattern>/en/*</url-pattern
>> The problem we find if the incoming url is like
>> "http://example.com/en/yp/list/cat/10/1", it will
>> not matched to the 'app' servlet.
> Likely correct behavior, since neither of your specified patterns match the incoming URL - if your webapp is deployed as "en".  The above pattern would only match the URL if your webapp is deployed as "ROOT" - but you didn't tell us.
>
>> Could it be a problem in tomcat matching algorithm?
> Read the servlet spec; the<url-pattern>  does *not* include the context (webapp) name.
>
>   - 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: url-pattern algorithm problem?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Cha [mailto:eric.cha.read@gmail.com] 
> Subject: url-pattern algorithm problem?

> <url-pattern>*.htm</url-pattern>
> <url-pattern>/en/*</url-pattern

> The problem we find if the incoming url is like 
> "http://example.com/en/yp/list/cat/10/1", it will
> not matched to the 'app' servlet.

Likely correct behavior, since neither of your specified patterns match the incoming URL - if your webapp is deployed as "en".  The above pattern would only match the URL if your webapp is deployed as "ROOT" - but you didn't tell us.

> Could it be a problem in tomcat matching algorithm?

Read the servlet spec; the <url-pattern> does *not* include the context (webapp) name.

 - 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: url-pattern algorithm problem?

Posted by Cha <er...@gmail.com>.
Below are all the url patterns that we have.

<servlet-mapping>
<servlet-name>app</servlet-name>
<url-pattern>*.htm</url-pattern>
<url-pattern>/en/*</url-pattern
<url-pattern>/zh_TW/*</url-pattern>
<url-pattern>/zh_CN/*</url-pattern>
</servlet-mapping>

Here is the url http://example.com/en/yp/list/cat/10/1 that doesn't work 
for the above patterns.  Like I said if I changed one of the above 
url-pattern to /en/yp/*, this url will work.

Cha

On 04/01/2011 02:27 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Cha,
>
> On 4/1/2011 12:20 PM, Cha wrote:
>> If I changing the pattern to /en/yp/* for that incoming url, it will
>> work but it doesn't conform to what the spec said though.
> Sounds like you have another conflicting<url-pattern>  somewhere in
> web.xml. Care to post the rest of your<url-patterns>?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk2WGQQACgkQ9CaO5/Lv0PD0vQCgla4EpCpakMOlA9Lc+2koaVoz
> XzAAniImcyk+/4ImQ7cmfTnx5P/HQHZb
> =bkJE
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


Re: url-pattern algorithm problem?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Cha,

On 4/1/2011 12:20 PM, Cha wrote:
> If I changing the pattern to /en/yp/* for that incoming url, it will
> work but it doesn't conform to what the spec said though.

Sounds like you have another conflicting <url-pattern> somewhere in
web.xml. Care to post the rest of your <url-patterns>?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2WGQQACgkQ9CaO5/Lv0PD0vQCgla4EpCpakMOlA9Lc+2koaVoz
XzAAniImcyk+/4ImQ7cmfTnx5P/HQHZb
=bkJE
-----END PGP SIGNATURE-----

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


Re: url-pattern algorithm problem?

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/4/1 Cha <er...@gmail.com>:
> '>' is a copy&paste error sorry.  Yes, I do have filters but there is not
> url rewrite at all.
>
> Turning on the debug on tomcat, it is return 404.
>
> If I changing the pattern to /en/yp/* for that incoming url, it will work
> but it doesn't conform to what the spec said though.

So, such patterns do work, but that specific one does not.

I guess it will be something trivial, like mapping two different
servlets to the same URL pattern.

If you want to debug it, look at
http://wiki.apache.org/tomcat/FAQ/Developing#Debugging
and place breakpoints in the
org.apache.tomcat.util.http.mapper.Mapper
class.

Best regards,
Konstantin Kolinko

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


Re: url-pattern algorithm problem?

Posted by Cha <er...@gmail.com>.
'>' is a copy&paste error sorry.  Yes, I do have filters but there is 
not url rewrite at all.

Turning on the debug on tomcat, it is return 404.

If I changing the pattern to /en/yp/* for that incoming url, it will 
work but it doesn't conform to what the spec said though.

Regards,
Cha.

On 04/01/2011 12:05 PM, Konstantin Kolinko wrote:
> 2011/4/1 Cha<er...@gmail.com>:
>> Hello,
>>
>> We are using Tomcat 7.0.11 with the following servlet-mapping
>>
>> <servlet-mapping>
>> <servlet-name>app</servlet-name>
>> <url-pattern>*.htm</url-pattern>
>> <url-pattern>/en/*</url-pattern
> Missing '>'.
>
> Do you have a Filter that catches such requests and rewrites the URL?
> If you do, then the request will never reach the servlet.
>
>> </servlet-mapping>
>>
>> The problem we find if the incoming url is like
>> "http://example.com/en/yp/list/cat/10/1", it will not matched to the 'app'
>> servlet.  Any ideas?  Could it be a problem in tomcat matching algorithm?
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> 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: url-pattern algorithm problem?

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/4/1 Cha <er...@gmail.com>:
> Hello,
>
> We are using Tomcat 7.0.11 with the following servlet-mapping
>
> <servlet-mapping>
> <servlet-name>app</servlet-name>
> <url-pattern>*.htm</url-pattern>
> <url-pattern>/en/*</url-pattern

Missing '>'.

Do you have a Filter that catches such requests and rewrites the URL?
If you do, then the request will never reach the servlet.

> </servlet-mapping>
>
> The problem we find if the incoming url is like
> "http://example.com/en/yp/list/cat/10/1", it will not matched to the 'app'
> servlet.  Any ideas?  Could it be a problem in tomcat matching algorithm?

Best regards,
Konstantin Kolinko

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