On 08/01/2010 14:55, Patrick Flaherty wrote:
Hello,

I'm trying to get filter mapping working in Windows Tomcat 6.0.20. I can
get it to work one way but not another.

I have 2 virtual hosts where filter mapping on one host is working (I
get a hit) and another host that does not work (no hits)

Here are the 2 virtual hosts as seen in Server.xml file :

Fails (no hits)
<Host name="ft.com" appBase="c:/FilterTest"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>


Works (I get hits)
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

</Host>

Here is my filter :

<filter>
<filter-name>FileAccessFilter</filter-name>
<filter-class>com.mcs.webapp.filter.FileAccessFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>FileAccessFilter</filter-name>
<url-pattern>/Proofs/*</url-pattern>
</filter-mapping>

If I type the following I get a hit (Using Second host from above) :
http://localhost/Proofs/1/calendar.png

If I type the following I DO NOT get a hit (Using First host from above) :
http://ft.com/Proofs/1/calendar.png

In both cases the png image is found and displayed in the browser.

My guest is it has something to do with the appBase where the one that
works is :
appBase="webapps"

and the one that fails is :
appBase="c:/FilterTest"

Yes, you are correct.

The "appBase" attribute sets the location where applications reside, it does not set the location of a specific application.

Unless your application is called ROOT.war (or is the exploded dir ROOT) and is placed inside "C:/FilterTest", you're not going to get any joy.


You're also likely to have trouble seeing requests on that Host, unless you are requesting "http://ft.com/Proofs/calendar.jpg"; - as you've set no aliases and the Host named "localhost" will pick up all other requests as it's probably set as the defaultHost in the Engine.

See the docs for more info about configuring virtual hosts and contexts.

 http://tomcat.apache.org/


p

Any help would be greatly appreciated.

Thanks


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

Reply via email to