Wednesday, 15 February 2012

Reading response body in Java EE filters -



Reading response body in Java EE filters -

how can read content of httpservletresponse object

i have rest architecture responds jsons.

eg /loginresult.json respond json.

for capturing request/ response have created 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 response //if response 1 go on else redirect } else{ system.out.println("other url"); }

how can read response object(as string or object of original type). possible?

more info- json response serialized object of type "loginresult".

java-ee response servlet-filters

No comments:

Post a Comment