aspose file tools*
The moose likes JSP and the fly likes save the output of JSP into a inputstream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "save the output of JSP into a inputstream" Watch "save the output of JSP into a inputstream" New topic
Author

save the output of JSP into a inputstream

Harathi Rao
Ranch Hand

Joined: Oct 31, 2004
Posts: 42
Hi

How can one capture the output of a jsp page formed in a session into an inputstream... I would need this to add some additional information to the content and pass to a Queue.

Any suggestions please..

Harathi
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Read up on Servlet Filters and the wrapper pattern.
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServletResponseWrapper.html
[ July 14, 2006: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Harathi Rao
Ranch Hand

Joined: Oct 31, 2004
Posts: 42
can you please suggest some examples...
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
1. use a mockservletresponse class (extend HttpServletResponseWrapper)

2. use the request dispatcher :

MockServletResponse mockr = new MockServletResponse(response);
RequestDispatcher.include(request,mockr);
byte[] outputData = mockr.getOutputData();


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Harathi Rao
Ranch Hand

Joined: Oct 31, 2004
Posts: 42
Thanks to Ben and Lynette for the help I have resolved it. What I needed was a class which implemented HttpServletResponseWrapper.
Dean O'olish
Greenhorn

Joined: Mar 03, 2009
Posts: 16
Can you post your code? I am having the same problem but am having a hard time figuring out how to fix it


Thanks,

- D



Harathi Rao wrote:Thanks to Ben and Lynette for the help I have resolved it. What I needed was a class which implemented HttpServletResponseWrapper.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

"Dean Ooooh", firstly, please check your private messages for an important administrative matter.

Secondly, please read this for information on replying to older posts. This post is almost three years old.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dean O'olish
Greenhorn

Joined: Mar 03, 2009
Posts: 16
Java Ranch will not allow "O" to be the last name and my last name begins with 'O'... so instead now I made it 'Oo'...




Bear Bibeault wrote:"Dean Ooooh", firstly, please check your private messages for an important administrative matter.

Secondly, please read this for information on replying to older posts. This post is almost three years old.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

Check your private messages, again.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: save the output of JSP into a inputstream