tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Stewart <>
Subject Re: web.xml servlet mappings, url pattern and CGI.PATH_INFO (tomcat 4.1.31)
Date Tue, 04 Jan 2005 12:45:16 GMT
I don't know anything about ColdFusion, but if I understand you right, you're wanting to tack
extra information onto a url beyond the file name and retrieve it somewhere for use, like

Then the page is actually index.cfm, and when it is run it will be able to see the "someParam".
Is this correct? If so, my first thought is a query string. Can you use one instead of the

Next, here's why what you're trying to do with the url-pattern won't work. The '*' in a url-pattern
isn't actually a normal wildcard. There are only a couple of specific ways it can be used:
1) /* or /something/* or /.../* - This is path mapping. When a request is made, the longest
matching pattern is used.
2) *.something - This is extension mapping. Anything with the extension you specify will be

(For full rules on url-pattern matching, see the Servlet spec, chapter 11.)

I suppose you could map a pattern like /cfm/* to your own servlet, which would extract the
file name from the path and request it from the cfm servlet and also do something with your
extra information.

This early in the morning, I can't think of a good way to do what you want easily.

-----Original Message-----
From: "Jack Eidsness"<>
To: "Tomcat Users List"<>
Date: Mon Jan 03 13:09:01 PST 2005
Subject: web.xml servlet mappings, url pattern and CGI.PATH_INFO (tomcat 4.1.31)

>I am new to the J2EE world, so hopefully I will not use terms incorrectly.
>Due to circumstances beyond my control, coldfusion has been retrofitted 
>into a J2EE web application and I have recently taken on the task of 
>trying to make previously existing cfm code work as part of a tomcat 
>installation.   I have found (so far) only one thing that doesn't work 
>like it used to, and its a significant problem for me.
>CGI apps can have a false path appended after the script name, which is 
>written into the CGI.PATH_INFO variable, so that it can be available to 
>scripts.  It would seem that tomcat is less flexible than apache httpd 
>about when this information will be supplied.  At least, jakarta-tomcat 
>4.1.31 doesn't want to play ball.  I have not yet experimented with 
>version 5.x.
>I have found a lot of discussion of this matter, but no conclusive 
>answer as to what the workaround is, nor, as i fear, that there is no 
>viable workaround.
>By default, my coldfusion war file came with this in the web.xml:
>       <servlet-mapping id="macromedia_mapping_3">
>          <servlet-name>CfmServlet</servlet-name>
>          <url-pattern>*.cfm</url-pattern>
>       </servlet-mapping>
>attempting to browse (via the coyote thingie) to
>will bring up the right page, but
>this gets me a 404.
>So far, I have only found one way to make tomcat give me the correct 
>If I do this:
>	<url-pattern>/htdocs/index.cfm/*</url-pattern>
>then I will be able to run the right script and CGI.PATH_INFO is set to 
>Naturally, if you have more than a couple situations where you use 
>PATH_INFO, this configuration becomes quickly unmanageable, and 
>unreasonable.  ("grep -iRl path_info ." will only get me so far)
>Is there a way to make this work without naming every cfm file that 
>might use PATH_INFO in the web.xml?
>For anyone interested in helping, here are some things that I have tried 
>that did not work (in each case, I have tried it as a replacement, 
>breaking the normal way it works for possible experimental value, or as 
>an additional servlet-mapping):
>If I do this:
>          <url-pattern>*.cfm/*</url-pattern>
>I get an error in the jakarta logs when the web.xml is read;
>java.lang.IllegalArgumentException: Invalid <url-pattern> *.cfm/* in 
>servlet mapping
>I looked up the source code and it says you can't start a servlet 
>mapping's url-pattern with "*." and have a "/" in the pattern at once. :/
>If I do this (nevermind that its not exactly what I want):
>	<url-pattern>*.cfm*</url-pattern>
>Then the second * is not expanded as a wildcard. i.e. a file named 
>"index.cfm*" (literal '*' character) could be processed as a cfm file.
>If I do this
>	<url-pattern>/*.cfm/*
>I get a 404.
>Thanks in advance for any time that any of you spend considering this issue,

GO get your free GO E-Mail account with expanded storage of 6 MB!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message