You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Sergio Carvalho <se...@acm.org> on 2001/07/15 19:49:56 UTC

Re: [Bug 2631][patch] New: - JspGenerator doesn't allow relative src

Attached is a patch that seems to solve the problem. Please check it before
commiting - its not very elegant, but does the trick. 

On 15 Jul 2001 16:15:52 -0000, bugzilla@apache.org wrote:
--
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2631
> 
> *** shadow/2631	Sun Jul 15 09:15:52 2001
> --- shadow/2631.tmp.24988	Sun Jul 15 09:15:52 2001
> ***************
> *** 0 ****
> --- 1,28 ----
> + +============================================================================+
> + | JspGenerator doesn't allow relative src                                    |
> + +----------------------------------------------------------------------------+
> + |        Bug #: 2631                        Product: Cocoon 2                |
> + |       Status: NEW                         Version: 2.0alpha CVS            |
> + |   Resolution:                            Platform: Other                   |
> + |     Severity: Normal                   OS/Version: Other                   |
> + |     Priority: Other                     Component: core                    |
> + +----------------------------------------------------------------------------+
> + |  Assigned To: cocoon-dev@xml.apache.org                                    |
> + |  Reported By: sergio.carvalho@acm.org                                      |
> + |      CC list: Cc:                                                          |
> + +----------------------------------------------------------------------------+
> + |          URL:                                                              |
> + +============================================================================+
> + |                              DESCRIPTION                                   |
> + When the JspGenerator src parameter is a path relative to the current sitemap
> + context, the generator will fail, producing a 
> +  org.apache.jasper.JasperException: Unable to compile class for JSP
> + 
> + To reproduce:
> +  * Remove the leading slash from the JSP sample pipeline src parameter. It
> + becomes:    
> +    <map:match pattern="jsp/*">
> +     <map:generate type="jsp" src="docs/samples/jsp/{1}.jsp"/>
> +     <map:transform src="stylesheets/page/simple-page2html.xsl"/>
> +     <map:serialize type="html"/>
> +    </map:match>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 



--
Sergio Carvalho
---------------
sergio.carvalho@acm.org

If at first you don't succeed, skydiving is not for you

Re: [Bug 2631][patch] New: - JspGenerator doesn't allow relative src

Posted by Sergio Carvalho <se...@acm.org>.
Just checked it, and it does not work :-(  It is like before: an absolute file 
path works, a relative one doesn't, except that the errors are different. Now
I get a 
org.apache.cocoon.ProcessingException: SAXException JspGenerator.generate():org.xml.sax.SAXParseException: The root element isrequired in a well-formed document."

I'm attaching an snippet of cocoon.log, with the part concerning the request. 
However, everything looks ok, the .jsp gets resolved to the correct URL.

A look at tomcat/work shows a .java created for the requested jsp at:
./localhost/cocoon/opt/tomcat/webapps/cocoon/docs/samples/jsp/_0002fopt_0002ftomcat_0002fbin_0002f_0002e_0002e_0002fwebapps_0002fcocoon_0002fdocs_0002fsamples_0002fjsp_0002fhello_jsp.java
However, this file is of null size, and no .class is present.

On Mon, 16 Jul 2001 09:56:12 -0700 (PDT), Davanum Srinivas <di...@yahoo.com> wrote:
--
> Sergio,
> 
> Checked in your patch as well as componentized the JSP access into a JSPEngine/JSPEngineImpl. Can
> you please check if this works for you.
> 
> Thanks,
> dims
> 
> --- Sergio Carvalho <se...@acm.org> wrote:
> > 
> > Attached is a patch that seems to solve the problem. Please check it before
> > commiting - its not very elegant, but does the trick. 
> > 
> > On 15 Jul 2001 16:15:52 -0000, bugzilla@apache.org wrote:
> > --
> > > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2631
> > > 
> > > *** shadow/2631	Sun Jul 15 09:15:52 2001
> > > --- shadow/2631.tmp.24988	Sun Jul 15 09:15:52 2001
> > > ***************
> > > *** 0 ****
> > > --- 1,28 ----
> > > + +============================================================================+
> > > + | JspGenerator doesn't allow relative src                                    |
> > > + +----------------------------------------------------------------------------+
> > > + |        Bug #: 2631                        Product: Cocoon 2                |
> > > + |       Status: NEW                         Version: 2.0alpha CVS            |
> > > + |   Resolution:                            Platform: Other                   |
> > > + |     Severity: Normal                   OS/Version: Other                   |
> > > + |     Priority: Other                     Component: core                    |
> > > + +----------------------------------------------------------------------------+
> > > + |  Assigned To: cocoon-dev@xml.apache.org                                    |
> > > + |  Reported By: sergio.carvalho@acm.org                                      |
> > > + |      CC list: Cc:                                                          |
> > > + +----------------------------------------------------------------------------+
> > > + |          URL:                                                              |
> > > + +============================================================================+
> > > + |                              DESCRIPTION                                   |
> > > + When the JspGenerator src parameter is a path relative to the current sitemap
> > > + context, the generator will fail, producing a 
> > > +  org.apache.jasper.JasperException: Unable to compile class for JSP
> > > + 
> > > + To reproduce:
> > > +  * Remove the leading slash from the JSP sample pipeline src parameter. It
> > > + becomes:    
> > > +    <map:match pattern="jsp/*">
> > > +     <map:generate type="jsp" src="docs/samples/jsp/{1}.jsp"/>
> > > +     <map:transform src="stylesheets/page/simple-page2html.xsl"/>
> > > +     <map:serialize type="html"/>
> > > +    </map:match>
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > > For additional commands, email: cocoon-dev-help@xml.apache.org
> > > 
> > 
> > 
> > 
> > --
> > Sergio Carvalho
> > ---------------
> > sergio.carvalho@acm.org
> > 
> > If at first you don't succeed, skydiving is not for you
> > > ? deploy.sh
> > ? bug2631.patch
> > ? src/org/apache/cocoon/acting/PassParameterAction.java
> > Index: src/org/apache/cocoon/generation/JspGenerator.java
> > ===================================================================
> > RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/generation/JspGenerator.java,v
> > retrieving revision 1.10
> > diff -u -u -r1.10 JspGenerator.java
> > --- src/org/apache/cocoon/generation/JspGenerator.java	2001/07/11 19:20:12	1.10
> > +++ src/org/apache/cocoon/generation/JspGenerator.java	2001/07/15 17:43:19
> > @@ -89,7 +89,12 @@
> >  
> >          Parser parser = null;
> >          try {
> > -            MyServletRequest request = new MyServletRequest(httpRequest, this.source);
> > +            String resolvedSource = this.resolver.resolve(this.source).getSystemId();
> > +            // Guarantee src parameter is a file
> > +            if (!resolvedSource.startsWith("file:/"))
> > +               throw new IOException("Protocol not supported: " + resolvedSource);
> > +
> > +            MyServletRequest request = new MyServletRequest(httpRequest,
> > resolvedSource.substring(5));
> >              MyServletResponse response = new MyServletResponse(httpResponse);
> >  
> >              // start JSPServlet.
> > > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
> 
> 
> =====
> Davanum Srinivas, JNI-FAQ Manager
> http://www.jGuru.com/faq/JNI
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 



--
Sergio Carvalho
---------------
sergio.carvalho@acm.org

If at first you don't succeed, skydiving is not for you

Re: [Bug 2631][patch] New: - JspGenerator doesn't allow relative src

Posted by Davanum Srinivas <di...@yahoo.com>.
Sergio,

Checked in your patch as well as componentized the JSP access into a JSPEngine/JSPEngineImpl. Can
you please check if this works for you.

Thanks,
dims

--- Sergio Carvalho <se...@acm.org> wrote:
> 
> Attached is a patch that seems to solve the problem. Please check it before
> commiting - its not very elegant, but does the trick. 
> 
> On 15 Jul 2001 16:15:52 -0000, bugzilla@apache.org wrote:
> --
> > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2631
> > 
> > *** shadow/2631	Sun Jul 15 09:15:52 2001
> > --- shadow/2631.tmp.24988	Sun Jul 15 09:15:52 2001
> > ***************
> > *** 0 ****
> > --- 1,28 ----
> > + +============================================================================+
> > + | JspGenerator doesn't allow relative src                                    |
> > + +----------------------------------------------------------------------------+
> > + |        Bug #: 2631                        Product: Cocoon 2                |
> > + |       Status: NEW                         Version: 2.0alpha CVS            |
> > + |   Resolution:                            Platform: Other                   |
> > + |     Severity: Normal                   OS/Version: Other                   |
> > + |     Priority: Other                     Component: core                    |
> > + +----------------------------------------------------------------------------+
> > + |  Assigned To: cocoon-dev@xml.apache.org                                    |
> > + |  Reported By: sergio.carvalho@acm.org                                      |
> > + |      CC list: Cc:                                                          |
> > + +----------------------------------------------------------------------------+
> > + |          URL:                                                              |
> > + +============================================================================+
> > + |                              DESCRIPTION                                   |
> > + When the JspGenerator src parameter is a path relative to the current sitemap
> > + context, the generator will fail, producing a 
> > +  org.apache.jasper.JasperException: Unable to compile class for JSP
> > + 
> > + To reproduce:
> > +  * Remove the leading slash from the JSP sample pipeline src parameter. It
> > + becomes:    
> > +    <map:match pattern="jsp/*">
> > +     <map:generate type="jsp" src="docs/samples/jsp/{1}.jsp"/>
> > +     <map:transform src="stylesheets/page/simple-page2html.xsl"/>
> > +     <map:serialize type="html"/>
> > +    </map:match>
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
> > 
> 
> 
> 
> --
> Sergio Carvalho
> ---------------
> sergio.carvalho@acm.org
> 
> If at first you don't succeed, skydiving is not for you
> > ? deploy.sh
> ? bug2631.patch
> ? src/org/apache/cocoon/acting/PassParameterAction.java
> Index: src/org/apache/cocoon/generation/JspGenerator.java
> ===================================================================
> RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/generation/JspGenerator.java,v
> retrieving revision 1.10
> diff -u -u -r1.10 JspGenerator.java
> --- src/org/apache/cocoon/generation/JspGenerator.java	2001/07/11 19:20:12	1.10
> +++ src/org/apache/cocoon/generation/JspGenerator.java	2001/07/15 17:43:19
> @@ -89,7 +89,12 @@
>  
>          Parser parser = null;
>          try {
> -            MyServletRequest request = new MyServletRequest(httpRequest, this.source);
> +            String resolvedSource = this.resolver.resolve(this.source).getSystemId();
> +            // Guarantee src parameter is a file
> +            if (!resolvedSource.startsWith("file:/"))
> +               throw new IOException("Protocol not supported: " + resolvedSource);
> +
> +            MyServletRequest request = new MyServletRequest(httpRequest,
> resolvedSource.substring(5));
>              MyServletResponse response = new MyServletResponse(httpResponse);
>  
>              // start JSPServlet.
> > ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

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