|
From: Ori L. <ol...@re...> - 2012-10-29 09:22:21
|
Hi, I have a small problem I could use some help with. When a user POSTs a request with an empty body, he gets 400 Bad Request with "SAXParseException; Premature end of file..." (since POST expects body). I'd like to show a friendlier message in the response body, something like: "POST request may not have empty body". Question 1: I'm looking for an interception point that will enable me to check if the user POSTed a request with an empty body. I tried using MessageBodyReaderInterceptor, but it appears that I don't have access to the Request object from the MessageBodyReaderContext object (am I wrong?) Then I noticed that ClientExecutionInterceptor seems to fit my needs, and wrote an interceptor that implements it - but the flow never reached it. Question 2: What are resteasy client interceptors, and how are they invoked? I'll elaborate a bit on the second question. Basically I'm not clear who is the 'client'. I always thought of client as the browser (or 'curl') making the http request, and resteasy runs server-side and handles the requests. So what does 'client' interceptor mean? When is a client interceptor invoked, and where does it run? Can I see it when debugging the server? Sorry for the very open question, but I'm missing something fundamental here... Thanks, Ori. |