Here is how I deal this:

I have a custom filter class that implements the RequestHandler and
overrides the handleRequest(...) method.

As mentioned in the topic, the request is determined using MediaType.

In the method that handles JSON, I get the
message.getContent(InputStream.class), hence reading the JSON string....

This content is being set back again in the message after doing a cache like
below:

InputStream in = message.getContent(InputStream.class);
                if (in != null) {
                    cos = new CachedOutputStream();
                    IOUtils.copy(in, cos);
                    cos.flush();
                    in.close();
                    message.setContent(InputStream.class, cos.getInputStream());
                    cos.close();
                }

Then I do fetch the necessary content from the cos object to do the
authentication process... 

once authenticated I set the Response as null like below:

if (Authentication.authenticate(credentials)){
                                log.info("--isAuthorized if--");                
                
                                return null;
                        } else {
                                return 
Response.status(Status.UNAUTHORIZED).build();
                        }

The control flows well and it returns null.... so the JSON request is
allowed to proceed...

but its not proceeding and fails without any visible exception / error.

Hope this makes sense



--
View this message in context: 
http://cxf.547215.n5.nabble.com/JSON-Request-fails-after-interception-REST-tp5720968p5720976.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to