You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jason Uithol <ja...@datacodex.net> on 2002/07/02 03:28:23 UTC

How to Obtain HttpRequest interface in 2.0.2 ?

We have upgraded from Cocoon 2.0.1 to Cocoon 2.0.2

One of our transformers can no longer handle internal requests.  The code
that fails is:

public void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par)
  throws SAXException, ProcessingException, IOException
{
    Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT);

    // This line here gets a ClassCastException.
    HttpRequest hreq = (HttpRequest)request;

    Session session = hreq.getSession();

    Context context = (Context)objectModel.get(Constants.CONTEXT_OBJECT);

    handler.setInputs(session, request, context);
}


The hreq variable is not used anywhere else.  It seems to be only for
getting the session.  What method do I use for getting the session for
internal requests ( in 2.0.2 ) ?


Thanks in advance,


Jason Uithol
Data Technologist
DatacodeX Pty Ltd
jason@datacodex.com
http://www.datacodex.com


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: How to Obtain HttpRequest interface in 2.0.2 ?

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 02.Jul.2002 -- 11:28 AM, Jason Uithol wrote:
> We have upgraded from Cocoon 2.0.1 to Cocoon 2.0.2
> 
> One of our transformers can no longer handle internal requests.  The code
> that fails is:
> 
> public void setup(SourceResolver resolver, Map objectModel, String src,
> Parameters par)
>   throws SAXException, ProcessingException, IOException
> {
>     Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
> 
>     // This line here gets a ClassCastException.
>     HttpRequest hreq = (HttpRequest)request;
> 
>     Session session = hreq.getSession();
> 
>     Context context = (Context)objectModel.get(Constants.CONTEXT_OBJECT);
> 
>     handler.setInputs(session, request, context);
> }

Some constants were removed since their place was not considered
reasonable (i.e. don't belong to the core). There is a helper class
for getting the request object now:

org.apache.cocoon.environment.ObjectModelHelper

Method

public static final Request getRequest(java.util.Map objectModel)

The same is true for the context object.

	Chris.

Please follow up summarizing your problem and which suggested solution /
information worked for you. Add "SUMMARY: " to the subject line. This
will make FAQ generation and searching the list easier. In addition,
it makes helping you more fun. Thank you.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: How to Obtain HttpRequest interface in 2.0.2 ?

Posted by Reinhard Poetz <re...@gmx.net>.
Hi Jason,

> public void setup(SourceResolver resolver, Map objectModel, String src,
> Parameters par)
>   throws SAXException, ProcessingException, IOException
> {
>     Request request = (Request) objectModel.get(Constants.REQUEST_OBJECT);
>
>     // This line here gets a ClassCastException.
>     HttpRequest hreq = (HttpRequest)request;

         --> skip the last line

>
>     Session session = hreq.getSession();

      Session session = request.getSession();

>
>     Context context = (Context)objectModel.get(Constants.CONTEXT_OBJECT);
>
>     handler.setInputs(session, request, context);
> }

Hope that helps

Regards,
Reinhard


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>