You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Rui Alberto L. Gonçalves" <ru...@ptinovacao.pt> on 2003/11/20 12:58:11 UTC

JspGenerator and cocoon protocol

Hi all,

in my sitemap I have an map:aggregation that part of its content
is is generated invoking an internal pipeline:

<map:match pattern="*.jsp">
  <map:generate src="generators//jsp/{1}.xsp" type="jsp"/>
  <map:serialize type="xml"/>
</map:match>

<map:aggregate element="page">
 <map:part src="conf/{../1}/application.xml" strip-root="true"/>
 <map:part src="cocoon:/cube.jsp" strip-root="true"/>
</map:aggregate>

I'am getting an JspGenerator exception. I know that this is a well
known problem when using cocoon:/ or context:/ protocols in cases
like this one!


I'am using cocoon 2.1.2 with tomcat 4.0.6. I had this working with
cocoon 2.0.4.

The exception is generated when executing this code in JspGenerator:
==========================================
if (!url.startsWith("/")) {
                // get current request path
                String servletPath = httpRequest.getServletPath();
                // remove sitemap URI part
                String sitemapURI =
ObjectModelHelper.getRequest(objectModel).getSitemapURI();
                servletPath = servletPath.substring(0,
servletPath.indexOf(sitemapURI));
                url = servletPath + url;
            }
===========================================

Does anyone has solved this problem, or give me the right direction?!
Thaks to all in advance,
Rui Alberto

-- 
Rui Alberto L. Gonçalves <ru...@ptinovacao.pt>
PT Inovação


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


Re: JspGenerator and cocoon protocol

Posted by "Rui Alberto L. Gonçalves" <ru...@ptinovacao.pt>.
Thanks Joerg,
it worked!! I know that generating a JSP is not a good idea,
but I have to live with it while I don't have time to to fix this up!
Thanks again...




On Thu, 2003-11-20 at 12:39, Joerg Heinicke wrote:
> Yes, the support for cocoon:/ is broken at the moment.
> Some time ago a solution was provided at 
> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=106616211423973&w=2 (have I 
> mentioned that I hate HTML mails?).
> But this is again only a partly fix, but should work for your problem. It 
> won't work with "cocoon:/another/directory/cube.jsp", i.e. with further slashes.
> I will commit it to CVS in this way.
> 
> But in general: Is generating a JSP a good idea? Why not using XSP or 
> another technique? The JSPReader/Generator should only be used for legacy 
> application integration.
> 
> Joerg
> 
> 
> Rui Alberto L. Gonçalves wrote:
> > Hi all,
> > 
> > in my sitemap I have an map:aggregation that part of its content
> > is is generated invoking an internal pipeline:
> > 
> > <map:match pattern="*.jsp">
> >   <map:generate src="generators//jsp/{1}.xsp" type="jsp"/>
> >   <map:serialize type="xml"/>
> > </map:match>
> > 
> > <map:aggregate element="page">
> >  <map:part src="conf/{../1}/application.xml" strip-root="true"/>
> >  <map:part src="cocoon:/cube.jsp" strip-root="true"/>
> > </map:aggregate>
> > 
> > I'am getting an JspGenerator exception. I know that this is a well
> > known problem when using cocoon:/ or context:/ protocols in cases
> > like this one!
> > 
> > 
> > I'am using cocoon 2.1.2 with tomcat 4.0.6. I had this working with
> > cocoon 2.0.4.
> > 
> > The exception is generated when executing this code in JspGenerator:
> > ==========================================
> > if (!url.startsWith("/")) {
> >                 // get current request path
> >                 String servletPath = httpRequest.getServletPath();
> >                 // remove sitemap URI part
> >                 String sitemapURI =
> > ObjectModelHelper.getRequest(objectModel).getSitemapURI();
> >                 servletPath = servletPath.substring(0,
> > servletPath.indexOf(sitemapURI));
> >                 url = servletPath + url;
> >             }
> > ===========================================
> > 
> > Does anyone has solved this problem, or give me the right direction?!
> > Thaks to all in advance,
> > Rui Alberto
> > 
-- 
Rui Alberto L. Gonçalves <ru...@ptinovacao.pt>
PT Inovação


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


Re: JspGenerator and cocoon protocol

Posted by Joerg Heinicke <jh...@virbus.de>.
Yes, the support for cocoon:/ is broken at the moment.
Some time ago a solution was provided at 
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=106616211423973&w=2 (have I 
mentioned that I hate HTML mails?).
But this is again only a partly fix, but should work for your problem. It 
won't work with "cocoon:/another/directory/cube.jsp", i.e. with further slashes.
I will commit it to CVS in this way.

But in general: Is generating a JSP a good idea? Why not using XSP or 
another technique? The JSPReader/Generator should only be used for legacy 
application integration.

Joerg


Rui Alberto L. Gonçalves wrote:
> Hi all,
> 
> in my sitemap I have an map:aggregation that part of its content
> is is generated invoking an internal pipeline:
> 
> <map:match pattern="*.jsp">
>   <map:generate src="generators//jsp/{1}.xsp" type="jsp"/>
>   <map:serialize type="xml"/>
> </map:match>
> 
> <map:aggregate element="page">
>  <map:part src="conf/{../1}/application.xml" strip-root="true"/>
>  <map:part src="cocoon:/cube.jsp" strip-root="true"/>
> </map:aggregate>
> 
> I'am getting an JspGenerator exception. I know that this is a well
> known problem when using cocoon:/ or context:/ protocols in cases
> like this one!
> 
> 
> I'am using cocoon 2.1.2 with tomcat 4.0.6. I had this working with
> cocoon 2.0.4.
> 
> The exception is generated when executing this code in JspGenerator:
> ==========================================
> if (!url.startsWith("/")) {
>                 // get current request path
>                 String servletPath = httpRequest.getServletPath();
>                 // remove sitemap URI part
>                 String sitemapURI =
> ObjectModelHelper.getRequest(objectModel).getSitemapURI();
>                 servletPath = servletPath.substring(0,
> servletPath.indexOf(sitemapURI));
>                 url = servletPath + url;
>             }
> ===========================================
> 
> Does anyone has solved this problem, or give me the right direction?!
> Thaks to all in advance,
> Rui Alberto
> 

-- 
System Development
VIRBUS AG
Fon  +49(0)341-979-7419
Fax  +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de


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