You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jack Eidsness <je...@above.net> on 2005/01/03 22:09:01 UTC

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
http://{server}/cfusion/htdocs/index.cfm
will bring up the right page, but
http://{server}/cfusion/htdocs/index.cfm/fake_path
this gets me a 404.

So far, I have only found one way to make tomcat give me the correct 
PATH_INFO -
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 
"/fake_path".

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,

Jack Eidsness

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


Re: web.xml servlet mappings, url pattern and CGI.PATH_INFO (tomcat 4.1.31)

Posted by Parsons Technical Services <pa...@earthlink.net>.
I am sure there is a better option out there but if no one else weighs in, 
here are a couple of thoughts.

As for the wild card I know there are several threads addressing the do and 
don't of this. Although I think you have figured them out through trial and 
error.

As for one way to approach this would be to map the appropriate files (any 
with data) to a servlet that could parse the file name and pass the request 
on to the appropriate file. As I am not familiar with cgi stuff, I may be 
missing something.

Doug

----- Original Message ----- 
From: "Jack Eidsness" <je...@above.net>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, January 03, 2005 4:09 PM
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
> http://{server}/cfusion/htdocs/index.cfm
> will bring up the right page, but
> http://{server}/cfusion/htdocs/index.cfm/fake_path
> this gets me a 404.
>
> So far, I have only found one way to make tomcat give me the correct 
> PATH_INFO -
> 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 
> "/fake_path".
>
> 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,
>
> Jack Eidsness
>
> ---------------------------------------------------------------------
> 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