aspose file tools*
The moose likes Servlets and the fly likes can't print after post doFilter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "can Watch "can New topic
Author

can't print after post doFilter

Shai francoua
Greenhorn

Joined: Jan 06, 2009
Posts: 2
Hi i'm having problems with the filter. i'm trying to just print after i have done a doFilter and only the Pre message is showing and no the post...
this is the filter code:


the servlet file is looking like this:



and the web.xml file is like this:



why does the POST is not printing ?

tnx
LaBBa
Carey Evans
Ranch Hand

Joined: May 27, 2008
Posts: 225

Your servlet closes the PrintWriter, so it’s closed when your filter tries to write to it. It's generally unnecessary to close the output writer in a servlet.

If you can't change the servlet, you may have to subclass the response wrapper used in the filter so that it returns an output writer that ignores the close() method.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

"labba lolypop", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61232
    
  66

In general, never close a stream you did not open.
Shai francoua
Greenhorn

Joined: Jan 06, 2009
Posts: 2
Thank you !! it worked... i removed the out.close() from the servlet and now i can preform a POST operation !!

thanks all!!
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

"NiO NiO " please see your private messages for an important administrative matter again.


SCJP, SCWCD.
|Asking Good Questions|
 
 
subject: can't print after post doFilter