You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Patrick Flaherty <pf...@rampageinc.com> on 2010/01/08 15:55:06 UTC
Tomcat Filter Mapping Issue
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"
Any help would be greatly appreciated.
Thanks
Re: Tomcat Filter Mapping Issue
Posted by Hassan Schroeder <ha...@gmail.com>.
On Sun, Jan 10, 2010 at 10:45 AM, Patrick Flaherty
<pf...@rampageinc.com> wrote:
> I have not read that explicitly. I have looked online at various How-To's
Things that are not part of the "official" documentation have a very real
chance of being out-of-date, misleading, or just plain wrong.
Try this instead :-)
<http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html>
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat Filter Mapping Issue
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
> Subject: Re: Tomcat Filter Mapping Issue
>
> I have looked online at various How-To's and it's not clear to me
> this is the case.
The Internet is an excellent example of Sturgeon's Law: 95% of everything is crud.
> I have 2 Tomcat reference books neither which mention this about Virtual Hosts.
Which means you should probably throw those books out.
The official Tomcat doc is *always* the FIRST place to look; books or Googling should only be used to fill in gaps in your understanding, and anything you find that contradicts the real Tomcat doc must be discarded.
> If you have a link that illustrates this I would appreciate you
> sharing it.
Hassan already provided you with the appropriate link.
- 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: Tomcat Filter Mapping Issue
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Patrick,
On 1/10/2010 1:45 PM, Patrick Flaherty wrote:
> I do not dispute you at all, don't get me wrong. It's even been proven
> in my testing that this is
> what made filter mapping work for me.
>
> If you have a link that illustrates this I would appreciate you sharing
> it. Then I can rest knowing
> this is how we should have been doing it from day one.
I think one of the things that is clouding the issue is Tomcat's
"desire" to automatically deploy anything that looks like it might be a
webapp. For instance, if you have a <Host> with appBase=c:\app1, where
c:\app1 looks like this:
WEB-INF/web.xml
Proofs/ [whatever]
...then what Tomcat does is treat WEB-INF as a web application and
deploys it under the /WEB-INF URL path (it's possible that Tomcat
explicitly checks for this insane configuration and avoids exposing
/META-INF, so this claim may not be entirely correct).
Tomcat will definitely deploy the "Proofs" directory under /Proofs.
Since c:\app1\Proofs does not have a WEB-INF/web.xml, it gets the
default deployment descriptor, which is basically just *.jsp maps to the
JSP Servlet and everything else will get served using the
DefaultServlet, which just serves files directly just like a standard
web server. In this situation, c:\app1 appears to work like a
traditional web server's "document root" for the <Host>.
Then, you added a filter mapping under C:\app1\WEB-INF\web.xml and it
didn't work: that's because /Proofs was a different web application and
the web.xml file you modified had nothing to do with the Proofs webapp
that Tomcat deployed for you.
Moving everything into c:\app1\ROOT mounts the whole shebang on /, which
is what you had expected all along.
As to your questions about multiple webapps and URL prefixes:
If you want to deploy several webapps, they must each have a separate
context and separate top-level URL mapping (like, app1 is on ROOT (or
"/"), app2 is under /app2, app3 is under /app3, etc.). There is no way
to deploy multiple webapps to a single context.
One solution would be to merge the webapps into a single webapp and
deploy it once, most likely as ROOT. Another possibility is to create a
ROOT webapp that gives the visitor a menu of options that allows them to
pick their webapp without having to remember the URL mapping (say "/app2").
Not only is this all explicitly defined in the Java Servlet
Specification, it's the only thing that makes any sense at all. If you
feel like you have a reasonable use case for deploying multiple webapps
into a single URL space, I'd love to hear it. I suspect that any
scenario you describe can be easily configured in a sane way... as long
as you are thinking about webapps and deployments correctly.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAktM3NgACgkQ9CaO5/Lv0PBKOgCgnF60uonFMrSodcp1zCrto1x4
G0oAoJlmWTcplSyTn5Sm5xS6fd8WVwcD
=wJde
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat Filter Mapping Issue
Posted by Patrick Flaherty <pf...@rampageinc.com>.
Hi Hassan,
I have not read that explicitly. I have looked online at various How-
To's and it's not clear to me this
is the case. I have 2 Tomcat reference books neither which mention
this about Virtual Hosts.
I will look some more.
I do not dispute you at all, don't get me wrong. It's even been
proven in my testing that this is
what made filter mapping work for me.
If you have a link that illustrates this I would appreciate you
sharing it. Then I can rest knowing
this is how we should have been doing it from day one.
Thanks once again.
-P
On Jan 10, 2010, at 1:23 PM, Hassan Schroeder wrote:
> On Sun, Jan 10, 2010 at 9:55 AM, Patrick Flaherty
> <pf...@rampageinc.com> wrote:
>
>> I set up three VIRTUAL HOSTS matching the names of the 3 PUBLIC
>> domain names
>> I have mapping to the IP address of the box.
>>
>> Like the following :
>>
>> Host name = "www.myapp1.com" appbase = "c:/app1"
>> Host name = "www.myapp2.com" appbase = "c:/app2"
>> Host name = "www.myapp3.com" appbase = "c:/app3"
>
> Have you *read* the virtual-hosting how-to?
>
>> The content of each appBase folder is all of our app files.
>> (classes, libs
>> WEB-INF/web.xml, Proofs folder) These folders (c:/app1, c:/app2,c:/
>> app3)
>> behave like
>> the web root of each of the domain names
>> (www.myapp1.com,www.myapp2.com,www.myapp3.com) accordingly.
>>
>> Is this Valid ?
>
> Not remotely. Your apps need to be in
>
> c:/app1/ROOT
> c:/app2/ROOT
> c:/app3/ROOT
>
> respectively. As the docs say.
>
> --
> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
> twitter: @hassan
>
> ---------------------------------------------------------------------
> 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: Tomcat Filter Mapping Issue
Posted by Hassan Schroeder <ha...@gmail.com>.
On Sun, Jan 10, 2010 at 9:55 AM, Patrick Flaherty
<pf...@rampageinc.com> wrote:
> I set up three VIRTUAL HOSTS matching the names of the 3 PUBLIC domain names
> I have mapping to the IP address of the box.
>
> Like the following :
>
> Host name = "www.myapp1.com" appbase = "c:/app1"
> Host name = "www.myapp2.com" appbase = "c:/app2"
> Host name = "www.myapp3.com" appbase = "c:/app3"
Have you *read* the virtual-hosting how-to?
> The content of each appBase folder is all of our app files. (classes, libs
> WEB-INF/web.xml, Proofs folder) These folders (c:/app1, c:/app2,c:/app3)
> behave like
> the web root of each of the domain names
> (www.myapp1.com,www.myapp2.com,www.myapp3.com) accordingly.
>
> Is this Valid ?
Not remotely. Your apps need to be in
c:/app1/ROOT
c:/app2/ROOT
c:/app3/ROOT
respectively. As the docs say.
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat Filter Mapping Issue
Posted by Patrick Flaherty <pf...@rampageinc.com>.
Charles,
Looking back you are correct. With all my confusion that clearly did
not register as I could plainly see it the host section of my server .xml.
You guys have a lot of patience with a guy like me and I shouldn't post
with such ignorance. I'm inheriting this project from the one who design
it. It clearly has flaws in it's config. I have to go back a spend some
time
on the Tomcat doc site and gain some expertise in Tomcat.
Thanks again for your patience.
-P
--------------------------------------------------
From: "Caldarale, Charles R" <Ch...@unisys.com>
Sent: Sunday, January 10, 2010 6:57 PM
To: "Tomcat Users List" <us...@tomcat.apache.org>
Subject: RE: Tomcat Filter Mapping Issue
>> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
>> Subject: Re: Tomcat Filter Mapping Issue
>>
>> To solve it, I simply removed the docBase="" from the <Host> ?
>
> Note that we mentioned an empty docBase was illegal quite some time ago.
>
> You should not have *any* <Context> elements in server.xml. Whatever
> you've been reading that suggested you do so is sadly out of date, or
> flat-out wrong. Again, use the real Tomcat doc, not 3rd-party
> scribblings.
>
>> it's ok not to have a docBase ?
>
> There is always a docBase; but when the <Context> elements are properly
> located, it's calculated automatically from the location of the webapp.
>
> For Tomcat versions starting with 5.0.x, the proper place to put your
> <Context> elements is in each app's META-INF/context.xml file. When doing
> so, the path and docBase attributes must be omitted. An alternate
> location for <Context> elements is in conf/Catalina/[host]/[appName].xml,
> and again the path attribute must be omitted. You *may* use the docBase
> attribute in this latter case, but only if the webapp is located outside
> of the <Host> appBase directory.
>
> Again, post your server.xml and we'll show you what to fix.
>
> - 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: Tomcat Filter Mapping Issue
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
> Subject: Re: Tomcat Filter Mapping Issue
>
> To solve it, I simply removed the docBase="" from the <Host> ?
Note that we mentioned an empty docBase was illegal quite some time ago.
You should not have *any* <Context> elements in server.xml. Whatever you've been reading that suggested you do so is sadly out of date, or flat-out wrong. Again, use the real Tomcat doc, not 3rd-party scribblings.
> it's ok not to have a docBase ?
There is always a docBase; but when the <Context> elements are properly located, it's calculated automatically from the location of the webapp.
For Tomcat versions starting with 5.0.x, the proper place to put your <Context> elements is in each app's META-INF/context.xml file. When doing so, the path and docBase attributes must be omitted. An alternate location for <Context> elements is in conf/Catalina/[host]/[appName].xml, and again the path attribute must be omitted. You *may* use the docBase attribute in this latter case, but only if the webapp is located outside of the <Host> appBase directory.
Again, post your server.xml and we'll show you what to fix.
- 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: Tomcat Filter Mapping Issue
Posted by Patrick Flaherty <pf...@rampageinc.com>.
Hi Mark,
Thanks, that was the problem ! The question is how I solved it and is it
safe.
To solve it, I simply removed the docBase="" from the <Host> ?
Upon investigating docBase, it where your .war file is located. I assume
because
my deployment does not involve a .war file that it's ok not to have a
docBase ?
Thanks
-P
--------------------------------------------------
From: "Mark Thomas" <ma...@apache.org>
Sent: Sunday, January 10, 2010 5:39 PM
To: "Tomcat Users List" <us...@tomcat.apache.org>
Subject: Re: Tomcat Filter Mapping Issue
> On 10/01/2010 22:28, Patrick Flaherty wrote:
>> Uncle !
>>
>> I just created a ROOT folder off of my appBase, cut and pasted all of
>> what was in my appbase
>> into the new ROOT folder. Restart Tomcat and I try and hit the app with
>> the hostname and I get
>> a 404 for /.
>> (If I add /ROOT to the appBase path and I can hit the app successfully.)
>>
>> I tried Tomcat v5.5 and v6.0 with the same result. I move all my files
>> from ROOT up one level
>> back into appBase , delete the ROOT folder, remove /ROOT from my appBase
>> and I can hit the
>> app successfully ? AHHHHH!!!!!!!!!!!!!!!
>>
>> Can anyone post a virtual host snippet from their server.xml ?
>
> http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html
>
>> I have to be missing something in my server.xml.
>
> Sounds like you have an invalid docBase="" floating around.
>
> Mark
>
>
>
> ---------------------------------------------------------------------
> 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: Tomcat Filter Mapping Issue
Posted by Mark Thomas <ma...@apache.org>.
On 10/01/2010 22:28, Patrick Flaherty wrote:
> Uncle !
>
> I just created a ROOT folder off of my appBase, cut and pasted all of
> what was in my appbase
> into the new ROOT folder. Restart Tomcat and I try and hit the app with
> the hostname and I get
> a 404 for /.
> (If I add /ROOT to the appBase path and I can hit the app successfully.)
>
> I tried Tomcat v5.5 and v6.0 with the same result. I move all my files
> from ROOT up one level
> back into appBase , delete the ROOT folder, remove /ROOT from my appBase
> and I can hit the
> app successfully ? AHHHHH!!!!!!!!!!!!!!!
>
> Can anyone post a virtual host snippet from their server.xml ?
http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html
> I have to be missing something in my server.xml.
Sounds like you have an invalid docBase="" floating around.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat Filter Mapping Issue
Posted by Mark Thomas <ma...@apache.org>.
On 10/01/2010 23:25, Caldarale, Charles R wrote:
>> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
>> Sent: 2010 January 10, Sunday 16:28
>> To: Tomcat Users List
>>
>> Can anyone post a virtual host snippet from their server.xml ?
>
> Better if you post your server.xml and the <Context> elements from your webapps (which should not be in server.xml).
For the sake of completeness, there is an exception to this
rule/guideline. If you set autoDeploy=false and deployOnStartup=false on
a host then you have to define your contexts in server.xml.
Defining contexts in server.xml is discouraged if you don't need to as
it means you have to restart Tomcat if you make a change.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat Filter Mapping Issue
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
> Sent: 2010 January 10, Sunday 16:28
> To: Tomcat Users List
>
> Can anyone post a virtual host snippet from their server.xml ?
Better if you post your server.xml and the <Context> elements from your webapps (which should not be in server.xml). Also verify that the access permissions on your revised directory setup allow Tomcat to read the webapp files.
- 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: Tomcat Filter Mapping Issue
Posted by Patrick Flaherty <pf...@rampageinc.com>.
Uncle !
I just created a ROOT folder off of my appBase, cut and pasted all of what
was in my appbase
into the new ROOT folder. Restart Tomcat and I try and hit the app with the
hostname and I get
a 404 for /.
(If I add /ROOT to the appBase path and I can hit the app successfully.)
I tried Tomcat v5.5 and v6.0 with the same result. I move all my files from
ROOT up one level
back into appBase , delete the ROOT folder, remove /ROOT from my appBase and
I can hit the
app successfully ? AHHHHH!!!!!!!!!!!!!!!
Can anyone post a virtual host snippet from their server.xml ?
I have to be missing something in my server.xml.
Thanks
-P
--------------------------------------------------
From: "Caldarale, Charles R" <Ch...@unisys.com>
Sent: Sunday, January 10, 2010 3:40 PM
To: "Tomcat Users List" <us...@tomcat.apache.org>
Subject: RE: Tomcat Filter Mapping Issue
>> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
>> Subject: Re: Tomcat Filter Mapping Issue
>>
>> If I have 3 apps for a given <Host> then off my appBase I
>> would have :
>>
>> /ROOT (a must default for each <Host>)
>> /app2
>> /app3
>>
>> To access these apps, the URL's for the apps would be :
>>
>> http://www.my-three-apps.com (This for the ROOT app)
>> http://www.my-three-apps.com/app2 (This for the /app2 app)
>> http://www.my-three-apps.com/app3 (This for the /app3 app)
>
> The above is correct, but not quite complete. The default (ROOT) webapp
> will handle any URIs that don't match any of the explicitly-named apps,
> where the spec-defined rule is that the longest match wins. For example,
> if a user enters:
>
> http://www.my-three-apps.com/app4
>
> the request will be directed to the default (ROOT) app, since it doesn't
> match the known app2 or app3 patterns.
>
> - 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: Tomcat Filter Mapping Issue
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
> Subject: Re: Tomcat Filter Mapping Issue
>
> If I have 3 apps for a given <Host> then off my appBase I
> would have :
>
> /ROOT (a must default for each <Host>)
> /app2
> /app3
>
> To access these apps, the URL's for the apps would be :
>
> http://www.my-three-apps.com (This for the ROOT app)
> http://www.my-three-apps.com/app2 (This for the /app2 app)
> http://www.my-three-apps.com/app3 (This for the /app3 app)
The above is correct, but not quite complete. The default (ROOT) webapp will handle any URIs that don't match any of the explicitly-named apps, where the spec-defined rule is that the longest match wins. For example, if a user enters:
http://www.my-three-apps.com/app4
the request will be directed to the default (ROOT) app, since it doesn't match the known app2 or app3 patterns.
- 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: Tomcat Filter Mapping Issue
Posted by Patrick Flaherty <pf...@rampageinc.com>.
On Jan 10, 2010, at 1:53 PM, Caldarale, Charles R wrote:
>> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
>> Subject: Re: Tomcat Filter Mapping Issue
>>
>> I don't touch that app, I leave it alone and it remains the
>> machine's ROOT APP.
>
> No, it is that particular <Host>'s ROOT app; not the machine's.
> Every <Host> must have a ROOT app, and most likely not the ROOT app
> that ships with Tomcat's localhost <Host>.
>
>> If running three apps on one host , how do you get to those apps.
>
> If by "host", you mean a <Host> entry in server.xml, the apps will
> have different names under the appBase directory of that <Host>.
> One should be named ROOT, the others can be whatever you want your
> users to refer to them as.
>
>> Example one is a Single Host domain name called www.myapp.com.
>>
>> To get to app1, I would type http://www.myapp.com/app1
>> To get to app2, I would type http://www.myapp.com/app2
>> To get to app3, I would type http://www.myapp.com/app3
>
> Correct. You also need a ROOT app to handle URIs for www.myapp.com
> that don't reference app1, app2, or app3.
>
>> I don't like to have our customers having to add /app1 or /app2 or
>> /app3 to the end of SINGLE URL (domain name) to get to a
>> particular app.
>
> Don't confuse URL with domain name; the domain name is only a part
> of a URL. The users are going to need to differentiate the apps by
> some means, and the part after the domain name is as good as any.
>
>> But I'm pretty sure this is VALID and SHOULD work but the additional
>> leg appended to the URL to get to a particular app is awful to me.
>
> How do you suggest the users specify which app they want to
> access? Your misgivings are unfounded.
>
>> Host name = "www.myapp1.com" appbase = "c:/app1"
>> Host name = "www.myapp2.com" appbase = "c:/app2"
>> Host name = "www.myapp3.com" appbase = "c:/app3"
>
> O.k. so far, but it does give the (sometimes desirable) impression
> that there are three different servers.
>
>> The content of each appBase folder is all of our app files.
>
> That's where you're not getting it. The app files must go under C:/
> appx/ROOT, not directly under the appBase.
>
>> These folders (c:/app1, c:/app2, c:/app3) behave like the web
>> root of each of the domain names (www.myapp1.com, www.myapp2.com,
>> www.myapp3.com) accordingly.
>
> Wrong. The appBase is just the location of *all* webapps for the
> <Host>. The default webapp for the <Host> MUST be placed in a
> directory named ROOT (case sensitive) UNDER the appBase directory.
> Other webapps for the <Host> - if any - go into other directories
> under that <Host>'s appBase.
Ahh !!!! That makes sense Finally ! The appBase is just a location
for ALL webapps for a given <Host>. Therefore every <Host> MUST have
at least a ROOT app which MAY be the only app
for that <Host>. GOT IT ! One final question on your final
statement. If I have 3 apps for a given <Host> then off my appBase I
would have :
/ROOT (a must default for each <Host>)
/app2
/app3
To access these apps, the URL's for the apps would be :
http://www.my-three-apps.com (This for the ROOT app)
http://www.my-three-apps.com/app2 (This for the /app2 app)
http://www.my-three-apps.com/app3 (This for the /app3 app)
If this is correct I finally got it.
Thanks Hassan for the link, my books are outdated and are being tossed.
Thank you Chuck, I hope my last reply is correct. (We were not
deployed this way for years yet it did worked, which is what I got
caught up on.
Thanks to all again.
-P
>
>> If this is NOT valid please give an example of deploying three app
>> from one machine.
>
> We already did, several times, as does the doc page Hassan pointed to.
>
>> By the way this configuration is where FIlter Mapping was NOT
>> working.
>
> Completely understandable, since it's an invalid configuration.
>
>> I did change my FILTER MAPPING PATTERN in my web.xml to be
>> /ROOT/Proofs/* and then I started to get my FILTER MAPPING HITS.
>
> No, the webapp name (ROOT in this case) must not be part of the
> filter mapping.
>
>> Actually now I have found that I can leave my app in c:/app1 and just
>> make the changes noted above (add ROOT/Proofs to my appBase path and
>> change my FILTER MAPPING PATTERN in my web.xml to be /ROOT/Proofs/*
>> and then I started to get my FILTER MAPPING HITS.)
>
> More dumb luck, depending on the behavior of this particular
> version of Tomcat when presented with a broken, invalid
> configuration. Just do it the right way.
>
>> There is something magic about adding the folder ROOT and having it
>> end up in the URL's being passed back and forth for ME to start
>> getting FILTER MAPPING HITS.
>
> It's not magic, it's defined behavior; ROOT is the default webapp
> for the <Host>.
>
>> Do you still have the same thought after what I covered above ?
>
> Yes, you're still refusing to do things in the proper, documented way.
>
> - 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: Tomcat Filter Mapping Issue
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
> Subject: Re: Tomcat Filter Mapping Issue
>
> I don't touch that app, I leave it alone and it remains the
> machine's ROOT APP.
No, it is that particular <Host>'s ROOT app; not the machine's. Every <Host> must have a ROOT app, and most likely not the ROOT app that ships with Tomcat's localhost <Host>.
> If running three apps on one host , how do you get to those apps.
If by "host", you mean a <Host> entry in server.xml, the apps will have different names under the appBase directory of that <Host>. One should be named ROOT, the others can be whatever you want your users to refer to them as.
> Example one is a Single Host domain name called www.myapp.com.
>
> To get to app1, I would type http://www.myapp.com/app1
> To get to app2, I would type http://www.myapp.com/app2
> To get to app3, I would type http://www.myapp.com/app3
Correct. You also need a ROOT app to handle URIs for www.myapp.com that don't reference app1, app2, or app3.
> I don't like to have our customers having to add /app1 or /app2 or
> /app3 to the end of SINGLE URL (domain name) to get to a particular app.
Don't confuse URL with domain name; the domain name is only a part of a URL. The users are going to need to differentiate the apps by some means, and the part after the domain name is as good as any.
> But I'm pretty sure this is VALID and SHOULD work but the additional
> leg appended to the URL to get to a particular app is awful to me.
How do you suggest the users specify which app they want to access? Your misgivings are unfounded.
> Host name = "www.myapp1.com" appbase = "c:/app1"
> Host name = "www.myapp2.com" appbase = "c:/app2"
> Host name = "www.myapp3.com" appbase = "c:/app3"
O.k. so far, but it does give the (sometimes desirable) impression that there are three different servers.
> The content of each appBase folder is all of our app files.
That's where you're not getting it. The app files must go under C:/appx/ROOT, not directly under the appBase.
> These folders (c:/app1, c:/app2, c:/app3) behave like the web
> root of each of the domain names (www.myapp1.com, www.myapp2.com,
> www.myapp3.com) accordingly.
Wrong. The appBase is just the location of *all* webapps for the <Host>. The default webapp for the <Host> MUST be placed in a directory named ROOT (case sensitive) UNDER the appBase directory. Other webapps for the <Host> - if any - go into other directories under that <Host>'s appBase.
> If this is NOT valid please give an example of deploying three app
> from one machine.
We already did, several times, as does the doc page Hassan pointed to.
> By the way this configuration is where FIlter Mapping was NOT working.
Completely understandable, since it's an invalid configuration.
> I did change my FILTER MAPPING PATTERN in my web.xml to be
> /ROOT/Proofs/* and then I started to get my FILTER MAPPING HITS.
No, the webapp name (ROOT in this case) must not be part of the filter mapping.
> Actually now I have found that I can leave my app in c:/app1 and just
> make the changes noted above (add ROOT/Proofs to my appBase path and
> change my FILTER MAPPING PATTERN in my web.xml to be /ROOT/Proofs/*
> and then I started to get my FILTER MAPPING HITS.)
More dumb luck, depending on the behavior of this particular version of Tomcat when presented with a broken, invalid configuration. Just do it the right way.
> There is something magic about adding the folder ROOT and having it
> end up in the URL's being passed back and forth for ME to start
> getting FILTER MAPPING HITS.
It's not magic, it's defined behavior; ROOT is the default webapp for the <Host>.
> Do you still have the same thought after what I covered above ?
Yes, you're still refusing to do things in the proper, documented way.
- 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: Tomcat Filter Mapping Issue
Posted by Patrick Flaherty <pf...@rampageinc.com>.
On Jan 10, 2010, at 12:25 AM, Caldarale, Charles R wrote:
>> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
>> Subject: Re: Tomcat Filter Mapping Issue
>>
>> Meaning every host should have a ROOT app regardless of whether
>> you are
>> hosting ONE or MORE apps on a host !
>
> Correct.
Good !
>
>> That is what I had. I had the ROOT app off the webapps folder of a
>> default Tomcat install.
>
> No, that ROOT app applied only to the default <Host> - no others.
> Each <Host> has an entirely separate and independent set of webapps.
When I say a ROOT app it is THE ROOT app that Tomcat installs,
nothing to do with my app. It's content is the default Tomcat home
page with
"Administration", "Documentation". "Tomcat Online"," and
"Miscellaneous" on the left side of the page. So right after a fresh
install of Tomcat
this page is displayed when you type http://localhost. I don't touch
that app, I leave it alone and it remains the machine's ROOT APP.
>
>> We then created a virtual host (with a real domain name) where OUR
>> app responded to that domain name. (ie Host Name : www.myapp.com
>> appBase = c:/myapp)
>
> No, an app is not equivalent to a domain (<Host>) name. As stated
> previously by several of us, the ROOT app for the particular <Host>
> will handle any requests directed to the <Host> that do not map to
> any other apps *for that <Host>*. Again, each <Host> is completely
> independent of the others.
If running three apps on one host , how do you get to those apps.
Correct me if I am wrong :
Example one is a Single Host domain name called www.myapp.com.
To get to app1, I would type http://www.myapp.com/app1
To get to app2, I would type http://www.myapp.com/app2
To get to app3, I would type http://www.myapp.com/app3
Is this correct ? If it is, (Which I think it is and will work) then
I don't like to have our customers having to add /app1 or /app2 or /
app3 to the end of SINGLE URL (domain name) to get to a particular app.
But I'm pretty sure this is VALID and SHOULD work but the additional
leg appended to the URL to get to a particular app is awful to me.
Example two is one machine with one public IP address and three
domain names mapping to that one IP address.
The three domain names are www.myapp1.com, www.myapp2.com, and
finally www.myapp3.com, all mapping to one public IP address.
I set up three VIRTUAL HOSTS matching the names of the 3 PUBLIC
domain names I have mapping to the IP address of the box.
Like the following :
Host name = "www.myapp1.com" appbase = "c:/app1"
Host name = "www.myapp2.com" appbase = "c:/app2"
Host name = "www.myapp3.com" appbase = "c:/app3"
The content of each appBase folder is all of our app files. (classes,
libs WEB-INF/web.xml, Proofs folder) These folders (c:/app1, c:/
app2,c:/app3) behave like
the web root of each of the domain names
(www.myapp1.com,www.myapp2.com,www.myapp3.com) accordingly.
Is this Valid ? I hope so because this is how we have been deploying
multiple apps on a single box and it has been working. Is this just
dumb luck ? Maybe !
If this is NOT valid please give an example of deploying three app
from one machine. By the way this configuration is where FIlter
Mapping was NOT working.
FIlter mapping started to work when I added a ROOT folder to say the
first app. So now the following folder exists c:/app1/ROOT and this
is where I
put my infamous Proofs folder (c:/app1/ROOT/Proofs). I did change my
FILTER MAPPING PATTERN in my web.xml to be /ROOT/Proofs/* and then I
started
to get my FILTER MAPPING HITS.
I would NOT gets hits when my infamous Proofs folder was located in
c:/app1/Proofs and the FILTER MAPPING PATTERN in my web.xml was /
Proofs/*
Which is where this all started.
I apologize for and confusion I may have caused anyone while I'm
trying to get my arm around this by trying and retrying things. Your
help and insight
is greatly appreciated.
>
>> Everything in this config has worked for a couple years. The infamous
>> Proofs folder was located in c:/myapp/Proofs which I assume c:/myapp
>> to be the "web root" for this www.myapp.com host.
>
> Whatever you had working appears to have been dumb luck, and
> dependent on undefined behavior of having an empty docBase (which
> is illegal).
Covered above I think.
>
>> After suggestions from the forum about moving the app (WEB_INF and
>> all) under a ROOT folder I added to c:/myapp folder which now
>> contains
>> everything for the app under it, viola, Filter Mapping started to
>> work !
>
> Because you were finally using a valid configuration.
Actually now I have found that I can leave my app in c:/app1 and just
make the changes noted above (add ROOT/Proofs to my appBase path and
change
my FILTER MAPPING PATTERN in my web.xml to be /ROOT/Proofs/* and then
I started to get my FILTER MAPPING HITS.)
There is something magic about adding the folder ROOT and having it
end up in the URL's being passed back and forth for ME to start
getting FILTER MAPPING HITS.
>
>> Do people have secondary app (after ROOT) setup like I described
>> above
>> running with filter mapping functioning ?
>
> Sure. The filter mapping goes into the WEB-INF/web.xml of the
> webapp, regardless of the webapp's name.
Hopefully covered above.
>
>> Seems like maybe a bug to me or a misconfiguration of some
>> sort on my part.
>
> Misconfiguration, and misunderstanding of the independence of
> <Host> elements along with the proper use of appBase and the
> derivation of each app's docBase.
Do you still have the same thought after what I covered above ? I'm
starting to think my head is made of wood because maybe I still don't
get it.
>
> - Chuck
Thanks Chuck and others in helping me try to understand this issue.
-P
>
>
> 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: Tomcat Filter Mapping Issue
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
> Subject: Re: Tomcat Filter Mapping Issue
>
> Meaning every host should have a ROOT app regardless of whether you are
> hosting ONE or MORE apps on a host !
Correct.
> That is what I had. I had the ROOT app off the webapps folder of a
> default Tomcat install.
No, that ROOT app applied only to the default <Host> - no others. Each <Host> has an entirely separate and independent set of webapps.
> We then created a virtual host (with a real domain name) where OUR
> app responded to that domain name. (ie Host Name : www.myapp.com
> appBase = c:/myapp)
No, an app is not equivalent to a domain (<Host>) name. As stated previously by several of us, the ROOT app for the particular <Host> will handle any requests directed to the <Host> that do not map to any other apps *for that <Host>*. Again, each <Host> is completely independent of the others.
> Everything in this config has worked for a couple years. The infamous
> Proofs folder was located in c:/myapp/Proofs which I assume c:/myapp
> to be the "web root" for this www.myapp.com host.
Whatever you had working appears to have been dumb luck, and dependent on undefined behavior of having an empty docBase (which is illegal).
> After suggestions from the forum about moving the app (WEB_INF and
> all) under a ROOT folder I added to c:/myapp folder which now contains
> everything for the app under it, viola, Filter Mapping started to work !
Because you were finally using a valid configuration.
> Do people have secondary app (after ROOT) setup like I described above
> running with filter mapping functioning ?
Sure. The filter mapping goes into the WEB-INF/web.xml of the webapp, regardless of the webapp's name.
> Seems like maybe a bug to me or a misconfiguration of some
> sort on my part.
Misconfiguration, and misunderstanding of the independence of <Host> elements along with the proper use of appBase and the derivation of each app's docBase.
- 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: Tomcat Filter Mapping Issue
Posted by Patrick Flaherty <pf...@rampageinc.com>.
--------------------------------------------------
From: "Konstantin Kolinko" <kn...@gmail.com>
Sent: Saturday, January 09, 2010 7:00 PM
To: "Tomcat Users List" <us...@tomcat.apache.org>
Subject: Re: Tomcat Filter Mapping Issue
> 2010/1/10 Patrick Flaherty <pf...@rampageinc.com>:
>> Chris,
>>
>> Although adding ROOT of my appBase fixed my Filter mapping issue, I'm
>> guessing that I need to
>> put every bit of my app (all classes, libs etc ....) into that ROOT
>> folder,
>> correct ?
>>
>> So then if I decide to deploy another app in a virtual host say for
>> instance
>> :
>>
>> Host Name : www.domain.com appBase=c:/app123
>>
>> If that has a folder called proofs that I want filter mapping hits on, do
>> I
>> created a ROOT folder off of my appBase (ie c:/app123/ROOT) and put
>> every bit of my app (all classes, libs etc ....) into that ROOT folder ?
>>
>> I'm sorry to belabor the point. I know that adding the ROOT folder fixed
>> my
>> initial problem but I not sure if that is because when only running 1
>> host
>> it
>> should be called ROOT or is it that every Host needs to have a ROOT
>> folder
>> off of it's appBase and everything should bit of the app should be put in
>> there.
>>
>> It seems the ROOT folder was the key here but before we wanted to add
>> filter
>> mapping app worked fine when appBase is what we deemed to be the web
>> root for the app. It has worked well like that for years.
>>
>> Is there a hard and fast rule about deployment that I'm missing ?
>> (Probably)
>> If there is. it seems to revolve around having a ROOT folder for each app
>> maybe ?
>>
>> Any more enlightenment would be appreciated.
>>
>> Thanks once again.
>>
>
> ROOT (in uppercase) is not a "folder", but a web application.
Yes, that is understood.
>
> It behaves like any other web application (You should remember, that
> web applications are independent of each other). The only difference
> is that it is mapped to the URL "/".
Your say the ROOT app is mapped to URL "/" then yes that is understood.
>
> Every host should have a ROOT application.
Meaning every host should have a ROOT app regardless of whether you are
hosting ONE or MORE apps on a host !
>
> Any requests that cannot be mapped to any other web application will
> be directed to this one, so that it can show its 404th error page or
> otherwise process it.
>
> (If there is no ROOT application deployed, such requests cannot be
> processed and will result in a zero-length empty response.)
>
>
> If you have two applications
> /mywebapp
> /ROOT
> then
> - any request to /myweapp/foo will be processed by mywebapp (and the
> ROOT one will not see it at all),
That is what I had. I had the ROOT app off the webapps folder of a default
Tomcat install.
We then created a virtual host (with a real domain name) where OUR app
responded to
that domain name. (ie Host Name : www.myapp.com appBase = c:/myapp)
Everything in this config has worked for a couple years. The infamous Proofs
folder was
located in c:/myapp/Proofs which I assume c:/myapp to be the "web root" for
this www.myapp.com host.
It seems to have always behaved as such.
Am I ok up to this point ? (maybe not ?)
Finally we decided a wanted to use Filter Mapping for added security. Filter
Mapping would not give us a hit
for an URL's of type http://www.myapp.com/Proofs/* (our filter map using
/Proofs/*).
After suggestions from the forum about moving the app (WEB_INF and all)
under a ROOT folder I added to c:/myapp
folder which now contains everything for the app under it, viola, Filter
Mapping started to work !
I don't know why this was the case but I went with it.
> - any request to /myweapp2/foo will be processed by ROOT (because
> there is no myweapp2 application to process it).
Do people have secondary app (after ROOT) setup like I described above
running with filter mapping functioning ?
Seems like maybe a bug to me or a misconfiguration of some sort on my part.
Thanks again Konstantin and other.
>
> 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: Tomcat Filter Mapping Issue
Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/1/10 Patrick Flaherty <pf...@rampageinc.com>:
> Chris,
>
> Although adding ROOT of my appBase fixed my Filter mapping issue, I'm
> guessing that I need to
> put every bit of my app (all classes, libs etc ....) into that ROOT folder,
> correct ?
>
> So then if I decide to deploy another app in a virtual host say for instance
> :
>
> Host Name : www.domain.com appBase=c:/app123
>
> If that has a folder called proofs that I want filter mapping hits on, do I
> created a ROOT folder off of my appBase (ie c:/app123/ROOT) and put
> every bit of my app (all classes, libs etc ....) into that ROOT folder ?
>
> I'm sorry to belabor the point. I know that adding the ROOT folder fixed my
> initial problem but I not sure if that is because when only running 1 host
> it
> should be called ROOT or is it that every Host needs to have a ROOT folder
> off of it's appBase and everything should bit of the app should be put in
> there.
>
> It seems the ROOT folder was the key here but before we wanted to add filter
> mapping app worked fine when appBase is what we deemed to be the web
> root for the app. It has worked well like that for years.
>
> Is there a hard and fast rule about deployment that I'm missing ? (Probably)
> If there is. it seems to revolve around having a ROOT folder for each app
> maybe ?
>
> Any more enlightenment would be appreciated.
>
> Thanks once again.
>
ROOT (in uppercase) is not a "folder", but a web application.
It behaves like any other web application (You should remember, that
web applications are independent of each other). The only difference
is that it is mapped to the URL "/".
Every host should have a ROOT application.
Any requests that cannot be mapped to any other web application will
be directed to this one, so that it can show its 404th error page or
otherwise process it.
(If there is no ROOT application deployed, such requests cannot be
processed and will result in a zero-length empty response.)
If you have two applications
/mywebapp
/ROOT
then
- any request to /myweapp/foo will be processed by mywebapp (and the
ROOT one will not see it at all),
- any request to /myweapp2/foo will be processed by ROOT (because
there is no myweapp2 application to process it).
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat Filter Mapping Issue
Posted by Patrick Flaherty <pf...@rampageinc.com>.
Chris,
Although adding ROOT of my appBase fixed my Filter mapping issue, I'm
guessing that I need to
put every bit of my app (all classes, libs etc ....) into that ROOT
folder, correct ?
So then if I decide to deploy another app in a virtual host say for
instance :
Host Name : www.domain.com appBase=c:/app123
If that has a folder called proofs that I want filter mapping hits
on, do I
created a ROOT folder off of my appBase (ie c:/app123/ROOT) and put
every bit of my app (all classes, libs etc ....) into that ROOT folder ?
I'm sorry to belabor the point. I know that adding the ROOT folder
fixed my
initial problem but I not sure if that is because when only running 1
host it
should be called ROOT or is it that every Host needs to have a ROOT
folder
off of it's appBase and everything should bit of the app should be
put in there.
It seems the ROOT folder was the key here but before we wanted to add
filter
mapping app worked fine when appBase is what we deemed to be the web
root for the app. It has worked well like that for years.
Is there a hard and fast rule about deployment that I'm missing ?
(Probably)
If there is. it seems to revolve around having a ROOT folder for each
app maybe ?
Any more enlightenment would be appreciated.
Thanks once again.
-P
On Jan 9, 2010, at 3:28 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Patrick,
>
> On 1/8/2010 6:17 PM, Patrick Flaherty wrote:
>> Thanks a lot. I added a ROOT folder off my appBase and cut and pasted
>> everything under that ROOT folder
>> and now I am getting filter mapping hits with my ft.com ! We are not
>> deploying correctly and this sheds all the
>> light on that fact.
>
> Proper deployment is always a good idea. Then, everything works
> properly :)
>
>> Curiously I was not able to get to ft.com/WEB-INF/web.xml , I got
>> a 404.
>> But I am able to get to other files off the root as expected.
>> Maybe Tomcat has it's own filter mapping for /WEB-INF/web.xml ? I
>> could
>> not get to any file in /META-INF/* either ?
>
> If you deployed correctly under webapps/ROOT, then the WEB-INF folder
> and its contents should be protected by the DefaultServlet and should
> return a 404: this is expected behavior.
>
> If you have webapps/WEB-INF/web.xml, then I'd expect you to be able to
> successfully request /WEB-INF/web.xml because /WEB-INF looks like a
> context to Tomcat. It's possible that Tomcat actively protects
> [appBase]/WEB-INF similar to protecting a real webapp's WEB-INF
> directory, but it is not required to do so.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAktI5vQACgkQ9CaO5/Lv0PBI+wCgkJrpG5w21CEZjYSYDCV6eTJq
> R6MAmQEO8EWXkoWm2aOjKS+ZZ8e0UqFI
> =HDIu
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Tomcat Filter Mapping Issue
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Patrick,
On 1/8/2010 6:17 PM, Patrick Flaherty wrote:
> Thanks a lot. I added a ROOT folder off my appBase and cut and pasted
> everything under that ROOT folder
> and now I am getting filter mapping hits with my ft.com ! We are not
> deploying correctly and this sheds all the
> light on that fact.
Proper deployment is always a good idea. Then, everything works properly :)
> Curiously I was not able to get to ft.com/WEB-INF/web.xml , I got a 404.
> But I am able to get to other files off the root as expected.
> Maybe Tomcat has it's own filter mapping for /WEB-INF/web.xml ? I could
> not get to any file in /META-INF/* either ?
If you deployed correctly under webapps/ROOT, then the WEB-INF folder
and its contents should be protected by the DefaultServlet and should
return a 404: this is expected behavior.
If you have webapps/WEB-INF/web.xml, then I'd expect you to be able to
successfully request /WEB-INF/web.xml because /WEB-INF looks like a
context to Tomcat. It's possible that Tomcat actively protects
[appBase]/WEB-INF similar to protecting a real webapp's WEB-INF
directory, but it is not required to do so.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAktI5vQACgkQ9CaO5/Lv0PBI+wCgkJrpG5w21CEZjYSYDCV6eTJq
R6MAmQEO8EWXkoWm2aOjKS+ZZ8e0UqFI
=HDIu
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat Filter Mapping Issue
Posted by Pid <pi...@pidster.com>.
On 08/01/2010 23:17, Patrick Flaherty wrote:
> Christopher and Charles.
>
> Thanks a lot. I added a ROOT folder off my appBase and cut and pasted
> everything under that ROOT folder
> and now I am getting filter mapping hits with my ft.com ! We are not
> deploying correctly and this sheds all the
> light on that fact.
>
> Curiously I was not able to get to ft.com/WEB-INF/web.xml , I got a 404.
> But I am able to get to other files off the root as expected.
> Maybe Tomcat has it's own filter mapping for /WEB-INF/web.xml ? I could
> not get to any file in /META-INF/* either ?
It's not unexpected. The contents of those two directories are
protected from external view quite deliberately.
p
> Anyway, thanks again for your patience and help.
>
> -P
>
>
> On Jan 8, 2010, at 4:06 PM, Christopher Schultz wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Patrick,
>>
>> On 1/8/2010 3:49 PM, Patrick Flaherty wrote:
>>> If I use a host name of ft.com with a appBase of c:/FilterTest then
>>> doesn't c:/FilterTest become my web server root for ft.com?
>>
>> As Chuck points out, no: C:\FilterTest\ROOT is the "server root" for
>> ft.com. Remember, Tomcat isn't a web server: it's an app server.
>>
>>> Is seems to work that way for us although it may not be the correct way
>>> to deploy a web app.
>>
>> I suspect what's happening is that you have a layout like this:
>>
>> C:\FilterTest
>> C:\FilterTest\WEB-INF
>> C:\FilterTest\WEB-INF\web.xml
>> C:\FilterTest\Proofs
>> C:\FilterTest\Proofs\[content]
>>
>> Tomcat, seeing that a directory called \Proofs exists, is deploying it
>> as it's own web application, and the DefaultServlet is serving all your
>> content correctly. Since /Proofs doesn't have a WEB-INF/web.xml file,
>> your filter is not being created and it's not being called.
>>
>> I'll bet that you can also request this file:
>>
>> http://ft.com/WEB-INF/web.xml
>>
>> Here, Tomcat will serve this file that might be expected to be protected
>> because /WEB-INF looks like a (poorly-named) web application and not a
>> proper deployment descriptor directory in a proper web app.
>>
>>> If you deploy an app off of %CATALINAHOME% then doesn't the user have to
>>> type http://my.domainname.com/myapp ?
>>> I want it to hit my app when I type http://my.domainname.com. That is
>>> how it works with our product today.
>>
>> You need to fix your deployments, or nothing is going to make sense. If
>> you want your webapp to be deployed without a leading path (i.e. on /
>> instead of /foo), then you need to name your webapp ROOT.war (or put it
>> in the ROOT subdirectory under your appBase directory).
>>
>>> It starting to sound like the complete URL has to be part of
>>> %CATALINAHOME%'s path to get a filter hit ?
>>
>> No, this is not true. If your webapp is properly deployed, your relative
>> URIs will be properly mapped and your filter will get called.
>>
>> - -chris
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.10 (MingW32)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>
>> iEYEARECAAYFAktHnmUACgkQ9CaO5/Lv0PCjzQCgvPHG6/1ZwJ0iyZrHj/coqoLW
>> R20AoJJ0RXVvIdMHJ+mofNRo92EvUu0e
>> =8MkQ
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> 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: Tomcat Filter Mapping Issue
Posted by Patrick Flaherty <pf...@rampageinc.com>.
Christopher and Charles.
Thanks a lot. I added a ROOT folder off my appBase and cut and pasted
everything under that ROOT folder
and now I am getting filter mapping hits with my ft.com ! We are not
deploying correctly and this sheds all the
light on that fact.
Curiously I was not able to get to ft.com/WEB-INF/web.xml , I got a
404. But I am able to get to other files off the root as expected.
Maybe Tomcat has it's own filter mapping for /WEB-INF/web.xml ? I
could not get to any file in /META-INF/* either ?
Anyway, thanks again for your patience and help.
-P
On Jan 8, 2010, at 4:06 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Patrick,
>
> On 1/8/2010 3:49 PM, Patrick Flaherty wrote:
>> If I use a host name of ft.com with a appBase of c:/FilterTest then
>> doesn't c:/FilterTest become my web server root for ft.com?
>
> As Chuck points out, no: C:\FilterTest\ROOT is the "server root" for
> ft.com. Remember, Tomcat isn't a web server: it's an app server.
>
>> Is seems to work that way for us although it may not be the
>> correct way
>> to deploy a web app.
>
> I suspect what's happening is that you have a layout like this:
>
> C:\FilterTest
> C:\FilterTest\WEB-INF
> C:\FilterTest\WEB-INF\web.xml
> C:\FilterTest\Proofs
> C:\FilterTest\Proofs\[content]
>
> Tomcat, seeing that a directory called \Proofs exists, is deploying it
> as it's own web application, and the DefaultServlet is serving all
> your
> content correctly. Since /Proofs doesn't have a WEB-INF/web.xml file,
> your filter is not being created and it's not being called.
>
> I'll bet that you can also request this file:
>
> http://ft.com/WEB-INF/web.xml
>
> Here, Tomcat will serve this file that might be expected to be
> protected
> because /WEB-INF looks like a (poorly-named) web application and not a
> proper deployment descriptor directory in a proper web app.
>
>> If you deploy an app off of %CATALINAHOME% then doesn't the user
>> have to
>> type http://my.domainname.com/myapp ?
>> I want it to hit my app when I type http://my.domainname.com. That is
>> how it works with our product today.
>
> You need to fix your deployments, or nothing is going to make
> sense. If
> you want your webapp to be deployed without a leading path (i.e. on /
> instead of /foo), then you need to name your webapp ROOT.war (or
> put it
> in the ROOT subdirectory under your appBase directory).
>
>> It starting to sound like the complete URL has to be part of
>> %CATALINAHOME%'s path to get a filter hit ?
>
> No, this is not true. If your webapp is properly deployed, your
> relative
> URIs will be properly mapped and your filter will get called.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAktHnmUACgkQ9CaO5/Lv0PCjzQCgvPHG6/1ZwJ0iyZrHj/coqoLW
> R20AoJJ0RXVvIdMHJ+mofNRo92EvUu0e
> =8MkQ
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Tomcat Filter Mapping Issue
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Patrick,
On 1/8/2010 3:49 PM, Patrick Flaherty wrote:
> If I use a host name of ft.com with a appBase of c:/FilterTest then
> doesn't c:/FilterTest become my web server root for ft.com?
As Chuck points out, no: C:\FilterTest\ROOT is the "server root" for
ft.com. Remember, Tomcat isn't a web server: it's an app server.
> Is seems to work that way for us although it may not be the correct way
> to deploy a web app.
I suspect what's happening is that you have a layout like this:
C:\FilterTest
C:\FilterTest\WEB-INF
C:\FilterTest\WEB-INF\web.xml
C:\FilterTest\Proofs
C:\FilterTest\Proofs\[content]
Tomcat, seeing that a directory called \Proofs exists, is deploying it
as it's own web application, and the DefaultServlet is serving all your
content correctly. Since /Proofs doesn't have a WEB-INF/web.xml file,
your filter is not being created and it's not being called.
I'll bet that you can also request this file:
http://ft.com/WEB-INF/web.xml
Here, Tomcat will serve this file that might be expected to be protected
because /WEB-INF looks like a (poorly-named) web application and not a
proper deployment descriptor directory in a proper web app.
> If you deploy an app off of %CATALINAHOME% then doesn't the user have to
> type http://my.domainname.com/myapp ?
> I want it to hit my app when I type http://my.domainname.com. That is
> how it works with our product today.
You need to fix your deployments, or nothing is going to make sense. If
you want your webapp to be deployed without a leading path (i.e. on /
instead of /foo), then you need to name your webapp ROOT.war (or put it
in the ROOT subdirectory under your appBase directory).
> It starting to sound like the complete URL has to be part of
> %CATALINAHOME%'s path to get a filter hit ?
No, this is not true. If your webapp is properly deployed, your relative
URIs will be properly mapped and your filter will get called.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAktHnmUACgkQ9CaO5/Lv0PCjzQCgvPHG6/1ZwJ0iyZrHj/coqoLW
R20AoJJ0RXVvIdMHJ+mofNRo92EvUu0e
=8MkQ
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat Filter Mapping Issue
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
> Subject: Re: Tomcat Filter Mapping Issue
>
> If I use a host name of ft.com with a appBase of c:/FilterTest then
> doesn't c:/FilterTest become my web server root for ft.com?
No. The default webapp is *always* named ROOT (case sensitive). As explained before, the appBase attribute points to the directory where the apps for the <Host> are to be placed.
> Is seems to work that way for us although it may not be the correct
> way to deploy a web app. The proofs folder is
> just that a folder off the (Our c:/FilterTest) web root and we are
> try to get a "filter mapping" hit when you type
> http://ft.com/Proofs/1/calendar.png.
Try moving everything down one level:
C:\FilterTest\
ROOT\
WEB-INF\
lib\
classes\
META-INF\
context.xml
Proofs\
1\
calendar.png
- 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: Tomcat Filter Mapping Issue
Posted by Patrick Flaherty <pf...@rampageinc.com>.
If I use a host name of ft.com with a appBase of c:/FilterTest then
doesn't c:/FilterTest become my web server root for ft.com?
Is seems to work that way for us although it may not be the correct
way to deploy a web app. The proofs folder is
just that a folder off the (Our c:/FilterTest) web root and we are
try to get a "filter mapping" hit when you type
http://ft.com/Proofs/1/calendar.png.
If you deploy an app off of %CATALINAHOME% then doesn't the user have
to type http://my.domainname.com/myapp ?
I want it to hit my app when I type http://my.domainname.com. That is
how it works with our product today.
It starting to sound like the complete URL has to be part of %
CATALINAHOME%'s path to get a filter hit ?
Thanks
On Jan 8, 2010, at 2:16 PM, Caldarale, Charles R wrote:
>> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
>> Subject: Re: Tomcat Filter Mapping Issue
>>
>> I could not get it to work using our shipping configuration
>> which is appBase pointing to a folder off the c:\ drive.
>
> That's because you don't seem to understand the function of
> appBase: it doesn't point to a single webapp, it points to a
> *directory* under which each of your webapps is installed. For
> example, the single <Host> in the default Tomcat config is
> $CATALINA_HOME/webapps, and under webapps, you'll find ROOT,
> manager, docs, examples, etc.
>
> You appear to have placed your webapp named Proofs under the
> default <Host>'s appBase, and everything works as expected. To use
> the webapp under the appBase of the ft.com <Host>, place the Proofs
> directory (or .war file) under the declared C:\FilterTest directory:
> C:\FilterTest\
> Proofs\
> WEB-INF\
> lib\
> classes\
> META-INF\
> context.xml
> etc.
>
>> <filter-mapping>
>> <filter-name>FileAccessFilter</filter-name>
>> <url-pattern>/Proofs/*</url-pattern>
>> </filter-mapping>
>
> The <url-pattern> must not include the context name; it should
> really be just /*.
>
> - 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: Tomcat Filter Mapping Issue
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Chuck,
On 1/8/2010 2:16 PM, Caldarale, Charles R wrote:
> You appear to have placed your webapp named Proofs under the default
> <Host>'s appBase, and everything works as expected.
Not quite, since a webapp called "Proofs" would require a filter-mapped
URL like /* to match his filter. Instead, his filter-mapping is for
/Proofs/*. If the webapp were deployed as /Proofs, then the URLs would
have to be http://localhost/Proofs/Proofs/1/calendar.png in order to match.
> To use the webapp
> under the appBase of the ft.com <Host>, place the Proofs directory (or
> .war file) under the declared C:\FilterTest directory:
>
> C:\FilterTest\
> Proofs\
> WEB-INF\
> lib\
> classes\
> META-INF\
> context.xml
> etc.
Given the above, I think Pid is right, and Patrick wants to use a
ROOT.war under C:\FilterTest
>> <filter-mapping>
>> <filter-name>FileAccessFilter</filter-name>
>> <url-pattern>/Proofs/*</url-pattern>
>> </filter-mapping>
>
> The <url-pattern> must not include the context name; it should really be just /*.
If the webapp is really called Proofs, then yes, the filter mapping
ought to be "/*".
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAktHlmkACgkQ9CaO5/Lv0PA70wCfYUW+sIcsKl+P5bEAijHtoVNW
hMMAn3aTtKzujVJK3+uIFYcS3jGr/YH4
=Ci87
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat Filter Mapping Issue
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Patrick Flaherty [mailto:pflahrty@rampageinc.com]
> Subject: Re: Tomcat Filter Mapping Issue
>
> I could not get it to work using our shipping configuration
> which is appBase pointing to a folder off the c:\ drive.
That's because you don't seem to understand the function of appBase: it doesn't point to a single webapp, it points to a *directory* under which each of your webapps is installed. For example, the single <Host> in the default Tomcat config is $CATALINA_HOME/webapps, and under webapps, you'll find ROOT, manager, docs, examples, etc.
You appear to have placed your webapp named Proofs under the default <Host>'s appBase, and everything works as expected. To use the webapp under the appBase of the ft.com <Host>, place the Proofs directory (or .war file) under the declared C:\FilterTest directory:
C:\FilterTest\
Proofs\
WEB-INF\
lib\
classes\
META-INF\
context.xml
etc.
> <filter-mapping>
> <filter-name>FileAccessFilter</filter-name>
> <url-pattern>/Proofs/*</url-pattern>
> </filter-mapping>
The <url-pattern> must not include the context name; it should really be just /*.
- 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: Tomcat Filter Mapping Issue
Posted by Patrick Flaherty <pf...@rampageinc.com>.
Hello,
Thanks for your response. I don't intend to run 2 apps (virtual
hosts) on the server, just one. I have 2 setup
on the same server so I could compare results from the different
setups. I could not get it to work using our
shipping configuration which is appBase pointing to a folder off the
c:\ drive. But I discovered it worked
setting up the app the traditional way.
We have an established customer where the appBase is not off of %
CATALINAHOME% but instead in a folder off the c:\ drive.
Therefore I'm trying to get the filter mapping to work with the
appBase set to a folder of the c:\ drive.
If I understand what you are saying, this will and cannot not work
with appBase set to a folder of the c:\ drive ?
Thanks for any clarification.
-P
On Jan 8, 2010, at 11:01 AM, Pid wrote:
> 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-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: Tomcat Filter Mapping Issue
Posted by Pid <pi...@pidster.com>.
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org