You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jakub 1983 <jj...@gmail.com> on 2013/04/21 23:32:03 UTC

two responses from one request - how is it possible ?

http://www.mulesoft.com/tomcat-connector states:

Using the current arrangement, both Connectors will pass all requests to
the same Engine, which will in turn pass all these requests to both of its
contained web applications.  This means that each request will potentially
generate two responses, one from each application.
<Server>
  <Service>
    <Connector port="8443"/>
    <Connector port="8444"/>
    <Engine>
      <Host name="yourhostname">
        <Context path="/webapp1"/>
        <Context path="/webapp2"/>
      </Host>
    </Engine>
  </Service>
</Server>

Is it really true what they write ?

regards
Jakub

Re: two responses from one request - how is it possible ?

Posted by Mark Thomas <ma...@apache.org>.
On 22/04/2013 01:03, André Warnier wrote:
> Jakub 1983 wrote:
>> http://www.mulesoft.com/tomcat-connector states:
>>
>> Using the current arrangement, both Connectors will pass all requests to
>> the same Engine, which will in turn pass all these requests to both of
>> its
>> contained web applications.  This means that each request will
>> potentially
>> generate two responses, one from each application.
>> <Server>
>>   <Service>
>>     <Connector port="8443"/>
>>     <Connector port="8444"/>
>>     <Engine>
>>       <Host name="yourhostname">
>>         <Context path="/webapp1"/>
>>         <Context path="/webapp2"/>
>>       </Host>
>>     </Engine>
>>   </Service>
>> </Server>
>>
>> Is it really true what they write ?
>>
> 
> (For anyone else reading this, I did look at the indicated webpage, and
> it is really what they say there)
> 
> To me, it sounds like utter nonsense.

If I was going to be generous I might call it very badly worded but I
must confess that I was struggling to find a way to read that page in
such a way that it wasn't just very wrong.

> Or else, I need to revise my whole understanding of HTTP and Tomcat.

No need, you're fine.

> It even looks like nonsense squared, since :
> 
> - each request is sent by one client on one connection to one port
> (meaning one Tomcat Connector), and the (single) response to that
> request will also come back on that same connection
> - each request should have a target URL (like /webapp1 OR /webapp2, but
> not both), and will be processed (once) by the application (context)
> corresponding to that URL, and will generate only one response

Correct. This is the bit the author seems to be confused over.

> Maybe we should ask the author of that page for more details.  He may
> have invented the amplifier version of Tomcat.
> 
> Additionally, it is really bad practice to put <Context> elements in the
> server.xml file.

Generally, yes.

Also, they need to be careful with the Hosts' appBase attributes and/or
autoDeploy/deployOnStartUp attributes or they'll get both apps deployed
to both hosts still.

Mark


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


Re: two responses from one request - how is it possible ?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jeffrey,

On 4/23/13 11:24 AM, Jeffrey Janner wrote:
>> -----Original Message----- From: Christopher Schultz
>> [mailto:chris@christopherschultz.net] Sent: Monday, April 22,
>> 2013 4:31 PM To: Tomcat Users List Subject: Re: two responses
>> from one request - how is it possible ?
>> 
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>> 
>> Jeffrey,
>> 
>> On 4/22/13 4:18 PM, Jeffrey Janner wrote:
>>> 
>>> 
>>>> -----Original Message----- From: André Warnier
>>>> [mailto:aw@ice-
>> sa.com]
>>>> Sent: Sunday, April 21, 2013 7:03 PM To: Tomcat Users List
>>>> Subject: Re: two responses from one request - how is it
>>>> possible ?
>>>> 
>>>> Jakub 1983 wrote:
>>>>> http://www.mulesoft.com/tomcat-connector states:
>>>>> 
>>>>> Using the current arrangement, both Connectors will pass
>>>>> all requests to the same Engine, which will in turn pass
>>>>> all these requests to
>>>> both
>>>>> of its contained web applications.  This means that each
>>>>> request will potentially generate two responses, one from
>>>>> each application. <Server> <Service> <Connector
>>>>> port="8443"/> <Connector
>> port="8444"/>
>>>>> <Engine> <Host name="yourhostname"> <Context
>>>>> path="/webapp1"/> <Context path="/webapp2"/> </Host>
>>>>> </Engine> </Service> </Server>
>>>>> 
>>>>> Is it really true what they write ?
>>>>> 
>>>> 
>>>> (For anyone else reading this, I did look at the indicated
>>>> webpage, and it is really what they say there)
>>>> 
>>>> To me, it sounds like utter nonsense. Or else, I need to
>>>> revise my whole understamding of HTTP and Tomcat.
>>>> 
>>>> It even looks like nonsense squared, since :
>>>> 
>>>> - each request is sent by one client on one connection to one
>>>> port (meaning one Tomcat Connector), and the (single)
>>>> response to that request will also come back on that same
>>>> connection - each request should have a target URL (like
>>>> /webapp1 OR /webapp2, but not both), and will be processed
>>>> (once) by the application (context) corresponding to that
>>>> URL, and will generate only one response
>>>> 
>>>> Maybe we should ask the author of that page for more details.
>>>> He
>> may
>>>> have invented the amplifier version of Tomcat.
>>>> 
>>>> Additionally, it is really bad practice to put <Context>
>>>> elements in the server.xml file.
>>>> 
>>> 
>>>> From the article:
>>> " Using the current arrangement, both Connectors will pass all 
>>> requests to the same Engine, which will in turn pass all these 
>>> requests to both of its contained web applications.  This means
>>> that each request will potentially generate two responses, one
>>> from each application."
>>> 
>>> Well, after noting some of the bad grammar in the opening few 
>>> paragraphs (listen to vs. listen on), I was going to give the
>>> author
>> a
>>> pass on the use of "both" in the first sentence, instead of
>>> "either" or "one of".  But then he goes onto the second
>>> sentence and proves that he meant both.
>>> 
>>> In actuality, he should have stopped the first sentence at
>>> "Engine", and then continued with a new sentence (keeping in
>>> mind the
>> simplified
>>> structure): "The Engine will then see if the first string after
>>> the hostname portion of the request URL matches any of the
>>> defined contexts. If a match is found, then the request is
>>> passed to that context and the response is sent back via the
>>> original connector.  If a match is not found, then an error is
>>> returned."
>>> 
>>> Of course, after reading the original, I now understand why I
>>> was never tempted to even try this company's version of Tomcat,
>>> despite the number of times they've promoted themselves on the
>>> list.
>> 
>> Jason Brittain used to work at MuleSoft: they /are/ legit, though
>> this particular post seems to require some serious editing, or
>> even deletion.
>> 
>> - -chris
> 
> OH, I was never worried about /legit/ status, but this page and
> others probably made me skeptical on the quality issue. You know,
> first impressions and all.  Wouldn't mind hearing from some who
> found reason to use their product over standard release.

We use Mirth Connect which is a product bundled with Mule ESB. They
have moved away from Mule for their upcoming product version, but I
think that was more because they simply didn't need everything Mule
was providing (kind of like discovering that Tomcat will work when you
started out with Weblogic).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJReBALAAoJEBzwKT+lPKRY/coP/R1jQxUOEZlN+ueK5tEUa70V
pb5poHBodRXtwfX3GJF0pS95igYQIzVMhi95BVO13eQnYxqbwoN+MAxdDaDfh+mU
ySOml1eUh7Zb0v2U60ZDtHcCBqGV6K34zptDevzzEMXZ1ansoIpBEXkt57oGB2BB
7fZs0ShRe1N4AiBIpq0k0zbfV90W6HRkgfjHZalCbP1ZuBWZ7YKbo2bJk1Z1R7J5
ynur/pLGNZfWpZ13VFME8i5yw8GoRYPmQHkp2scE5oTyfH6p6LIjOhWmTJ3QLgVq
1HFT7dbfoqhp/BPv4tyChr70q+BwfT2oKs/8f5ssCOVKOophmDdBBGUZ5+aaFxyt
gozjgVcHKmzq7E5++MarhkeyVCN9/ub0wC+2qnCCcI8k2xfFBg3zOHu3iN65Q5X+
VjhKF6LT4JmpWQlkwQE2Q2k0xEOCVvMycFj/kH8qvTDQ9oTo2iFPR8/mKLLI6thR
RtCmCmKdNUDYLHdhzUZwDEwXDBECA1yZlTwKSoPIQvG/WC3DQGRw841PuHrZ8NYO
wggoOUjpZHgsKYOAiMp2YFzpmE5psrJH50BTGw+JhWWT7stdVZU94qgyc9Wknv6o
JcdZ0aPIDP+PbyZhQIlg0MtPEYWK/pZzphKEQvx3o9RLUVF2iWkZxEAJ5W1ubxoh
JFiyvAeEGdUNwe/8/bOB
=EwqL
-----END PGP SIGNATURE-----

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


RE: two responses from one request - how is it possible ?

Posted by Jeffrey Janner <Je...@PolyDyne.com>.
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: Monday, April 22, 2013 4:31 PM
> To: Tomcat Users List
> Subject: Re: two responses from one request - how is it possible ?
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Jeffrey,
> 
> On 4/22/13 4:18 PM, Jeffrey Janner wrote:
> >
> >
> >> -----Original Message----- From: André Warnier [mailto:aw@ice-
> sa.com]
> >> Sent: Sunday, April 21, 2013 7:03 PM To:
> >> Tomcat Users List Subject: Re: two responses from one request - how
> >> is it possible ?
> >>
> >> Jakub 1983 wrote:
> >>> http://www.mulesoft.com/tomcat-connector states:
> >>>
> >>> Using the current arrangement, both Connectors will pass all
> >>> requests to the same Engine, which will in turn pass all these
> >>> requests to
> >> both
> >>> of its contained web applications.  This means that each request
> >>> will potentially generate two responses, one from each application.
> >>> <Server> <Service> <Connector port="8443"/> <Connector
> port="8444"/>
> >>> <Engine> <Host name="yourhostname"> <Context path="/webapp1"/>
> >>> <Context path="/webapp2"/> </Host> </Engine> </Service> </Server>
> >>>
> >>> Is it really true what they write ?
> >>>
> >>
> >> (For anyone else reading this, I did look at the indicated webpage,
> >> and it is really what they say there)
> >>
> >> To me, it sounds like utter nonsense. Or else, I need to revise my
> >> whole understamding of HTTP and Tomcat.
> >>
> >> It even looks like nonsense squared, since :
> >>
> >> - each request is sent by one client on one connection to one port
> >> (meaning one Tomcat Connector), and the (single) response to that
> >> request will also come back on that same connection - each request
> >> should have a target URL (like /webapp1 OR /webapp2, but not both),
> >> and will be processed (once) by the application
> >> (context) corresponding to that URL, and will generate only one
> >> response
> >>
> >> Maybe we should ask the author of that page for more details.  He
> may
> >> have invented the amplifier version of Tomcat.
> >>
> >> Additionally, it is really bad practice to put <Context> elements in
> >> the server.xml file.
> >>
> >
> >> From the article:
> > " Using the current arrangement, both Connectors will pass all
> > requests to the same Engine, which will in turn pass all these
> > requests to both of its contained web applications.  This means that
> > each request will potentially generate two responses, one from each
> > application."
> >
> > Well, after noting some of the bad grammar in the opening few
> > paragraphs (listen to vs. listen on), I was going to give the author
> a
> > pass on the use of "both" in the first sentence, instead of "either"
> > or "one of".  But then he goes onto the second sentence and proves
> > that he meant both.
> >
> > In actuality, he should have stopped the first sentence at "Engine",
> > and then continued with a new sentence (keeping in mind the
> simplified
> > structure): "The Engine will then see if the first string after the
> > hostname portion of the request URL matches any of the defined
> > contexts. If a match is found, then the request is passed to that
> > context and the response is sent back via the original connector.  If
> > a match is not found, then an error is returned."
> >
> > Of course, after reading the original, I now understand why I was
> > never tempted to even try this company's version of Tomcat, despite
> > the number of times they've promoted themselves on the list.
> 
> Jason Brittain used to work at MuleSoft: they /are/ legit, though this
> particular post seems to require some serious editing, or even
> deletion.
> 
> - -chris

OH, I was never worried about /legit/ status, but this page and others probably made me skeptical on the quality issue.
You know, first impressions and all.  Wouldn't mind hearing from some who found reason to use their product over standard release.
Jeff

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


Re: two responses from one request - how is it possible ?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jeffrey,

On 4/22/13 4:18 PM, Jeffrey Janner wrote:
> 
> 
>> -----Original Message----- From: André Warnier
>> [mailto:aw@ice-sa.com] Sent: Sunday, April 21, 2013 7:03 PM To:
>> Tomcat Users List Subject: Re: two responses from one request -
>> how is it possible ?
>> 
>> Jakub 1983 wrote:
>>> http://www.mulesoft.com/tomcat-connector states:
>>> 
>>> Using the current arrangement, both Connectors will pass all
>>> requests to the same Engine, which will in turn pass all these
>>> requests to
>> both
>>> of its contained web applications.  This means that each
>>> request will potentially generate two responses, one from each
>>> application. <Server> <Service> <Connector port="8443"/> 
>>> <Connector port="8444"/> <Engine> <Host name="yourhostname"> 
>>> <Context path="/webapp1"/> <Context path="/webapp2"/> </Host> 
>>> </Engine> </Service> </Server>
>>> 
>>> Is it really true what they write ?
>>> 
>> 
>> (For anyone else reading this, I did look at the indicated
>> webpage, and it is really what they say there)
>> 
>> To me, it sounds like utter nonsense. Or else, I need to revise
>> my whole understamding of HTTP and Tomcat.
>> 
>> It even looks like nonsense squared, since :
>> 
>> - each request is sent by one client on one connection to one
>> port (meaning one Tomcat Connector), and the (single) response to
>> that request will also come back on that same connection - each
>> request should have a target URL (like /webapp1 OR /webapp2, but 
>> not both), and will be processed (once) by the application
>> (context) corresponding to that URL, and will generate only one
>> response
>> 
>> Maybe we should ask the author of that page for more details.  He
>> may have invented the amplifier version of Tomcat.
>> 
>> Additionally, it is really bad practice to put <Context> elements
>> in the server.xml file.
>> 
> 
>> From the article:
> " Using the current arrangement, both Connectors will pass all
> requests to the same Engine, which will in turn pass all these
> requests to both of its contained web applications.  This means
> that each request will potentially generate two responses, one from
> each application."
> 
> Well, after noting some of the bad grammar in the opening few
> paragraphs (listen to vs. listen on), I was going to give the
> author a pass on the use of "both" in the first sentence, instead
> of "either" or "one of".  But then he goes onto the second sentence
> and proves that he meant both.
> 
> In actuality, he should have stopped the first sentence at
> "Engine", and then continued with a new sentence (keeping in mind
> the simplified structure): "The Engine will then see if the first
> string after the hostname portion of the request URL matches any of
> the defined contexts. If a match is found, then the request is
> passed to that context and the response is sent back via the
> original connector.  If a match is not found, then an error is
> returned."
> 
> Of course, after reading the original, I now understand why I was
> never tempted to even try this company's version of Tomcat, despite
> the number of times they've promoted themselves on the list.

Jason Brittain used to work at MuleSoft: they /are/ legit, though this
particular post seems to require some serious editing, or even deletion.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRdawiAAoJEBzwKT+lPKRYNt4QALRWIH3YlNReEh0dH3f1PnTw
ylzJE5GXNKrW/o9/7e1QkwJgqwNUA6AWtgWQv4Bwy1GAW4PWFcQa9qTQIbE78WTD
sQnoyMmeMrKIiOaW1xTAvZ+by+0hnp/wONc+AfDI2sHM24FigBZG/ByynJN51GeG
ojP++lWBx2RL+bxo/tl/MvUGTiypR+8BesX/zoizHZiKx6h9wh7Tqq8WkBIW4xBD
AdPZlK6l2Q1yvCsmkmGWNL+rsEaZuhN4C4z568oCtklSboYJ2OIWG4AkQ8L3sMAD
6V/geVIkWxzD6Yhx8FzqRfUE5WqFJcmKqemN3ixnaLhBUoMzgc8TziymRk1+vxnf
SsuLkCk4AtXUwwU9JQXWQkVFv1zhmmt3RcncvEVxKDWlTYitvKGiQany8XI0Z07l
epHRQznSuZbZY1DDoMBgEG5v5DIhKLRoIkpvmCqpn9Spo9m2w98LoT/QXgtaobyt
Hfq25inrAeekAr7txxPIeIN6lCxX9b1MZ+SyUjaxmiT0m2bWQJvIYtOkqz6NXC6G
dAIJu91v6663tB3RP+qud14Imqo2XcGpjkxnel6p9yR4EwRSbTEexjRBHF11kq8G
GYi7TG/GtO3isx/l/Y8A7qhLlX8CHvwYZd8sJ0L97dA+7wkRONigvQYOstyag4OH
3ZrdXUk7iHTHD8i321UY
=9dXu
-----END PGP SIGNATURE-----

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


Re: two responses from one request - how is it possible ?

Posted by Shanti Suresh <sh...@umich.edu>.
Hi André,

Those notes are very succinct.  Appreciate it.  Thank you for sharing.

                         -Shanti


On Wed, Apr 24, 2013 at 4:45 AM, André Warnier <aw...@ice-sa.com> wrote:

> André Warnier wrote:
>
>> Shanti Suresh wrote:
>>
>>> André
>>>
>>> Please kindly share the half-page that you have written up so far.
>>> Actually, would you please finish it up and then post?
>>>
>>>
>> Well, here you go. Luckily, it was still in my drafts folder.
>> Remember that it was a draft, and that a more accurate explanation is
>> available in the Servlet Spec.
>>
>>
>>
>> A HTTP request looks like this :
>>
>> GET /the_url.. HTTP/1.1<CR/LF>
>> Host: somehost.company.com<CR/LF>
>> ..
>>
>> The "Host:" header is examined first, to find out to which configured
>> Tomcat <Host> this request is addressed. If a matching Host is found, then
>> this will be the one which processes this request further.  If none is
>> found, then the request will be processed by Tomcat's default <Host> (the
>> one named in the <Engine> tag).
>>
>> Then comes the evaluation of the URL ("/the_url..").
>> Within the selected <Host>, Tomcat will first attempt to match the first
>> part of the URL with (the path of) one of the (non-ROOT) defined contexts.
>>  If a match is found, the request will be passed to that context for
>> processing (*).
>> If no match is found, and there is no default context defined, then
>> Tomcat will return an error to the client.
>> If there is a default context defined, then Tomcat will pass this request
>> to the default context (the one under (appBase)/ROOT) for processing.
>>  Within that default context, a match will then be attempted with any of
>> the <url-mapping> elements of that default context. If a mapping is found,
>> the request will be passed to the corresponding servlet for processing.
>> If no mapping is found, the request will be passed to the default servlet
>> of the default context for processing.  That one attempts to find a file on
>> disk within the default context, which matches the path indicated by the
>> URL. If it finds one, the file will be returned as the response. If no such
>> file is found, a 404 error will be returned.
>>
>> (*) within a matching context, there will be further matching of the
>> second part of the URL, with one the defined servlet's <url-mapping>
>> elements.
>>
>>  addendum : and (as this was an unfunished draft)
> I should have added that each non-ROOT context also has a default servlet,
> inherited from the default (catalina_base)/conf/web.xml.
> So if within a context no appropriate <url-mapping> can be found for this
> request to this context, the request will be processed by the default
> servlet of that context, which will look for a file on disk to satisfy the
> request.  And if it doesn't find one, it will return a 404 error.
>
> I should also have added that the URL-mapping as described above is a bit
> rough, and that the Servlet Spec explains more accurately how this is done.
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.org<us...@tomcat.apache.org>
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: two responses from one request - how is it possible ?

Posted by André Warnier <aw...@ice-sa.com>.
André Warnier wrote:
> Shanti Suresh wrote:
>> André
>>
>> Please kindly share the half-page that you have written up so far.
>> Actually, would you please finish it up and then post?
>>
> 
> Well, here you go. Luckily, it was still in my drafts folder.
> Remember that it was a draft, and that a more accurate explanation is 
> available in the Servlet Spec.
> 
> 
> 
> A HTTP request looks like this :
> 
> GET /the_url.. HTTP/1.1<CR/LF>
> Host: somehost.company.com<CR/LF>
> ..
> 
> The "Host:" header is examined first, to find out to which configured 
> Tomcat <Host> this request is addressed. If a matching Host is found, 
> then this will be the one which processes this request further.  If none 
> is found, then the request will be processed by Tomcat's default <Host> 
> (the one named in the <Engine> tag).
> 
> Then comes the evaluation of the URL ("/the_url..").
> Within the selected <Host>, Tomcat will first attempt to match the first 
> part of the URL with (the path of) one of the (non-ROOT) defined 
> contexts.  If a match is found, the request will be passed to that 
> context for processing (*).
> If no match is found, and there is no default context defined, then 
> Tomcat will return an error to the client.
> If there is a default context defined, then Tomcat will pass this 
> request to the default context (the one under (appBase)/ROOT) for 
> processing.  Within that default context, a match will then be attempted 
> with any of the <url-mapping> elements of that default context. If a 
> mapping is found, the request will be passed to the corresponding 
> servlet for processing.
> If no mapping is found, the request will be passed to the default 
> servlet of the default context for processing.  That one attempts to 
> find a file on disk within the default context, which matches the path 
> indicated by the URL. If it finds one, the file will be returned as the 
> response. If no such file is found, a 404 error will be returned.
> 
> (*) within a matching context, there will be further matching of the 
> second part of the URL, with one the defined servlet's <url-mapping> 
> elements.
> 
addendum : and (as this was an unfunished draft)
I should have added that each non-ROOT context also has a default servlet, inherited from 
the default (catalina_base)/conf/web.xml.
So if within a context no appropriate <url-mapping> can be found for this request to this 
context, the request will be processed by the default servlet of that context, which will 
look for a file on disk to satisfy the request.  And if it doesn't find one, it will 
return a 404 error.

I should also have added that the URL-mapping as described above is a bit rough, and that 
the Servlet Spec explains more accurately how this is done.

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


Re: two responses from one request - how is it possible ?

Posted by André Warnier <aw...@ice-sa.com>.
Shanti Suresh wrote:
> André
> 
> Please kindly share the half-page that you have written up so far.
> Actually, would you please finish it up and then post?
> 

Well, here you go. Luckily, it was still in my drafts folder.
Remember that it was a draft, and that a more accurate explanation is available in the 
Servlet Spec.



A HTTP request looks like this :

GET /the_url.. HTTP/1.1<CR/LF>
Host: somehost.company.com<CR/LF>
..

The "Host:" header is examined first, to find out to which configured Tomcat <Host> this 
request is addressed. If a matching Host is found, then this will be the one which 
processes this request further.  If none is found, then the request will be processed by 
Tomcat's default <Host> (the one named in the <Engine> tag).

Then comes the evaluation of the URL ("/the_url..").
Within the selected <Host>, Tomcat will first attempt to match the first part of the URL 
with (the path of) one of the (non-ROOT) defined contexts.  If a match is found, the 
request will be passed to that context for processing (*).
If no match is found, and there is no default context defined, then Tomcat will return an 
error to the client.
If there is a default context defined, then Tomcat will pass this request to the default 
context (the one under (appBase)/ROOT) for processing.  Within that default context, a 
match will then be attempted with any of the <url-mapping> elements of that default 
context. If a mapping is found, the request will be passed to the corresponding servlet 
for processing.
If no mapping is found, the request will be passed to the default servlet of the default 
context for processing.  That one attempts to find a file on disk within the default 
context, which matches the path indicated by the URL. If it finds one, the file will be 
returned as the response. If no such file is found, a 404 error will be returned.

(*) within a matching context, there will be further matching of the second part of the 
URL, with one the defined servlet's <url-mapping> elements.

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


Re: two responses from one request - how is it possible ?

Posted by Shanti Suresh <sh...@umich.edu>.
André

Please kindly share the half-page that you have written up so far.
Actually, would you please finish it up and then post?

Thanks :-)

                   -Shanti

On Tue, Apr 23, 2013 at 11:53 AM, André Warnier <aw...@ice-sa.com> wrote:

>
>
>>  Well, I did not want Jakub to remain influenced by that very bad page,
> so I started along the same path as you did, and after writing half a page
> and getting into the details of how Tomcat matched the second and next
> components of the URL path to the <url-mapping> elements of the selected
> context's web.xml, possibly ending up defaulting to the default servlet,
> which itself is defined in the default web.xml..
> I decided that it was easier - and less prone to get a rebuff myself from
> Pid or so - to point to the servlet spec.
>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.org<us...@tomcat.apache.org>
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: two responses from one request - how is it possible ?

Posted by André Warnier <aw...@ice-sa.com>.
Jeffrey Janner wrote:
>> -----Original Message-----
>> From: André Warnier [mailto:aw@ice-sa.com]
>> Sent: Monday, April 22, 2013 4:40 PM
>> To: Tomcat Users List
>> Subject: Re: two responses from one request - how is it possible ?
>>
>> Jeffrey Janner wrote:
>> ...
>>
>>> In actuality, he should have stopped the first sentence at "Engine",
>> and then continued with a new sentence (keeping in mind the simplified
>> structure):
>>>   "The Engine will then see if the first string after the hostname
>> portion
>>>    of the request URL matches any of the defined contexts. If a match
>> is found,
>>>    then the request is passed to that context and the response is
>> sent back
>>>    via the original connector.  If a match is not found, then an
>> error is returned."
>> That is a big improvement over the original (which in my view is quite
>> beyond redemption), but I believe that a better way would be to point
>> the interested reader to chapter 12 of the Java Servlet Specification
>> 3.0 ("Mapping Requests to Servlets"), which says it all (granted, in
>> many more words).
>> What is for example missing above are the concepts of, and mapping to,
>> the "default context", servlets within a context, and "default
>> servlet".
>>
> 
> Well, I was going to actually go into that depth, but decided to limit myself to their specific example.
> I had thought of explaining how the engine picks the host, and the host picks the context, and the context picks the servlet, then thought I'd limit myself as they had limited themselves.
> They only specified a single <Host> element with all default values, so I stuck to that example.
> 
Well, I did not want Jakub to remain influenced by that very bad page, so I started along 
the same path as you did, and after writing half a page and getting into the details of 
how Tomcat matched the second and next components of the URL path to the <url-mapping> 
elements of the selected context's web.xml, possibly ending up defaulting to the default 
servlet, which itself is defined in the default web.xml..
I decided that it was easier - and less prone to get a rebuff myself from Pid or so - to 
point to the servlet spec.


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


RE: two responses from one request - how is it possible ?

Posted by Jeffrey Janner <Je...@PolyDyne.com>.
> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com]
> Sent: Monday, April 22, 2013 4:40 PM
> To: Tomcat Users List
> Subject: Re: two responses from one request - how is it possible ?
> 
> Jeffrey Janner wrote:
> ...
> 
> >
> > In actuality, he should have stopped the first sentence at "Engine",
> and then continued with a new sentence (keeping in mind the simplified
> structure):
> >   "The Engine will then see if the first string after the hostname
> portion
> >    of the request URL matches any of the defined contexts. If a match
> is found,
> >    then the request is passed to that context and the response is
> sent back
> >    via the original connector.  If a match is not found, then an
> error is returned."
> >
> 
> That is a big improvement over the original (which in my view is quite
> beyond redemption), but I believe that a better way would be to point
> the interested reader to chapter 12 of the Java Servlet Specification
> 3.0 ("Mapping Requests to Servlets"), which says it all (granted, in
> many more words).
> What is for example missing above are the concepts of, and mapping to,
> the "default context", servlets within a context, and "default
> servlet".
> 

Well, I was going to actually go into that depth, but decided to limit myself to their specific example.
I had thought of explaining how the engine picks the host, and the host picks the context, and the context picks the servlet, then thought I'd limit myself as they had limited themselves.
They only specified a single <Host> element with all default values, so I stuck to that example.

Jeff


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


Re: two responses from one request - how is it possible ?

Posted by André Warnier <aw...@ice-sa.com>.
Jeffrey Janner wrote:
...

> 
> In actuality, he should have stopped the first sentence at "Engine", and then continued with a new sentence (keeping in mind the simplified structure):
>   "The Engine will then see if the first string after the hostname portion 
>    of the request URL matches any of the defined contexts. If a match is found, 
>    then the request is passed to that context and the response is sent back
>    via the original connector.  If a match is not found, then an error is returned."
> 

That is a big improvement over the original (which in my view is quite beyond redemption), 
but I believe that a better way would be to point the interested reader to chapter 12 of 
the Java Servlet Specification 3.0 ("Mapping Requests to Servlets"), which says it all 
(granted, in many more words).
What is for example missing above are the concepts of, and mapping to, the "default 
context", servlets within a context, and "default servlet".

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


RE: two responses from one request - how is it possible ?

Posted by Jeffrey Janner <Je...@PolyDyne.com>.

> -----Original Message-----
> From: André Warnier [mailto:aw@ice-sa.com]
> Sent: Sunday, April 21, 2013 7:03 PM
> To: Tomcat Users List
> Subject: Re: two responses from one request - how is it possible ?
> 
> Jakub 1983 wrote:
> > http://www.mulesoft.com/tomcat-connector states:
> >
> > Using the current arrangement, both Connectors will pass all requests
> > to the same Engine, which will in turn pass all these requests to
> both
> > of its contained web applications.  This means that each request will
> > potentially generate two responses, one from each application.
> > <Server>
> >   <Service>
> >     <Connector port="8443"/>
> >     <Connector port="8444"/>
> >     <Engine>
> >       <Host name="yourhostname">
> >         <Context path="/webapp1"/>
> >         <Context path="/webapp2"/>
> >       </Host>
> >     </Engine>
> >   </Service>
> > </Server>
> >
> > Is it really true what they write ?
> >
> 
> (For anyone else reading this, I did look at the indicated webpage, and
> it is really what they say there)
> 
> To me, it sounds like utter nonsense.
> Or else, I need to revise my whole understamding of HTTP and Tomcat.
> 
> It even looks like nonsense squared, since :
> 
> - each request is sent by one client on one connection to one port
> (meaning one Tomcat Connector), and the (single) response to that
> request will also come back on that same connection
> - each request should have a target URL (like /webapp1 OR /webapp2, but
> not both), and will be processed (once) by the application (context)
> corresponding to that URL, and will generate only one response
> 
> Maybe we should ask the author of that page for more details.  He may
> have invented the amplifier version of Tomcat.
> 
> Additionally, it is really bad practice to put <Context> elements in
> the server.xml file.
> 

>From the article:
    " Using the current arrangement, both Connectors will pass all requests 
   to the same Engine, which will in turn pass all these requests to both 
   of its contained web applications.  This means that each request will 
   potentially generate two responses, one from each application."

Well, after noting some of the bad grammar in the opening few paragraphs (listen to vs. listen on), I was going to give the author a pass on the use of "both" in the first sentence, instead of "either" or "one of".  But then he goes onto the second sentence and proves that he meant both.

In actuality, he should have stopped the first sentence at "Engine", and then continued with a new sentence (keeping in mind the simplified structure):
  "The Engine will then see if the first string after the hostname portion 
   of the request URL matches any of the defined contexts. If a match is found, 
   then the request is passed to that context and the response is sent back
   via the original connector.  If a match is not found, then an error is returned."

Of course, after reading the original, I now understand why I was never tempted to even try this company's version of Tomcat, despite the number of times they've promoted themselves on the list.

Jeff



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


Re: two responses from one request - how is it possible ?

Posted by André Warnier <aw...@ice-sa.com>.
Jakub 1983 wrote:
> http://www.mulesoft.com/tomcat-connector states:
> 
> Using the current arrangement, both Connectors will pass all requests to
> the same Engine, which will in turn pass all these requests to both of its
> contained web applications.  This means that each request will potentially
> generate two responses, one from each application.
> <Server>
>   <Service>
>     <Connector port="8443"/>
>     <Connector port="8444"/>
>     <Engine>
>       <Host name="yourhostname">
>         <Context path="/webapp1"/>
>         <Context path="/webapp2"/>
>       </Host>
>     </Engine>
>   </Service>
> </Server>
> 
> Is it really true what they write ?
> 

(For anyone else reading this, I did look at the indicated webpage, and it is really what 
they say there)

To me, it sounds like utter nonsense.
Or else, I need to revise my whole understamding of HTTP and Tomcat.

It even looks like nonsense squared, since :

- each request is sent by one client on one connection to one port (meaning one Tomcat 
Connector), and the (single) response to that request will also come back on that same 
connection
- each request should have a target URL (like /webapp1 OR /webapp2, but not both), and 
will be processed (once) by the application (context) corresponding to that URL, and will 
generate only one response

Maybe we should ask the author of that page for more details.  He may have invented the 
amplifier version of Tomcat.

Additionally, it is really bad practice to put <Context> elements in the server.xml file.



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