You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Peter Johnson <pe...@wizardslair.net> on 2005/03/02 01:53:52 UTC
Include other contexts
Tomcat 5.5.7
Hi all,
I was just wondering if it was possible to pass a request to another
context within the same host and capture the output. If it is, any
suggestions on the best way to do so?
Basically, I am planning to use SiteMesh for site templating however
would prefer to deploy many of the apps as individual apps. So somehow I
would like to call another context and then have SiteMesh "decorate" the
response.
Any suggestions will be appreciated, thanks in advance.
PJ
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Include other contexts
Posted by Peter Johnson <pe...@wizardslair.net>.
It is me ... I wasn't calling the other context rather just a resource
within the context
Peter Johnson wrote:
> Ok, I gave this a test run, so from app1 I called
>
> req.getRequestDispatcher("/app2").include(req,res);
>
> However, it seems that doing this loops i.e. re-requests app1 rather
> than passing the request to app2. It this an error with Tomcat or a
> misunderstanding by me?
>
> PJ
>
> Peter Johnson wrote:
>
>> it would seem to be as simple as
>>
>> req.getRequestDispatcher(<newuri>).include(req,res);
>>
>> PJ
>>
>> Peter Johnson wrote:
>>
>>> Thanks for the quick reply QM ...
>>>
>>> I'd be writing both the "parent" and "child" apps. Basically the
>>> parent would act as a broker to the child apps and perform the
>>> "decoration". I guess SiteMesh does a form of automated "screen
>>> scraping". I would do this so that all "child" apps may have a
>>> common look-n-feel and there would be a global navigation.
>>>
>>> I will look into RequestDispatcher#include() as it sounds similar to
>>> what I'd be after.
>>>
>>> PJ
>>>
>>> QM wrote:
>>>
>>>> On Wed, Mar 02, 2005 at 11:53:52AM +1100, Peter Johnson wrote:
>>>> : I was just wondering if it was possible to pass a request to
>>>> another : context within the same host and capture the output. If
>>>> it is, any : suggestions on the best way to do so?
>>>>
>>>> You could make a URL call to the app (java.net.URL and other similar
>>>> implementations). Either that, or RequestDispatcher#include()
>>>> (Though something tells me that requires an in-context URL. Check the
>>>> docs to be sure.)
>>>>
>>>> It sounds like you're "screen scraping," though, in which case
>>>> you'd be
>>>> better off trying to find some common data format that app A and app B
>>>> can share. (If, of course, you have some control or influence over
>>>> App
>>>> A.)
>>>>
>>>> If app A changes the format of the data (common with websites) then
>>>> app
>>>> B has to play catch-up with its parsing.
>>>>
>>>>
>>>> : Basically, I am planning to use SiteMesh for site templating
>>>> however : would prefer to deploy many of the apps as individual
>>>> apps. So somehow I : would like to call another context and then
>>>> have SiteMesh "decorate" the : response.
>>>>
>>>> Are you using this setup for branding, then, or something else? I may
>>>> have some suggestions, but knowing your end-goal may help.
>>>>
>>>> -QM
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Include other contexts
Posted by Peter Johnson <pe...@wizardslair.net>.
Ok, I gave this a test run, so from app1 I called
req.getRequestDispatcher("/app2").include(req,res);
However, it seems that doing this loops i.e. re-requests app1 rather
than passing the request to app2. It this an error with Tomcat or a
misunderstanding by me?
PJ
Peter Johnson wrote:
> it would seem to be as simple as
>
> req.getRequestDispatcher(<newuri>).include(req,res);
>
> PJ
>
> Peter Johnson wrote:
>
>> Thanks for the quick reply QM ...
>>
>> I'd be writing both the "parent" and "child" apps. Basically the
>> parent would act as a broker to the child apps and perform the
>> "decoration". I guess SiteMesh does a form of automated "screen
>> scraping". I would do this so that all "child" apps may have a common
>> look-n-feel and there would be a global navigation.
>>
>> I will look into RequestDispatcher#include() as it sounds similar to
>> what I'd be after.
>>
>> PJ
>>
>> QM wrote:
>>
>>> On Wed, Mar 02, 2005 at 11:53:52AM +1100, Peter Johnson wrote:
>>> : I was just wondering if it was possible to pass a request to
>>> another : context within the same host and capture the output. If it
>>> is, any : suggestions on the best way to do so?
>>>
>>> You could make a URL call to the app (java.net.URL and other similar
>>> implementations). Either that, or RequestDispatcher#include()
>>> (Though something tells me that requires an in-context URL. Check the
>>> docs to be sure.)
>>>
>>> It sounds like you're "screen scraping," though, in which case you'd be
>>> better off trying to find some common data format that app A and app B
>>> can share. (If, of course, you have some control or influence over App
>>> A.)
>>>
>>> If app A changes the format of the data (common with websites) then app
>>> B has to play catch-up with its parsing.
>>>
>>>
>>> : Basically, I am planning to use SiteMesh for site templating
>>> however : would prefer to deploy many of the apps as individual
>>> apps. So somehow I : would like to call another context and then
>>> have SiteMesh "decorate" the : response.
>>>
>>> Are you using this setup for branding, then, or something else? I may
>>> have some suggestions, but knowing your end-goal may help.
>>>
>>> -QM
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Include other contexts
Posted by Peter Johnson <pe...@wizardslair.net>.
it would seem to be as simple as
req.getRequestDispatcher(<newuri>).include(req,res);
PJ
Peter Johnson wrote:
> Thanks for the quick reply QM ...
>
> I'd be writing both the "parent" and "child" apps. Basically the
> parent would act as a broker to the child apps and perform the
> "decoration". I guess SiteMesh does a form of automated "screen
> scraping". I would do this so that all "child" apps may have a common
> look-n-feel and there would be a global navigation.
>
> I will look into RequestDispatcher#include() as it sounds similar to
> what I'd be after.
>
> PJ
>
> QM wrote:
>
>> On Wed, Mar 02, 2005 at 11:53:52AM +1100, Peter Johnson wrote:
>> : I was just wondering if it was possible to pass a request to
>> another : context within the same host and capture the output. If it
>> is, any : suggestions on the best way to do so?
>>
>> You could make a URL call to the app (java.net.URL and other similar
>> implementations). Either that, or RequestDispatcher#include()
>> (Though something tells me that requires an in-context URL. Check the
>> docs to be sure.)
>>
>> It sounds like you're "screen scraping," though, in which case you'd be
>> better off trying to find some common data format that app A and app B
>> can share. (If, of course, you have some control or influence over App
>> A.)
>>
>> If app A changes the format of the data (common with websites) then app
>> B has to play catch-up with its parsing.
>>
>>
>> : Basically, I am planning to use SiteMesh for site templating
>> however : would prefer to deploy many of the apps as individual apps.
>> So somehow I : would like to call another context and then have
>> SiteMesh "decorate" the : response.
>>
>> Are you using this setup for branding, then, or something else? I may
>> have some suggestions, but knowing your end-goal may help.
>>
>> -QM
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Include other contexts
Posted by Peter Johnson <pe...@wizardslair.net>.
Thanks for the quick reply QM ...
I'd be writing both the "parent" and "child" apps. Basically the parent
would act as a broker to the child apps and perform the "decoration". I
guess SiteMesh does a form of automated "screen scraping". I would do
this so that all "child" apps may have a common look-n-feel and there
would be a global navigation.
I will look into RequestDispatcher#include() as it sounds similar to
what I'd be after.
PJ
QM wrote:
>On Wed, Mar 02, 2005 at 11:53:52AM +1100, Peter Johnson wrote:
>: I was just wondering if it was possible to pass a request to another
>: context within the same host and capture the output. If it is, any
>: suggestions on the best way to do so?
>
>You could make a URL call to the app (java.net.URL and other similar
>implementations). Either that, or RequestDispatcher#include()
>(Though something tells me that requires an in-context URL. Check the
>docs to be sure.)
>
>It sounds like you're "screen scraping," though, in which case you'd be
>better off trying to find some common data format that app A and app B
>can share. (If, of course, you have some control or influence over App
>A.)
>
>If app A changes the format of the data (common with websites) then app
>B has to play catch-up with its parsing.
>
>
>: Basically, I am planning to use SiteMesh for site templating however
>: would prefer to deploy many of the apps as individual apps. So somehow I
>: would like to call another context and then have SiteMesh "decorate" the
>: response.
>
>Are you using this setup for branding, then, or something else? I may
>have some suggestions, but knowing your end-goal may help.
>
>-QM
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Include other contexts
Posted by QM <qm...@brandxdev.net>.
On Wed, Mar 02, 2005 at 11:53:52AM +1100, Peter Johnson wrote:
: I was just wondering if it was possible to pass a request to another
: context within the same host and capture the output. If it is, any
: suggestions on the best way to do so?
You could make a URL call to the app (java.net.URL and other similar
implementations). Either that, or RequestDispatcher#include()
(Though something tells me that requires an in-context URL. Check the
docs to be sure.)
It sounds like you're "screen scraping," though, in which case you'd be
better off trying to find some common data format that app A and app B
can share. (If, of course, you have some control or influence over App
A.)
If app A changes the format of the data (common with websites) then app
B has to play catch-up with its parsing.
: Basically, I am planning to use SiteMesh for site templating however
: would prefer to deploy many of the apps as individual apps. So somehow I
: would like to call another context and then have SiteMesh "decorate" the
: response.
Are you using this setup for branding, then, or something else? I may
have some suggestions, but knowing your end-goal may help.
-QM
--
software -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org