• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't print after post doFilter

 
Shai francoua
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 225
Debian Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"labba lolypop", please check your private messages for an important administrative matter.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In general, never close a stream you did not open.
 
Shai francoua
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"NiO NiO " please see your private messages for an important administrative matter again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic