tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Flaherty <pflah...@rampageinc.com>
Subject Re: Tomcat Filter Mapping Issue
Date Sun, 10 Jan 2010 17:55:25 GMT

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


Mime
View raw message