Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

API to log the compete HTML file before sending it to the client  RSS feed

 
anand rathna
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
I'm looking for some kind of API which will help me log the complete html file in the server before forwarding it to the Client. Any possibilities available ?

Thanks
`A
 
Paul Clapham
Sheriff
Posts: 22476
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What HTML file is that, where is it coming from before it is forwarded to the client, and what would constitute "logging" it?
 
anand rathna
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTML file is generated from JSP. Then sent to the client from the server. I need the complete HTML which is being sent to the client. Reason: say, I need to see all the contents client sees from the server itself, not going to the client.
 
Paul Clapham
Sheriff
Posts: 22476
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's one of the possible uses of a servlet filter. You could certainly write a filter which saved a copy of the response sent to a client.

(But that isn't an "other API", it's a standard part of the Java EE servlet specification.)
 
anand rathna
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the tip. But I'm wondering how to get the data from the HttpServletResponse object...

Tried



but am only getting partial (broken inbetween) page !!

Thanks
`A
 
Paul Clapham
Sheriff
Posts: 22476
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what that code is supposed to do, and without any context I can't guess.

The usual way to do what you want is with an HttpServletResponseWrapper. Here's a link to a tutorial which uses that class to do something with the servlet response:

http://www.orionserver.com/tutorials/filters/3.html
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!