You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Fe...@thomson.com on 2006/03/22 16:43:43 UTC

HttpServletRequest?

In a component, I need to call a third-party method which takes a
HttpServletRequest as a parameter.

In this component, I have access to a cocoon Request.

How can I do to get to an HttpServletRequest? The method I want to call
needs to look at the headers and source IP address.

 

Thanks


Re: HttpServletRequest?

Posted by Bruno Dumon <br...@outerthought.org>.
Hi,

If you search the archives of the dev list, you should find recent
(dec-feb) discussions on this topic, look for threads with titles like

Ditching the environment abstraction
The environment abstraction, part II
Let the environment interfaces extend the javax.servlet.http ones

On Wed, 2006-03-22 at 09:27 -0700, Brian Hawkins wrote:
> In thinking about this more I think the best solution all around is to 
> have the cocoon Request interface inherit from the HttpServletRequest 
> interface.  Then it could be passed around and used in any servlet.
> 
> Brian
> 
> Brian Hawkins wrote:
> > This brings up a good question.  Why does cocoon feel the need to wrap 
> > every object?  The cocoon Request interface is (as far as I can tell) 
> > identical to the HttpServletRequest interface.  From the code the only 
> > difference is that is wraps other objects like the session.  All this 
> > seems to do is frustrate developers who have to inter operate with 
> > other servlets running in the same container.
> >
> > Fernando,  I think the solution for both of us is to hack the 
> > HttpRequest object and provide a getHttpServletReuqest method.
> >
> > Brian
> >
> > Fernando.Matomira@thomson.com wrote:
> >>
> >> In a component, I need to call a third-party method which takes a 
> >> HttpServletRequest as a parameter.
> >>
> >> In this component, I have access to a cocoon Request.
> >>
> >> How can I do to get to an HttpServletRequest? The method I want to 
> >> call needs to look at the headers and source IP address.
> >>
> >>  
> >>
> >> Thanks
> >>
-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


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


Re: HttpServletRequest?

Posted by Brian Hawkins <br...@lingotek.com>.
In thinking about this more I think the best solution all around is to 
have the cocoon Request interface inherit from the HttpServletRequest 
interface.  Then it could be passed around and used in any servlet.

Brian

Brian Hawkins wrote:
> This brings up a good question.  Why does cocoon feel the need to wrap 
> every object?  The cocoon Request interface is (as far as I can tell) 
> identical to the HttpServletRequest interface.  From the code the only 
> difference is that is wraps other objects like the session.  All this 
> seems to do is frustrate developers who have to inter operate with 
> other servlets running in the same container.
>
> Fernando,  I think the solution for both of us is to hack the 
> HttpRequest object and provide a getHttpServletReuqest method.
>
> Brian
>
> Fernando.Matomira@thomson.com wrote:
>>
>> In a component, I need to call a third-party method which takes a 
>> HttpServletRequest as a parameter.
>>
>> In this component, I have access to a cocoon Request.
>>
>> How can I do to get to an HttpServletRequest? The method I want to 
>> call needs to look at the headers and source IP address.
>>
>>  
>>
>> Thanks
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org

Re: HttpServletRequest?

Posted by Brian Hawkins <br...@lingotek.com>.
This brings up a good question.  Why does cocoon feel the need to wrap 
every object?  The cocoon Request interface is (as far as I can tell) 
identical to the HttpServletRequest interface.  From the code the only 
difference is that is wraps other objects like the session.  All this 
seems to do is frustrate developers who have to inter operate with other 
servlets running in the same container.

Fernando,  I think the solution for both of us is to hack the 
HttpRequest object and provide a getHttpServletReuqest method.

Brian

Fernando.Matomira@thomson.com wrote:
>
> In a component, I need to call a third-party method which takes a 
> HttpServletRequest as a parameter.
>
> In this component, I have access to a cocoon Request.
>
> How can I do to get to an HttpServletRequest? The method I want to 
> call needs to look at the headers and source IP address.
>
>  
>
> Thanks
>

Re: HttpServletRequest?

Posted by Bruno Dumon <br...@outerthought.org>.
On Wed, 2006-03-22 at 16:43 +0100, Fernando.Matomira@thomson.com wrote:
> In a component, I need to call a third-party method which takes a
> HttpServletRequest as a parameter.
> 
> In this component, I have access to a cocoon Request.
> 
> How can I do to get to an HttpServletRequest? The method I want to
> call needs to look at the headers and source IP address.

The original request object is stored in the objectModel, you can access
it like this:

HttpServletRequest httpRequest = (HttpServletRequest) objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT);

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


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