• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

save the output of JSP into a inputstream

 
Harathi Rao
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
 
Harathi Rao
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please suggest some examples...
 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
 
Harathi Rao
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
Dean O'olish
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check your private messages, again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic