• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

save the output of JSP into a inputstream

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Harathi Rao
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you please suggest some examples...
 
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check your private messages, again.
reply
    Bookmark Topic Watch Topic
  • New Topic