Thanks for your insights it helped a lot
some of the code was wrapped by a nasty upper layer try catch statement
Olivier
On 08/23/2012 06:48 PM, Marek Potociar wrote:
> Are you sure your client-side request is not somehow badly formatted causing 400 to be returned? I mean - is the exception that you see really related to the response generated from the exception thrown by your server-side resource?
>
> Marek
>
> On Aug 22, 2012, at 5:29 PM, Olivier Bourdon <olivier.bourdon_at_usharesoft.com> wrote:
>
>> Hello everyone
>>
>> Here is a piece of code which used to work and which does not anymore. Note that I am currently
>> using jersey-1.10 (soon migrating to 1.13 I hope)
>>
>> ======================
>> File: src/xxx/.../UsersCreateResource.java:createUser
>> Response r = Response.status(Response.Status.CONFLICT).entity("User name already taken, please choose another").build();
>> throw new WebApplicationException(r);
>> ======================
>>
>> which is supposed to return 409
>>
>> my web service is also using specific exception filters
>> in glassfish web.xml I have
>>
>> <init-param>
>> <param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
>> <param-value>com.me.rest.filters.ClientFilter;com.me.rest.filters.ErrorFilter</param-value>
>> </init-param>
>>
>> or in a standalone grizzly instance I set:
>> initParams.put(PackagesResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS, "com.me.rest.filters.ClientFilter;com.me.rest.filters.ErrorFilter");
>>
>> However when I enter my code which looks like:
>>
>> public class ClientFilter implements ContainerResponseFilter {
>>
>> private static Logger logger = Logger.getLogger(ClientFilter.class);
>>
>> @Override
>> public ContainerResponse filter(ContainerRequest cRequest, ContainerResponse cResponse) {
>>
>>
>> the cResponse I have is now 400 instead of 409
>>
>> May be I am misleading but I am pretty sure that this used to work before with the same version of Jersey
>> therefore I was wondering what could have changed and if someone could give me
>> some hints on how to debug this (webservice or standalone instance no matter)
>>
>> What might have changed is my Java version (was using 1.6.0_32 and now 1.7.0_04 therefore I redownloaded the previous Java version
>> and recompiled everything with it without any more success
>>
>> Thanks a lot for any insights
>> Olivier
>