Il lun, 2003-10-20 alle 15:53, Lionel Crine ha scritto: > 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.
Because I need to pass to an already existant Java Class an HTTPServetRequest object. I'm considering writing a logicsheet encapsulating the functionalities of my object, but I'd like to know if there's a way to make may existing object work with cocoon as it is. Thanks, Gianluca > 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: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
