Hi,
I had the same problem. It's strange the API says that HttpRequest
implements HttpServletRequest. It does in all but name - ie it has all the
methods, but doesn't explicitly implement the interface.
I posted this question before asking if this was an oversight or done on
purpose - but no response. Perhaps this is one for the dev group to answer.
Looking at the code, it would be simple either to add an access method
(getRequest) to the HttpRequest object, or to simply formally implement the
interface.
In the meantime I've simply recoded my software to use HttpRequest instead
of HttpServletRequest (which is inconvenient, but hey...).
The Cocoon request object CAN be cast to a (Cocoon) HttpRequest object.
This does have the same methods, so the code just needs adjusting to use
the Cocoon class instead of the javax class.
I wonder why ...
Here's some xsp code I use now: jbxsp = new Jbxsp
( (org.apache.cocoon.environment.http.HttpRequest )(request) ,
"com.jpmorgan.mih.intranet.example.SimpleSite");
Unfortunately, because I'm mindful that the javax class would be more
useful in general, and I would hope it will become available, I have to
duplicate my java methods, one for each class - not nice!
eg
public void setReq(javax.servlet.http.HttpServletRequest req){
setRequest(req);
....
}
public void setReq(org.apache.cocoon.environment.http.HttpRequest req){
setRequest(req);
...
}
I use the setRequest with the Cocoon class to set a flag (boolean c2), so that other
methods relying on the request object can use the correct
version. All a bit of a hack really...
eg
String eCom = null;
String sTag = null;
if(c2)
eCom = hreq.getParameter("mih_edit_component");
else
eCom = req.getParameter("mih_edit_component");
if(c2)
sTag = hreq.getParameter("mih-selected-tag");
else
sTag = req.getParameter("mih-selected-tag");
Never mind!
Regards,
Anthony Aldridge
Lead Application developer
Managed Intranet Hosting
Personal GDP: 325-8338
MIH Hotline: 876-1300
Cassandra Bonner <[EMAIL PROTECTED]> on 15/08/2001 06:17:45
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: Re: C2 request object
Hmmm,
we hit this as well while migrating, but i assumed from the posting
below that there is no way to get to the
javax.servlet.HttpServletReq/Resp.?.
I've moved to the cocoon req,resp (which according to this posting is
more generic), but I don't understand how this will be portable. As
you, I have java code called outside my xsp pages (not beans, but
manager classes) that uses the req and resp, which now has to be
coded with cocoon req resp.
Anyways, the posting might offer some consolation.?. If you find a
way to use javax.servlet.*, pls post to group.
http://mailman.real-time.com/pipermail/cocoon-users/2001-April/013154.html
thanks!
cass
--- Paul Lamb <[EMAIL PROTECTED]> wrote:
> I'm porting some c1 code over and need to get the actual
> javax.servlet.http.HttpServletRequest object in a xsp page so that
> it
> can be passed to another bean.
>
> Casting the request object doesn't work and I can't find a
> getRequest()
> method.
>
> Any suggesting are appreciated.
>
> Paul Lamb
>
>
---------------------------------------------------------------------
> Please check that your question has not already been answered in
> the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
>
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>