You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marc Baumgartner <mo...@gmx.de> on 2003/07/31 19:39:09 UTC

Bug in JSPReader?

Hello all,

it seems that there is a bug in the JSPReader class?

I have the following sitemap entry:

<map:match pattern="admin/*.jsp">
 	<map:read type="jsp" src="test/{1}.jsp" mime-type="text/html" />
</map:match>

With entering the url "localhost:8080/cocoon/admin/hello.jsp" I get a error 
message that the ressource "localhost:8080/cocoon/test/admin/hello.jsp" can 
not be found.

I am using tomcat 4.1.24 and have tried this with cocoon 2.04, 2.1m1-m3.

I took a look at the sourcecode of the JSPReader and there are the following 
lines:

// get current request path
String servletPath = httpRequest.getServletPath();
// remove file part
servletPath = servletPath.substring(0,servletPath.lastIndexOf('/') + 1);
url = servletPath + url;

I call this URL: "localhost:8080/cocoon/admin/hello.jsp"

The variable servletPath contains "/admin/hello.jsp".
Then this path is reduced to "/admin/".
The variable url contains the path to which we are mapping: "/test/hello.jsp".

But the final url is "/admin/test/hello.jsp"

From my point of view the variable servletPath has to contain the path the 
current subsitemap. In my case "/".

Is this maybe a bug?

regards
Marc




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


Re: Bug in JSPReader?

Posted by Marc Baumgartner <mo...@gmx.de>.
> Anyone is always the first ;-) Maybe the others port their code to
> Cocoon processing instead of reusing legacy JSP.

I know, I Know ;-)

> But the HttpServletRequest implementation is only minimalistic in the
> JSPEngineImpl:
> http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/blocks/jsp/java/org/apache
>/cocoon/components/jsp/JSPEngineImpl.java?rev=1.7&content-type=text/vnd.view
>cvs-markup So if you know what to do ...

Yesterday I have played several hours with the JSPEngineImpl - with no result. 
If you have no deeper knowledge of Tomcat and how a JSP is processed it is 
really difficult to understand Tomcat and Cocoon work.

I would like to help, but now I am little bit frustrated. Is there anybody 
with knowledge of this stuff?

Marc


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


Re: Bug in JSPReader?

Posted by Joerg Heinicke <jo...@gmx.de>.
Anyone is always the first ;-) Maybe the others port their code to 
Cocoon processing instead of reusing legacy JSP.

But the HttpServletRequest implementation is only minimalistic in the 
JSPEngineImpl:
http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/blocks/jsp/java/org/apache/cocoon/components/jsp/JSPEngineImpl.java?rev=1.7&content-type=text/vnd.viewcvs-markup
So if you know what to do ...

Joerg

Marc Baumgartner wrote:

> Hello
> 
> 
>>There was something like a JSPFilter or so some time ago in Cocoon that
>>could be configured to be run on *.jsp requests (it is called at the end of
>>Cocoon processing), this can solve the problems with includes/forwards, but
>>you will be a little bit limiting compared to the current approach, though,
>>it's much more servlet spec. friendly.
>>
>>Another possible solution could be rewrite the HttpServletRequest wrapper
>>in JSPEngine (or JSPReader/JSPEngine, don't remember exactly) to substitue
>>Cocoon's paths with webapp context relative paths, so the JSP could work as
>>usual. This one is just a suggestion, I'm not sure that it's possible to do
>>easily.
> 
> 
> That sounds not good. First, it seems that Joergs patch works fine. But I am 
> not able to include and forward other jsp's. 
> 
> What have I to do to use the JSPFilter? If this does not work is there any 
> other solution than rewriting the HttpServletRequest? I really need a working 
> jsp-block :-(
> 
> Is there anybody else with the same problems? I can't imagine that nobody 
> wants to use jsp's in cocoon...
> 
> regards
> 	Marc


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


Re: Bug in JSPReader?

Posted by Marc Baumgartner <mo...@gmx.de>.
Hello

> There was something like a JSPFilter or so some time ago in Cocoon that
> could be configured to be run on *.jsp requests (it is called at the end of
> Cocoon processing), this can solve the problems with includes/forwards, but
> you will be a little bit limiting compared to the current approach, though,
> it's much more servlet spec. friendly.
>
> Another possible solution could be rewrite the HttpServletRequest wrapper
> in JSPEngine (or JSPReader/JSPEngine, don't remember exactly) to substitue
> Cocoon's paths with webapp context relative paths, so the JSP could work as
> usual. This one is just a suggestion, I'm not sure that it's possible to do
> easily.

That sounds not good. First, it seems that Joergs patch works fine. But I am 
not able to include and forward other jsp's. 

What have I to do to use the JSPFilter? If this does not work is there any 
other solution than rewriting the HttpServletRequest? I really need a working 
jsp-block :-(

Is there anybody else with the same problems? I can't imagine that nobody 
wants to use jsp's in cocoon...

regards
	Marc



>
> -- Konstantin
>
> > Regards
> > Marc
> >
> > > Regards,
> > >   Konstantin
> > >
> > > > Joerg
> > > >
> > > > Konstantin Piroumian wrote:
> > > > > This method is available from the Request object which is already
> > >
> > > available
> > >
> > > > > in JSPReader/JSPGenerator (it is retrieved using
> > >
> > > ObjectModel.getRequest() or
> > >
> > > > > something like that).
> > > > >
> > > > > Regards,
> > > > >   Konstantin
> > > > >
> > > > > From: "Marc Baumgartner" <mo...@gmx.de>
> > > > >
> > > > >>Okay, I will try to provide a patch. But I don't know the framework
> > > > >> very
> > > > >
> > > > > well,
> > > > >
> > > > >>so there are some questions:
> > > > >>
> > > > >>Which class contains the getSitemapURI function? How can I get
>
> class?
>
> > > > >>Regards
> > > > >>Marc
> > > > >>
> > > > >>Am Freitag, 1. August 2003 08:10 schrieb Konstantin Piroumian:
> > > > >>>Yes, that should be fixed. At the time of writing the JSPReader
>
> (and
>
> > > > >>>JSPGenerater as well) there were no any means for obtaining the
> > > > >>> current sitemap URI relative the web application context. Now
>
> there
>
> > > > >>> is
> > >
> > > something
> > >
> > > > >>>like getSitemapURI that can help with it.
> > > > >>>
> > > > >>>Please post a patch to Bugzilla if you fix this (also, please fix
>
> the
>
> > > > >>>JSPGenerator).
> > > > >>>
> > > > >>>Regards,
> > > > >>>  Konstantin Piroumian
> > > > >>>kpiroumian@apache.org
> > > > >>>
> > > > >>>----- Original Message -----
> > > > >>>From: "Marc Baumgartner" <mo...@gmx.de>
> > > > >>>To: <us...@cocoon.apache.org>
> > > > >>>Sent: Thursday, July 31, 2003 21:39
> > > > >>>Subject: Bug in JSPReader?
> > > > >>>
> > > > >>>
> > > > >>>Hello all,
> > > > >>>
> > > > >>>it seems that there is a bug in the JSPReader class?
> > > > >>>
> > > > >>>I have the following sitemap entry:
> > > > >>>
> > > > >>><map:match pattern="admin/*.jsp">
> > > > >>>  <map:read type="jsp" src="test/{1}.jsp" mime-type="text/html" />
> > > > >>></map:match>
> > > > >>>
> > > > >>>With entering the url "localhost:8080/cocoon/admin/hello.jsp" I
> > > > >>> get
>
> a
>
> > > > > error
> > > > >
> > > > >>>message that the ressource
> > > > >>> "localhost:8080/cocoon/test/admin/hello.jsp"
> > > > >
> > > > > can
> > > > >
> > > > >>>not be found.
> > > > >>>
> > > > >>>I am using tomcat 4.1.24 and have tried this with cocoon 2.04,
> > >
> > > 2.1m1-m3.
> > >
> > > > >>>I took a look at the sourcecode of the JSPReader and there are the
> > > > >>>following lines:
> > > > >>>
> > > > >>>// get current request path
> > > > >>>String servletPath = httpRequest.getServletPath();
> > > > >>>// remove file part
> > > > >>>servletPath = servletPath.substring(0,servletPath.lastIndexOf('/')
>
> +
>
> > > 1);
> > >
> > > > >>>url = servletPath + url;
> > > > >>>
> > > > >>>I call this URL: "localhost:8080/cocoon/admin/hello.jsp"
> > > > >>>
> > > > >>>The variable servletPath contains "/admin/hello.jsp".
> > > > >>>Then this path is reduced to "/admin/".
> > > > >>>The variable url contains the path to which we are mapping:
> > > > >>>"/test/hello.jsp".
> > > > >>>
> > > > >>>But the final url is "/admin/test/hello.jsp"
> > > > >>>
> > > > >>>From my point of view the variable servletPath has to contain the
>
> path
>
> > > > > the
> > > > >
> > > > >>>current subsitemap. In my case "/".
> > > > >>>
> > > > >>>Is this maybe a bug?
> > > > >>>
> > > > >>>regards
> > > > >>>Marc
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > > For additional commands, e-mail: users-help@cocoon.apache.org
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


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


Re: Bug in JSPReader?

Posted by Konstantin Piroumian <kp...@apache.org>.
From: "Marc Baumgartner" <mo...@gmx.de>

> Hello!
>
> > The problem is in the way the JSPEngine is implemented. It simply gets
an
> > URI and calls the JSP servlet with it. Obviously the JSP servlet knows
> > nothing about Cocoon's sitemaps or resolver and interprets all the
requests
> > either as an absolute path (but relative to the app context, e.g.
> > /myapp/jsp/welcome.jsp) or as a relative to the current request context
> > path, which is not always correspond??? to the real JSP file location
(e.g.
> > when you map a subsitemap to some URI).
> >
> > Hope my explanation was clear.
>
> That explains why a simple <jsp:include /> or <jsp:forward /> tag does not
> work. Is there a possible workaround?

There was something like a JSPFilter or so some time ago in Cocoon that
could be configured to be run on *.jsp requests (it is called at the end of
Cocoon processing), this can solve the problems with includes/forwards, but
you will be a little bit limiting compared to the current approach, though,
it's much more servlet spec. friendly.

Another possible solution could be rewrite the HttpServletRequest wrapper in
JSPEngine (or JSPReader/JSPEngine, don't remember exactly) to substitue
Cocoon's paths with webapp context relative paths, so the JSP could work as
usual. This one is just a suggestion, I'm not sure that it's possible to do
easily.

-- Konstantin

>
> Regards
> Marc
>
>
> >
> > Regards,
> >   Konstantin
> >
> > > Joerg
> > >
> > > Konstantin Piroumian wrote:
> > > > This method is available from the Request object which is already
> >
> > available
> >
> > > > in JSPReader/JSPGenerator (it is retrieved using
> >
> > ObjectModel.getRequest() or
> >
> > > > something like that).
> > > >
> > > > Regards,
> > > >   Konstantin
> > > >
> > > > From: "Marc Baumgartner" <mo...@gmx.de>
> > > >
> > > >>Okay, I will try to provide a patch. But I don't know the framework
> > > >> very
> > > >
> > > > well,
> > > >
> > > >>so there are some questions:
> > > >>
> > > >>Which class contains the getSitemapURI function? How can I get
class?
> > > >>
> > > >>Regards
> > > >>Marc
> > > >>
> > > >>Am Freitag, 1. August 2003 08:10 schrieb Konstantin Piroumian:
> > > >>>Yes, that should be fixed. At the time of writing the JSPReader
(and
> > > >>>JSPGenerater as well) there were no any means for obtaining the
> > > >>> current sitemap URI relative the web application context. Now
there
> > > >>> is
> >
> > something
> >
> > > >>>like getSitemapURI that can help with it.
> > > >>>
> > > >>>Please post a patch to Bugzilla if you fix this (also, please fix
the
> > > >>>JSPGenerator).
> > > >>>
> > > >>>Regards,
> > > >>>  Konstantin Piroumian
> > > >>>kpiroumian@apache.org
> > > >>>
> > > >>>----- Original Message -----
> > > >>>From: "Marc Baumgartner" <mo...@gmx.de>
> > > >>>To: <us...@cocoon.apache.org>
> > > >>>Sent: Thursday, July 31, 2003 21:39
> > > >>>Subject: Bug in JSPReader?
> > > >>>
> > > >>>
> > > >>>Hello all,
> > > >>>
> > > >>>it seems that there is a bug in the JSPReader class?
> > > >>>
> > > >>>I have the following sitemap entry:
> > > >>>
> > > >>><map:match pattern="admin/*.jsp">
> > > >>>  <map:read type="jsp" src="test/{1}.jsp" mime-type="text/html" />
> > > >>></map:match>
> > > >>>
> > > >>>With entering the url "localhost:8080/cocoon/admin/hello.jsp" I get
a
> > > >
> > > > error
> > > >
> > > >>>message that the ressource
> > > >>> "localhost:8080/cocoon/test/admin/hello.jsp"
> > > >
> > > > can
> > > >
> > > >>>not be found.
> > > >>>
> > > >>>I am using tomcat 4.1.24 and have tried this with cocoon 2.04,
> >
> > 2.1m1-m3.
> >
> > > >>>I took a look at the sourcecode of the JSPReader and there are the
> > > >>>following lines:
> > > >>>
> > > >>>// get current request path
> > > >>>String servletPath = httpRequest.getServletPath();
> > > >>>// remove file part
> > > >>>servletPath = servletPath.substring(0,servletPath.lastIndexOf('/')
+
> >
> > 1);
> >
> > > >>>url = servletPath + url;
> > > >>>
> > > >>>I call this URL: "localhost:8080/cocoon/admin/hello.jsp"
> > > >>>
> > > >>>The variable servletPath contains "/admin/hello.jsp".
> > > >>>Then this path is reduced to "/admin/".
> > > >>>The variable url contains the path to which we are mapping:
> > > >>>"/test/hello.jsp".
> > > >>>
> > > >>>But the final url is "/admin/test/hello.jsp"
> > > >>>
> > > >>>From my point of view the variable servletPath has to contain the
path
> > > >
> > > > the
> > > >
> > > >>>current subsitemap. In my case "/".
> > > >>>
> > > >>>Is this maybe a bug?
> > > >>>
> > > >>>regards
> > > >>>Marc
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


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


Re: Bug in JSPReader?

Posted by Marc Baumgartner <mo...@gmx.de>.
Hello!

> The problem is in the way the JSPEngine is implemented. It simply gets an
> URI and calls the JSP servlet with it. Obviously the JSP servlet knows
> nothing about Cocoon's sitemaps or resolver and interprets all the requests
> either as an absolute path (but relative to the app context, e.g.
> /myapp/jsp/welcome.jsp) or as a relative to the current request context
> path, which is not always correspond??? to the real JSP file location (e.g.
> when you map a subsitemap to some URI).
>
> Hope my explanation was clear.

That explains why a simple <jsp:include /> or <jsp:forward /> tag does not 
work. Is there a possible workaround?

Regards
	Marc


>
> Regards,
>   Konstantin
>
> > Joerg
> >
> > Konstantin Piroumian wrote:
> > > This method is available from the Request object which is already
>
> available
>
> > > in JSPReader/JSPGenerator (it is retrieved using
>
> ObjectModel.getRequest() or
>
> > > something like that).
> > >
> > > Regards,
> > >   Konstantin
> > >
> > > From: "Marc Baumgartner" <mo...@gmx.de>
> > >
> > >>Okay, I will try to provide a patch. But I don't know the framework
> > >> very
> > >
> > > well,
> > >
> > >>so there are some questions:
> > >>
> > >>Which class contains the getSitemapURI function? How can I get class?
> > >>
> > >>Regards
> > >>Marc
> > >>
> > >>Am Freitag, 1. August 2003 08:10 schrieb Konstantin Piroumian:
> > >>>Yes, that should be fixed. At the time of writing the JSPReader (and
> > >>>JSPGenerater as well) there were no any means for obtaining the
> > >>> current sitemap URI relative the web application context. Now there
> > >>> is
>
> something
>
> > >>>like getSitemapURI that can help with it.
> > >>>
> > >>>Please post a patch to Bugzilla if you fix this (also, please fix the
> > >>>JSPGenerator).
> > >>>
> > >>>Regards,
> > >>>  Konstantin Piroumian
> > >>>kpiroumian@apache.org
> > >>>
> > >>>----- Original Message -----
> > >>>From: "Marc Baumgartner" <mo...@gmx.de>
> > >>>To: <us...@cocoon.apache.org>
> > >>>Sent: Thursday, July 31, 2003 21:39
> > >>>Subject: Bug in JSPReader?
> > >>>
> > >>>
> > >>>Hello all,
> > >>>
> > >>>it seems that there is a bug in the JSPReader class?
> > >>>
> > >>>I have the following sitemap entry:
> > >>>
> > >>><map:match pattern="admin/*.jsp">
> > >>>  <map:read type="jsp" src="test/{1}.jsp" mime-type="text/html" />
> > >>></map:match>
> > >>>
> > >>>With entering the url "localhost:8080/cocoon/admin/hello.jsp" I get a
> > >
> > > error
> > >
> > >>>message that the ressource
> > >>> "localhost:8080/cocoon/test/admin/hello.jsp"
> > >
> > > can
> > >
> > >>>not be found.
> > >>>
> > >>>I am using tomcat 4.1.24 and have tried this with cocoon 2.04,
>
> 2.1m1-m3.
>
> > >>>I took a look at the sourcecode of the JSPReader and there are the
> > >>>following lines:
> > >>>
> > >>>// get current request path
> > >>>String servletPath = httpRequest.getServletPath();
> > >>>// remove file part
> > >>>servletPath = servletPath.substring(0,servletPath.lastIndexOf('/') +
>
> 1);
>
> > >>>url = servletPath + url;
> > >>>
> > >>>I call this URL: "localhost:8080/cocoon/admin/hello.jsp"
> > >>>
> > >>>The variable servletPath contains "/admin/hello.jsp".
> > >>>Then this path is reduced to "/admin/".
> > >>>The variable url contains the path to which we are mapping:
> > >>>"/test/hello.jsp".
> > >>>
> > >>>But the final url is "/admin/test/hello.jsp"
> > >>>
> > >>>From my point of view the variable servletPath has to contain the path
> > >
> > > the
> > >
> > >>>current subsitemap. In my case "/".
> > >>>
> > >>>Is this maybe a bug?
> > >>>
> > >>>regards
> > >>>Marc
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


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


Re: Bug in JSPReader?

Posted by Konstantin Piroumian <kp...@apache.org>.
From: "Joerg Heinicke" <jo...@gmx.de>

> I have already fixed it and committed it a few minutes ago.
> Thanks, Marc, for spotting the error and, Konstantin, for the hints how
> to patch it. I tested it with the JSP samples, I moved those pipelines
> to the blocks sitemap, so that I have "jsp/welcome.jsp" or similar as
> sitemap URI. It seems to work, but maybe you can have a look on it.
>
> Why does our standard resolving not work? I tested first with something
> like resolver.resolveURI(), but got 404 errors. The JSP engine seems not
> to like JSP files outside of the current servlet's context.

The problem is in the way the JSPEngine is implemented. It simply gets an
URI and calls the JSP servlet with it. Obviously the JSP servlet knows
nothing about Cocoon's sitemaps or resolver and interprets all the requests
either as an absolute path (but relative to the app context, e.g.
/myapp/jsp/welcome.jsp) or as a relative to the current request context
path, which is not always correspond??? to the real JSP file location (e.g.
when you map a subsitemap to some URI).

Hope my explanation was clear.

Regards,
  Konstantin

>
> Joerg
>
> Konstantin Piroumian wrote:
> > This method is available from the Request object which is already
available
> > in JSPReader/JSPGenerator (it is retrieved using
ObjectModel.getRequest() or
> > something like that).
> >
> > Regards,
> >   Konstantin
> >
> > From: "Marc Baumgartner" <mo...@gmx.de>
> >
> >
> >>Okay, I will try to provide a patch. But I don't know the framework very
> >
> > well,
> >
> >>so there are some questions:
> >>
> >>Which class contains the getSitemapURI function? How can I get class?
> >>
> >>Regards
> >>Marc
> >>
> >>
> >>Am Freitag, 1. August 2003 08:10 schrieb Konstantin Piroumian:
> >>
> >>>Yes, that should be fixed. At the time of writing the JSPReader (and
> >>>JSPGenerater as well) there were no any means for obtaining the current
> >>>sitemap URI relative the web application context. Now there is
something
> >>>like getSitemapURI that can help with it.
> >>>
> >>>Please post a patch to Bugzilla if you fix this (also, please fix the
> >>>JSPGenerator).
> >>>
> >>>Regards,
> >>>  Konstantin Piroumian
> >>>kpiroumian@apache.org
> >>>
> >>>----- Original Message -----
> >>>From: "Marc Baumgartner" <mo...@gmx.de>
> >>>To: <us...@cocoon.apache.org>
> >>>Sent: Thursday, July 31, 2003 21:39
> >>>Subject: Bug in JSPReader?
> >>>
> >>>
> >>>Hello all,
> >>>
> >>>it seems that there is a bug in the JSPReader class?
> >>>
> >>>I have the following sitemap entry:
> >>>
> >>><map:match pattern="admin/*.jsp">
> >>>  <map:read type="jsp" src="test/{1}.jsp" mime-type="text/html" />
> >>></map:match>
> >>>
> >>>With entering the url "localhost:8080/cocoon/admin/hello.jsp" I get a
> >
> > error
> >
> >>>message that the ressource "localhost:8080/cocoon/test/admin/hello.jsp"
> >
> > can
> >
> >>>not be found.
> >>>
> >>>I am using tomcat 4.1.24 and have tried this with cocoon 2.04,
2.1m1-m3.
> >>>
> >>>I took a look at the sourcecode of the JSPReader and there are the
> >>>following lines:
> >>>
> >>>// get current request path
> >>>String servletPath = httpRequest.getServletPath();
> >>>// remove file part
> >>>servletPath = servletPath.substring(0,servletPath.lastIndexOf('/') +
1);
> >>>url = servletPath + url;
> >>>
> >>>I call this URL: "localhost:8080/cocoon/admin/hello.jsp"
> >>>
> >>>The variable servletPath contains "/admin/hello.jsp".
> >>>Then this path is reduced to "/admin/".
> >>>The variable url contains the path to which we are mapping:
> >>>"/test/hello.jsp".
> >>>
> >>>But the final url is "/admin/test/hello.jsp"
> >>>
> >>>From my point of view the variable servletPath has to contain the path
> >
> > the
> >
> >>>current subsitemap. In my case "/".
> >>>
> >>>Is this maybe a bug?
> >>>
> >>>regards
> >>>Marc
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


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


Re: Bug in JSPReader?

Posted by Joerg Heinicke <jo...@gmx.de>.
I have already fixed it and committed it a few minutes ago.
Thanks, Marc, for spotting the error and, Konstantin, for the hints how 
to patch it. I tested it with the JSP samples, I moved those pipelines 
to the blocks sitemap, so that I have "jsp/welcome.jsp" or similar as 
sitemap URI. It seems to work, but maybe you can have a look on it.

Why does our standard resolving not work? I tested first with something 
like resolver.resolveURI(), but got 404 errors. The JSP engine seems not 
to like JSP files outside of the current servlet's context.

Joerg

Konstantin Piroumian wrote:
> This method is available from the Request object which is already available
> in JSPReader/JSPGenerator (it is retrieved using ObjectModel.getRequest() or
> something like that).
> 
> Regards,
>   Konstantin
> 
> From: "Marc Baumgartner" <mo...@gmx.de>
> 
> 
>>Okay, I will try to provide a patch. But I don't know the framework very
> 
> well,
> 
>>so there are some questions:
>>
>>Which class contains the getSitemapURI function? How can I get class?
>>
>>Regards
>>Marc
>>
>>
>>Am Freitag, 1. August 2003 08:10 schrieb Konstantin Piroumian:
>>
>>>Yes, that should be fixed. At the time of writing the JSPReader (and
>>>JSPGenerater as well) there were no any means for obtaining the current
>>>sitemap URI relative the web application context. Now there is something
>>>like getSitemapURI that can help with it.
>>>
>>>Please post a patch to Bugzilla if you fix this (also, please fix the
>>>JSPGenerator).
>>>
>>>Regards,
>>>  Konstantin Piroumian
>>>kpiroumian@apache.org
>>>
>>>----- Original Message -----
>>>From: "Marc Baumgartner" <mo...@gmx.de>
>>>To: <us...@cocoon.apache.org>
>>>Sent: Thursday, July 31, 2003 21:39
>>>Subject: Bug in JSPReader?
>>>
>>>
>>>Hello all,
>>>
>>>it seems that there is a bug in the JSPReader class?
>>>
>>>I have the following sitemap entry:
>>>
>>><map:match pattern="admin/*.jsp">
>>>  <map:read type="jsp" src="test/{1}.jsp" mime-type="text/html" />
>>></map:match>
>>>
>>>With entering the url "localhost:8080/cocoon/admin/hello.jsp" I get a
> 
> error
> 
>>>message that the ressource "localhost:8080/cocoon/test/admin/hello.jsp"
> 
> can
> 
>>>not be found.
>>>
>>>I am using tomcat 4.1.24 and have tried this with cocoon 2.04, 2.1m1-m3.
>>>
>>>I took a look at the sourcecode of the JSPReader and there are the
>>>following lines:
>>>
>>>// get current request path
>>>String servletPath = httpRequest.getServletPath();
>>>// remove file part
>>>servletPath = servletPath.substring(0,servletPath.lastIndexOf('/') + 1);
>>>url = servletPath + url;
>>>
>>>I call this URL: "localhost:8080/cocoon/admin/hello.jsp"
>>>
>>>The variable servletPath contains "/admin/hello.jsp".
>>>Then this path is reduced to "/admin/".
>>>The variable url contains the path to which we are mapping:
>>>"/test/hello.jsp".
>>>
>>>But the final url is "/admin/test/hello.jsp"
>>>
>>>>From my point of view the variable servletPath has to contain the path
> 
> the
> 
>>>current subsitemap. In my case "/".
>>>
>>>Is this maybe a bug?
>>>
>>>regards
>>>Marc


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


Re: Bug in JSPReader?

Posted by Konstantin Piroumian <kp...@apache.org>.
This method is available from the Request object which is already available
in JSPReader/JSPGenerator (it is retrieved using ObjectModel.getRequest() or
something like that).

Regards,
  Konstantin

From: "Marc Baumgartner" <mo...@gmx.de>


> Okay, I will try to provide a patch. But I don't know the framework very
well,
> so there are some questions:
>
> Which class contains the getSitemapURI function? How can I get class?
>
> Regards
> Marc
>
>
> Am Freitag, 1. August 2003 08:10 schrieb Konstantin Piroumian:
> > Yes, that should be fixed. At the time of writing the JSPReader (and
> > JSPGenerater as well) there were no any means for obtaining the current
> > sitemap URI relative the web application context. Now there is something
> > like getSitemapURI that can help with it.
> >
> > Please post a patch to Bugzilla if you fix this (also, please fix the
> > JSPGenerator).
> >
> > Regards,
> >   Konstantin Piroumian
> > kpiroumian@apache.org
> >
> > ----- Original Message -----
> > From: "Marc Baumgartner" <mo...@gmx.de>
> > To: <us...@cocoon.apache.org>
> > Sent: Thursday, July 31, 2003 21:39
> > Subject: Bug in JSPReader?
> >
> >
> > Hello all,
> >
> > it seems that there is a bug in the JSPReader class?
> >
> > I have the following sitemap entry:
> >
> > <map:match pattern="admin/*.jsp">
> >   <map:read type="jsp" src="test/{1}.jsp" mime-type="text/html" />
> > </map:match>
> >
> > With entering the url "localhost:8080/cocoon/admin/hello.jsp" I get a
error
> > message that the ressource "localhost:8080/cocoon/test/admin/hello.jsp"
can
> > not be found.
> >
> > I am using tomcat 4.1.24 and have tried this with cocoon 2.04, 2.1m1-m3.
> >
> > I took a look at the sourcecode of the JSPReader and there are the
> > following lines:
> >
> > // get current request path
> > String servletPath = httpRequest.getServletPath();
> > // remove file part
> > servletPath = servletPath.substring(0,servletPath.lastIndexOf('/') + 1);
> > url = servletPath + url;
> >
> > I call this URL: "localhost:8080/cocoon/admin/hello.jsp"
> >
> > The variable servletPath contains "/admin/hello.jsp".
> > Then this path is reduced to "/admin/".
> > The variable url contains the path to which we are mapping:
> > "/test/hello.jsp".
> >
> > But the final url is "/admin/test/hello.jsp"
> >
> > From my point of view the variable servletPath has to contain the path
the
> > current subsitemap. In my case "/".
> >
> > Is this maybe a bug?
> >
> > regards
> > Marc
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


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


Re: Bug in JSPReader?

Posted by Marc Baumgartner <mo...@gmx.de>.
Okay, I will try to provide a patch. But I don't know the framework very well, 
so there are some questions:

Which class contains the getSitemapURI function? How can I get class?

Regards
	Marc


Am Freitag, 1. August 2003 08:10 schrieb Konstantin Piroumian:
> Yes, that should be fixed. At the time of writing the JSPReader (and
> JSPGenerater as well) there were no any means for obtaining the current
> sitemap URI relative the web application context. Now there is something
> like getSitemapURI that can help with it.
>
> Please post a patch to Bugzilla if you fix this (also, please fix the
> JSPGenerator).
>
> Regards,
>   Konstantin Piroumian
> kpiroumian@apache.org
>
> ----- Original Message -----
> From: "Marc Baumgartner" <mo...@gmx.de>
> To: <us...@cocoon.apache.org>
> Sent: Thursday, July 31, 2003 21:39
> Subject: Bug in JSPReader?
>
>
> Hello all,
>
> it seems that there is a bug in the JSPReader class?
>
> I have the following sitemap entry:
>
> <map:match pattern="admin/*.jsp">
>   <map:read type="jsp" src="test/{1}.jsp" mime-type="text/html" />
> </map:match>
>
> With entering the url "localhost:8080/cocoon/admin/hello.jsp" I get a error
> message that the ressource "localhost:8080/cocoon/test/admin/hello.jsp" can
> not be found.
>
> I am using tomcat 4.1.24 and have tried this with cocoon 2.04, 2.1m1-m3.
>
> I took a look at the sourcecode of the JSPReader and there are the
> following lines:
>
> // get current request path
> String servletPath = httpRequest.getServletPath();
> // remove file part
> servletPath = servletPath.substring(0,servletPath.lastIndexOf('/') + 1);
> url = servletPath + url;
>
> I call this URL: "localhost:8080/cocoon/admin/hello.jsp"
>
> The variable servletPath contains "/admin/hello.jsp".
> Then this path is reduced to "/admin/".
> The variable url contains the path to which we are mapping:
> "/test/hello.jsp".
>
> But the final url is "/admin/test/hello.jsp"
>
> From my point of view the variable servletPath has to contain the path the
> current subsitemap. In my case "/".
>
> Is this maybe a bug?
>
> regards
> Marc
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


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


Re: Bug in JSPReader?

Posted by Konstantin Piroumian <kp...@apache.org>.
Yes, that should be fixed. At the time of writing the JSPReader (and
JSPGenerater as well) there were no any means for obtaining the current
sitemap URI relative the web application context. Now there is something
like getSitemapURI that can help with it.

Please post a patch to Bugzilla if you fix this (also, please fix the
JSPGenerator).

Regards,
  Konstantin Piroumian
kpiroumian@apache.org

----- Original Message ----- 
From: "Marc Baumgartner" <mo...@gmx.de>
To: <us...@cocoon.apache.org>
Sent: Thursday, July 31, 2003 21:39
Subject: Bug in JSPReader?


Hello all,

it seems that there is a bug in the JSPReader class?

I have the following sitemap entry:

<map:match pattern="admin/*.jsp">
  <map:read type="jsp" src="test/{1}.jsp" mime-type="text/html" />
</map:match>

With entering the url "localhost:8080/cocoon/admin/hello.jsp" I get a error
message that the ressource "localhost:8080/cocoon/test/admin/hello.jsp" can
not be found.

I am using tomcat 4.1.24 and have tried this with cocoon 2.04, 2.1m1-m3.

I took a look at the sourcecode of the JSPReader and there are the following
lines:

// get current request path
String servletPath = httpRequest.getServletPath();
// remove file part
servletPath = servletPath.substring(0,servletPath.lastIndexOf('/') + 1);
url = servletPath + url;

I call this URL: "localhost:8080/cocoon/admin/hello.jsp"

The variable servletPath contains "/admin/hello.jsp".
Then this path is reduced to "/admin/".
The variable url contains the path to which we are mapping:
"/test/hello.jsp".

But the final url is "/admin/test/hello.jsp"

>From my point of view the variable servletPath has to contain the path the
current subsitemap. In my case "/".

Is this maybe a bug?

regards
Marc




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



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