1

How can I read the content of HTTPServletResponse object

I have a REST architecture which responds with JSONS.

eg /loginresult.json will respond with a JSON.

For capturing this request/ response I have created a filter

public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)  throws IOException, ServletException {
    System.out.println("AccreditSecurityFilter::doFilter Called");
    HttpServletRequest request = (HttpServletRequest) req;
    HttpServletResponse response = (HttpServletResponse) res;

if(loginurl.equalsIgnoreCase(rebuildURI)){
            //READ THE RESPONSE
            //IF RESPONSE IS 1 THEN CONTINUE ELSE REDIRECT
        }
        else{
            System.out.println("other url");
        }

How can I read the response object(as string or as an object of original type). Is this possible?

More Info- JSON response is a serialized object of type "LoginResult".

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
antnewbee
  • 1,779
  • 4
  • 25
  • 38
  • Is there anyone who can answer this? – antnewbee Feb 06 '13 at 10:30
  • possible duplicate of [How to log response content from a java web server](http://stackoverflow.com/questions/8933054/how-to-log-response-content-from-a-java-web-server) – BalusC Feb 06 '13 at 14:28

0 Answers0