cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lionel Crine <cr...@4dconcept.fr>
Subject Re: request & response objects
Date Mon, 20 Oct 2003 13:53:14 GMT
Hello,

If you want to use the request and response object to get some parameters 
or so.

Why don't you try the <xsp-request:.../> and <xsp:request .../> tag.

Lionel



At 15:35 20/10/2003 +0200, you wrote:
>Hi,
>
>         I'm slowly getting into coccon. I read I can use "request" and
>"response" objects in XSP pages from my Java code. The official
>documentation says these objects are instances of
>HTTPServletRequest/Response, but is it really true?
>
>I'm instantiating an object whose constructor accepts two arguments as
>follow:
>
>public TheClass (HttpServletRequest request, HttpServletResponse
>response)
>
>When I try to instantiate an object out of this class cocoon ends up
>with an error complaining about an undefined constructor. Here is how I
>instantiated the object:
>
><?xml version="1.0" encoding="UTF-8"?>
><xsp:page xmlns:xsp="http://apache.org/xsp">
><xsp:structure>
><xsp:include>org.mysite.*</xsp:include>
></xsp:structure>
>
><my-root-element>
><xsp:expr>new TheClass(request, response)</xsp:expr>
>[...]
>
>
>This gets translated into the following code:
>
>[...]
>XSPObjectHelper.xspExpr(contentHandler, new WASClient(request,
>response));
>[...]
>
>And the error returned by cocoon is:
>
>org.apache.cocoon.components.language.LanguageException: Error compiling
>test_xsp: ERROR 1
>(org/apache/cocoon/www/projects/was/docs/test_xsp.java): ...
>this.characters("\n\n"); // start error (lines 104-104) "The constructor
>WASClient(Request, Response) is undefined"
>XSPObjectHelper.xspExpr(contentHandler, new WASClient(request,
>response)); // end error this.characters("\n\n"); ... Line 104, column
>0: The constructor WASClient(Request, Response) is undefined
>
>A comment into the generated code makes me think about the correctness
>of the documentation, here it is:
>
>         /* Built-in parameters available for use */
>         // context    - org.apache.cocoon.environment.Context
>         // request    - org.apache.cocoon.environment.Request
>         // response   - org.apache.cocoon.environment.Response
>
>So, what should I do to make my Object working? I'm using
>HTTPServletRequest/Response ad, to say the thruth, I'm not so happy
>changing them to be used in coccon. Anyway, if you tell me this is the
>only way to go...
>
>Tanks for any suggestion,
>Gianluca
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org

Lionel CRINE
Ingénieur Systèmes documentaires
Société : 4DConcept
22 rue Etienne de Jouy 78353 JOUY EN JOSAS
Tel : 01.34.58.70.70 Fax : 01.39.58.70.70


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


Mime
View raw message