Alberto:

Maybe I'm missing something here but couldn't you simply
 intercept the response output stream and redirect it to a file?

Have you tried using a filter?

Alternatively, ou may be able to do this by 'including'
your jsp from a servlet or another jsp.

One last thought. Tag libraries have the ability to intercept 'body content'
that appears between the corresponding opening and closing tags.

    BodyContent body = getBodyContent();
    String bodyOfCaptureTag = body.getString();
    // write bodyOfCaptureTag to file here...

You could create a simple BodyTagSupport taglib object, use this tag in
a new jsp that you create that looks something like this.

<MyCaptureTag><jsp:include page="TheRealUrlGoesHere"/></MyCaptureTag>

This is a little bizarre, but should even work with Tomcat 3.1 .

Tom
----- Original Message -----
From: "Alberto Romei" <[EMAIL PROTECTED]>
To: "Tomcat Developers List" <[EMAIL PROTECTED]>
Sent: Wednesday, November 28, 2001 2:34 AM
Subject: Re: Info on customizing jspc - jasper


| Hi, and many thanks for the replies.
| Using <%@page extends="my.jsp.page.class" %> allows me to change only the
| name of the superclass for my JSP, but i need to do more than this.
| I need to change all the fixed lines of the generated code.
| For example, i would like to change:
|
|     public void _jspService(HttpServletRequest request,
HttpServletResponse
| response)
| in
|     public void _jspService(MyParam p1, String  s, int n)
|
| or substituting
|         JspFactory _jspxFactory = null;
| with
|         String name = "X";
|
| and so on...
|
| The other solution proposed by Mike is good, but HttpServletResponse needs
a
| ServletOutputStream, and the generated servlet calls getPageContext()
which
| takes my request and response objects, so i guess my implementation will
not
| be so straightforward. Anyway, i think i'll try this way.
|
| If you have other ideas, please let me know
|
| Thanks
| Alberto
|
| ----- Original Message -----
| From: "Bill Barker" <[EMAIL PROTECTED]>
| To: "Tomcat Developers List" <[EMAIL PROTECTED]>
| Sent: Tuesday, November 27, 2001 8:27 PM
| Subject: Re: Info on customizing jspc - jasper
|
|
| > This is off-topic for the dev list.  You'll probably get a better
response
| > from [EMAIL PROTECTED]
| >
| > What you want is <@page extends="my.jsp.page.class" %>
| > ----- Original Message -----
| > From: "Alberto Romei" <[EMAIL PROTECTED]>
| > To: <[EMAIL PROTECTED]>
| > Sent: Tuesday, November 27, 2001 10:32 AM
| > Subject: Info on customizing jspc - jasper
| >
| >
| > > I wanted to use JspC to generate a java program (not exactly a
servlet)
| > > which writes its output to a file on the disk instead of the
| > > HttpServletResponse's JspWriter.
| > >
| > > In practice, i just need to customize the fixed parts of the generated
| > code
| > > like:
| > >
| > >     public class Foo extends HttpJspBase {
| > >
| > > or
| > >
| > >     public void _jspService(HttpServletRequest request,
| > HttpServletResponse
| > > response)
| > >         throws java.io.IOException, ServletException {
| > >
| > > From what i've seen, i could simply substitute JspParseEventListener
in
| > the
| > > jasper jars, but in this way i would "throw away" the normal
processing
| of
| > > JSPs.
| > >
| > > So, what is the correct way to customize the JSP compilation ?
| > > Must i subclass org.apache.jasper.compiler.Compiler and call
| > > MyCompiler.something() instead of jspc.parseFiles() ? (that would be a
| lot
| > > of work... )
| > > If so, is there any kind of documentation on how to correctly write a
| > custom
| > > JSP compiler ? (possibly working with future versions of tomcat, too)
| > >
| > > Any suggestion is appreciated.
| > >
| > > Thanks
| > >
| > > Alberto
| > >
| > > P.S.
| > > I'm new to tomcat source, so please be patient.
| > >
| > >
| > >
| > > --
| > > To unsubscribe, e-mail:
| > <mailto:[EMAIL PROTECTED]>
| > > For additional commands, e-mail:
| > <mailto:[EMAIL PROTECTED]>
| > >
| >
| >
| > *----*
| >
| > This message is intended only for the use of the person(s) listed above
| > as the intended recipient(s), and may contain information that is
| > PRIVILEGED and CONFIDENTIAL.  If you are not an intended recipient,
| > you may not read, copy, or distribute this message or any attachment.
| > If you received this communication in error, please notify us
immediately
| > by e-mail and then delete all copies of this message and any
attachments.
| >
| >
| > In addition you should be aware that ordinary (unencrypted) e-mail sent
| > through the Internet is not secure. Do not send confidential or
sensitive
| > information, such as social security numbers, account numbers, personal
| > identification numbers and passwords, to us via ordinary (unencrypted)
| > e-mail.
| >
| > --
| > To unsubscribe, e-mail:
| <mailto:[EMAIL PROTECTED]>
| > For additional commands, e-mail:
| <mailto:[EMAIL PROTECTED]>
| >
|
|
|
| --
| To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
| For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
|
|
|


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to