Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to modify or create a ServletInputStream?

843841May 12 2004 — edited Jul 4 2006
Hi all,

I want to do the following:

In my HttpServletRequestWrapper, I want to overwrite the method
public ServletInputStream getInputStream();
I want to read the InputStream (super.getInputStream()), manipulate it (replace some SubStrings with new values) and then return it.

At the moment I read the content of the Stream into a String, replace the substrings and now I need to create a new InputStream I can return. I don't know how to do the last step ....

Is there a better way, maybe not create a String but manipulate the stream directly and return it?

Thanks for your help and best Regards from Walldorf,
alex
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 1 2006
Added on May 12 2004
4 comments
1,049 views