Hi, dims and team!
I am working on a JSPReader, which will allow to output a JSP page generated
content from the sitemap (not XML!). This will allow to use C2 as a
controller servlet (controlled by the sitemap), but use JSP in its usual
way: outputting HTML.
And I have a few questions about the JSPEngine implementations:
The first question is about the MyServletRequest and MyServletResponse
classes. Is there a reason that they don't extend HttpServletRequest and
...Response classes but implement interfaces completely? Wouldn't it be
better and easier just to extend those classes and override needed methods?
As I can see, JSPEngine returns byte array. Wouldn't it be better to have a
possibility to specify an output stream for JSP servlet? Just a though, I
have to look at it more carefully.
Another problem with the source path. JSP engine uses the real file path to
open the source, but when I specify something like context://jsp/welcome.jsp
then I get a Protocol not supported error. If I remove the check for
"file:/" prefix I get another error: File not found (the app context path is
appended twice). If I use a relative path 'jsp/welcome.jsp' then the path
resolves correctly but JspServlet returns File not found error.
I've attached the source, if anybody is interested. To make it work with
Tomcat 3.3 I had to copy jasper.jar and servlet.jar to
context://WEB-INF/lib. And added this lines to sitemap:
<map:match pattern="test/*.htm">
<map:read src="/jsp/{1}.jsp" type="jsp" mime-type="text/html"/>
</map:match>
Currently, this is the only way to get it running correctly.
Are there any suggestion/comments how to change/improve JSPEngine to be used
not only for a generator, but in any case, when an output from JSP page is
needed, particularly, in JSPReader.
Regards,
Konstantin Piroumian.
JSPReader.java
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]