Capturing HTML using Tomcat 4

2004-10-06 Thread David Wall
I've been looking through archives and such for examples of how to capture
the HTML output from a given JSP programmatically so I can archive or do
other things with that HTML.  For example, we might do this to record the
text of an agreement that was displayed to a user, in which a JSP generated
the agreement HTML page.  The pages may be generated from either HTTP GET or
POST.

It would be nice to perhaps just have a servlet "include" the response from
a JSP, passing along the GET/POST request to that JSP, but then have the
servlet capture the JSP's response in a string for processing/storage.
O'Reilly has a caching servlet that may help, but I was wondering if anybody
had come out with an elegant way to do this.

Thanks,
David


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



RE: Capturing HTML using Tomcat 4

2004-10-06 Thread Robert Harper
One way is to write a servlet that builds the html and before you finish with
the response, save the text into a table and then send the response.

Robert S. Harper
801.265.8800 ex. 255
> -Original Message-
> From: David Wall [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 06, 2004 4:10 PM
> To: [EMAIL PROTECTED]
> Subject: Capturing HTML using Tomcat 4
> 
> I've been looking through archives and such for examples of how to capture
> the HTML output from a given JSP programmatically so I can archive or do
> other things with that HTML.  For example, we might do this to record the
> text of an agreement that was displayed to a user, in which a JSP generated
> the agreement HTML page.  The pages may be generated from either HTTP GET or
> POST.
> 
> It would be nice to perhaps just have a servlet "include" the response from
> a JSP, passing along the GET/POST request to that JSP, but then have the
> servlet capture the JSP's response in a string for processing/storage.
> O'Reilly has a caching servlet that may help, but I was wondering if anybody
> had come out with an elegant way to do this.
> 
> Thanks,
> David
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 




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



Re: Capturing HTML using Tomcat 4

2004-10-06 Thread David Wall
That's not as "nice" only because most of the pages to be captured are JSPs,
and converting the JSP to a servlet for this purpose would defeat much of
the beauty of JSPs.  I saw a listing for using a "capture JSP tag" at
http://www.jguru.com/faq/view.jsp?EID=304022 that seems kind of interesting.
Of course, if this works well, it would only work on JSPs in which the tag
could be placed.

David

- Original Message - 
From: "Robert Harper" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <[EMAIL PROTECTED]>; "'David Wall'"
<[EMAIL PROTECTED]>
Sent: Wednesday, October 06, 2004 3:20 PM
Subject: RE: Capturing HTML using Tomcat 4


> One way is to write a servlet that builds the html and before you finish
with
> the response, save the text into a table and then send the response.
>
> Robert S. Harper
> 801.265.8800 ex. 255
> > -Original Message-
> > From: David Wall [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, October 06, 2004 4:10 PM
> > To: [EMAIL PROTECTED]
> > Subject: Capturing HTML using Tomcat 4
> >
> > I've been looking through archives and such for examples of how to
capture
> > the HTML output from a given JSP programmatically so I can archive or do
> > other things with that HTML.  For example, we might do this to record
the
> > text of an agreement that was displayed to a user, in which a JSP
generated
> > the agreement HTML page.  The pages may be generated from either HTTP
GET or
> > POST.
> >
> > It would be nice to perhaps just have a servlet "include" the response
from
> > a JSP, passing along the GET/POST request to that JSP, but then have the
> > servlet capture the JSP's response in a string for processing/storage.
> > O'Reilly has a caching servlet that may help, but I was wondering if
anybody
> > had come out with an elegant way to do this.
> >
> > Thanks,
> > David
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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



RE: Capturing HTML using Tomcat 4

2004-10-06 Thread Mike Curwen
Could a filter do the job?

response wrapping always seems scarey to me, but it should be possible to
wrap all the requests for a given URL space (so for example, anything that
might conveniently fall under the /agreement/* URL space), and after your
call to doChain, you can extract and persist a copy of the HTML response.
 
No touching the existing pages, you only need to map the correct URLs (and
there can be multiple ones, of course).


> -Original Message-
> From: David Wall [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, October 06, 2004 6:03 PM
> To: 'Tomcat Users List'
> Subject: Re: Capturing HTML using Tomcat 4
> 
> 
> That's not as "nice" only because most of the pages to be 
> captured are JSPs, and converting the JSP to a servlet for 
> this purpose would defeat much of the beauty of JSPs.  I saw 
> a listing for using a "capture JSP tag" at 
> http://www.jguru.com/faq/view.jsp?EID=304022 that seems kind 
> of interesting. Of course, if this works well, it would only 
> work on JSPs in which the tag could be placed.
> 
> David
> 
> - Original Message - 
> From: "Robert Harper" <[EMAIL PROTECTED]>
> To: "'Tomcat Users List'" <[EMAIL PROTECTED]>; 
> "'David Wall'" <[EMAIL PROTECTED]>
> Sent: Wednesday, October 06, 2004 3:20 PM
> Subject: RE: Capturing HTML using Tomcat 4
> 
> 
> > One way is to write a servlet that builds the html and before you 
> > finish
> with
> > the response, save the text into a table and then send the response.
> >
> > Robert S. Harper
> > 801.265.8800 ex. 255
> > > -Original Message-
> > > From: David Wall [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, October 06, 2004 4:10 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Capturing HTML using Tomcat 4
> > >
> > > I've been looking through archives and such for examples of how to
> capture
> > > the HTML output from a given JSP programmatically so I 
> can archive 
> > > or do other things with that HTML.  For example, we might 
> do this to 
> > > record
> the
> > > text of an agreement that was displayed to a user, in which a JSP
> generated
> > > the agreement HTML page.  The pages may be generated from either 
> > > HTTP
> GET or
> > > POST.
> > >
> > > It would be nice to perhaps just have a servlet "include" the 
> > > response
> from
> > > a JSP, passing along the GET/POST request to that JSP, 
> but then have 
> > > the servlet capture the JSP's response in a string for 
> > > processing/storage. O'Reilly has a caching servlet that may help, 
> > > but I was wondering if
> anybody
> > > had come out with an elegant way to do this.
> > >
> > > Thanks,
> > > David
> > >
> > >
> > > 
> 
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: 
> [EMAIL PROTECTED]
> > >
> >
> >
> >
> >
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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



RE: Capturing HTML using Tomcat 4

2004-10-06 Thread Mike Curwen
oops.  I meant ".. it should be possible to **filter** all the requests..." 

:o



> -Original Message-
> From: Mike Curwen [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, October 06, 2004 6:24 PM
> To: 'Tomcat Users List'; 'David Wall'
> Subject: RE: Capturing HTML using Tomcat 4
> 
> 
> Could a filter do the job?
> 
> response wrapping always seems scarey to me, but it should be 
> possible to wrap all the requests for a given URL space (so 
> for example, anything that might conveniently fall under the 
> /agreement/* URL space), and after your call to doChain, you 
> can extract and persist a copy of the HTML response.
>  
> No touching the existing pages, you only need to map the 
> correct URLs (and there can be multiple ones, of course).
> 
> 


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



RE: Capturing HTML using Tomcat 4

2004-10-06 Thread Ben Souther
> Could a filter do the job?
Yes, it most certainly could.

If your interested, I wrote one and packaged into a war file.
http://ben.souther.us/capture.war

It should be enough to get you started.


On Wed, 2004-10-06 at 19:23, Mike Curwen wrote:
> Could a filter do the job?
> 
> response wrapping always seems scarey to me, but it should be possible to
> wrap all the requests for a given URL space (so for example, anything that
> might conveniently fall under the /agreement/* URL space), and after your
> call to doChain, you can extract and persist a copy of the HTML response.
>  
> No touching the existing pages, you only need to map the correct URLs (and
> there can be multiple ones, of course).
> 
> 
> > -Original Message-
> > From: David Wall [mailto:[EMAIL PROTECTED] 
> > Sent: Wednesday, October 06, 2004 6:03 PM
> > To: 'Tomcat Users List'
> > Subject: Re: Capturing HTML using Tomcat 4
> > 
> > 
> > That's not as "nice" only because most of the pages to be 
> > captured are JSPs, and converting the JSP to a servlet for 
> > this purpose would defeat much of the beauty of JSPs.  I saw 
> > a listing for using a "capture JSP tag" at 
> > http://www.jguru.com/faq/view.jsp?EID=304022 that seems kind 
> > of interesting. Of course, if this works well, it would only 
> > work on JSPs in which the tag could be placed.
> > 
> > David
> > 
> > - Original Message - 
> > From: "Robert Harper" <[EMAIL PROTECTED]>
> > To: "'Tomcat Users List'" <[EMAIL PROTECTED]>; 
> > "'David Wall'" <[EMAIL PROTECTED]>
> > Sent: Wednesday, October 06, 2004 3:20 PM
> > Subject: RE: Capturing HTML using Tomcat 4
> > 
> > 
> > > One way is to write a servlet that builds the html and before you 
> > > finish
> > with
> > > the response, save the text into a table and then send the response.
> > >
> > > Robert S. Harper
> > > 801.265.8800 ex. 255
> > > > -Original Message-
> > > > From: David Wall [mailto:[EMAIL PROTECTED]
> > > > Sent: Wednesday, October 06, 2004 4:10 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Capturing HTML using Tomcat 4
> > > >
> > > > I've been looking through archives and such for examples of how to
> > capture
> > > > the HTML output from a given JSP programmatically so I 
> > can archive 
> > > > or do other things with that HTML.  For example, we might 
> > do this to 
> > > > record
> > the
> > > > text of an agreement that was displayed to a user, in which a JSP
> > generated
> > > > the agreement HTML page.  The pages may be generated from either 
> > > > HTTP
> > GET or
> > > > POST.
> > > >
> > > > It would be nice to perhaps just have a servlet "include" the 
> > > > response
> > from
> > > > a JSP, passing along the GET/POST request to that JSP, 
> > but then have 
> > > > the servlet capture the JSP's response in a string for 
> > > > processing/storage. O'Reilly has a caching servlet that may help, 
> > > > but I was wondering if
> > anybody
> > > > had come out with an elegant way to do this.
> > > >
> > > > Thanks,
> > > > David
> > > >
> > > >
> > > > 
> > 
> > > > -
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: 
> > [EMAIL PROTECTED]
> > > >
> > >
> > >
> > >
> > >
> > > 
> > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


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



RE: Capturing HTML using Tomcat 4

2004-10-06 Thread Ben Souther
> Could a filter do the job?
Yes, it most certainly could.

If your interested, I wrote one and packaged into a war file.
It prints all the servlet output of the index.jsp page from the ROOT
application that ships with tomcat to standard out.
http://ben.souther.us/capture.war

It should be enough to get you started.


On Wed, 2004-10-06 at 19:23, Mike Curwen wrote:
> Could a filter do the job?
> 
> response wrapping always seems scarey to me, but it should be possible to
> wrap all the requests for a given URL space (so for example, anything that
> might conveniently fall under the /agreement/* URL space), and after your
> call to doChain, you can extract and persist a copy of the HTML response.
>  
> No touching the existing pages, you only need to map the correct URLs (and
> there can be multiple ones, of course).
> 
> 
> > -Original Message-
> > From: David Wall [mailto:[EMAIL PROTECTED] 
> > Sent: Wednesday, October 06, 2004 6:03 PM
> > To: 'Tomcat Users List'
> > Subject: Re: Capturing HTML using Tomcat 4
> > 
> > 
> > That's not as "nice" only because most of the pages to be 
> > captured are JSPs, and converting the JSP to a servlet for 
> > this purpose would defeat much of the beauty of JSPs.  I saw 
> > a listing for using a "capture JSP tag" at 
> > http://www.jguru.com/faq/view.jsp?EID=304022 that seems kind 
> > of interesting. Of course, if this works well, it would only 
> > work on JSPs in which the tag could be placed.
> > 
> > David
> > 
> > - Original Message - 
> > From: "Robert Harper" <[EMAIL PROTECTED]>
> > To: "'Tomcat Users List'" <[EMAIL PROTECTED]>; 
> > "'David Wall'" <[EMAIL PROTECTED]>
> > Sent: Wednesday, October 06, 2004 3:20 PM
> > Subject: RE: Capturing HTML using Tomcat 4
> > 
> > 
> > > One way is to write a servlet that builds the html and before you 
> > > finish
> > with
> > > the response, save the text into a table and then send the response.
> > >
> > > Robert S. Harper
> > > 801.265.8800 ex. 255
> > > > -Original Message-
> > > > From: David Wall [mailto:[EMAIL PROTECTED]
> > > > Sent: Wednesday, October 06, 2004 4:10 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Capturing HTML using Tomcat 4
> > > >
> > > > I've been looking through archives and such for examples of how to
> > capture
> > > > the HTML output from a given JSP programmatically so I 
> > can archive 
> > > > or do other things with that HTML.  For example, we might 
> > do this to 
> > > > record
> > the
> > > > text of an agreement that was displayed to a user, in which a JSP
> > generated
> > > > the agreement HTML page.  The pages may be generated from either 
> > > > HTTP
> > GET or
> > > > POST.
> > > >
> > > > It would be nice to perhaps just have a servlet "include" the 
> > > > response
> > from
> > > > a JSP, passing along the GET/POST request to that JSP, 
> > but then have 
> > > > the servlet capture the JSP's response in a string for 
> > > > processing/storage. O'Reilly has a caching servlet that may help, 
> > > > but I was wondering if
> > anybody
> > > > had come out with an elegant way to do this.
> > > >
> > > > Thanks,
> > > > David
> > > >
> > > >
> > > > 
> > 
> > > > -
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: 
> > [EMAIL PROTECTED]
> > > >
> > >
> > >
> > >
> > >
> > > 
> > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


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



Re: Capturing HTML using Tomcat 4

2004-10-06 Thread Luke (Terry) Vanderfluit
Hi,

I'm not sure if this is what you mean.
You could simply run the following code to capture the output of the
jsp.

~~
String htmlText;
 URL u = new
URL("http://www.server.com:8080/application/some.jsp";);
 BufferedReader htmlPage =
   new BufferedReader(new InputStreamReader(
   u.openStream()));
 while((htmlText = htmlPage.readLine()) != null){
System.out.println(htmlText);
 }

regards,
Luke

On Thu, 2004-10-07 at 07:39, David Wall wrote:
> I've been looking through archives and such for examples of how to capture
> the HTML output from a given JSP programmatically so I can archive or do
> other things with that HTML.  For example, we might do this to record the
> text of an agreement that was displayed to a user, in which a JSP generated
> the agreement HTML page.  The pages may be generated from either HTTP GET or
> POST.
> 
> It would be nice to perhaps just have a servlet "include" the response from
> a JSP, passing along the GET/POST request to that JSP, but then have the
> servlet capture the JSP's response in a string for processing/storage.
> O'Reilly has a caching servlet that may help, but I was wondering if anybody
> had come out with an elegant way to do this.
> 
> Thanks,
> David
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
-- 

Luke (Terry) Vanderfluit 
Mobile: 0421 276 282 



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



RE: Capturing HTML using Tomcat 4

2004-10-07 Thread Shapira, Yoav

Hi,
Look at any of the freely-available servlet response caching filters out
there.  They all capture the response output completely anyhow.  You'd
have to make minimal modifications (if any) to fit your use-case.

Yoav Shapira
Millennium Research Informatics


>-Original Message-
>From: David Wall [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, October 06, 2004 6:10 PM
>To: [EMAIL PROTECTED]
>Subject: Capturing HTML using Tomcat 4
>
>I've been looking through archives and such for examples of how to
capture
>the HTML output from a given JSP programmatically so I can archive or
do
>other things with that HTML.  For example, we might do this to record
the
>text of an agreement that was displayed to a user, in which a JSP
generated
>the agreement HTML page.  The pages may be generated from either HTTP
GET
>or
>POST.
>
>It would be nice to perhaps just have a servlet "include" the response
from
>a JSP, passing along the GET/POST request to that JSP, but then have
the
>servlet capture the JSP's response in a string for processing/storage.
>O'Reilly has a caching servlet that may help, but I was wondering if
>anybody
>had come out with an elegant way to do this.
>
>Thanks,
>David
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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