cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aaldr...@csc.com
Subject Re: C2 request object
Date Wed, 15 Aug 2001 10:28:03 GMT
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 <cbonner_98@yahoo.com> on 15/08/2001 06:17:45

Please respond to cocoon-users@xml.apache.org

To:   cocoon-users@xml.apache.org
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 <paul@oil-law.com> 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: <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail: <cocoon-users-help@xml.apache.org>
>


__________________________________________________
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>







---------------------------------------------------------------------
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message