Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpServletResponse status info  RSS feed

 
Tobi McFarland
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to grab this part of the response using a servlet?:

HTTP/1.1 200 OK

I see that there's a method that can setStatus() in HttpServletResponseWrapper, but that's about it.

I'm attempting to evaluate the status to determine whether or not name value pairs from the request should be logged or not.

Thanks
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked into using a ServletResponseWrapper within a Filter to do this? By wrapping the response you'd have access to the output stream, and then could parse it looking for the status code, etc.
 
Tobi McFarland
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I am actually using a Filter for this, just hadn't thought to use anything in ServletResponseWrapper. I looked at HttpServletResponseWrapper instead. Duh.

Thanks again!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!