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".