users@jersey.java.net

[Jersey] Re: Setting default content types for request

From: Todd Nine <tnine_at_apigee.com>
Date: Fri, 22 Jun 2012 09:43:56 -0700

Hi All,
  I've done some work on this and I am experiencing some issues. It looks like I need to modify both the "accept" header and the "Content-Type" headers. However when I do so via a ContainerRequestFilter implementation, I ALWAYS receive a 400 error when processing the request. I've gisted my test cases (which don't pass yet) and the filter and the logs.

https://gist.github.com/4ff589df2ac25da1df9b

Our primary use case is people using curl or wget. By default we want our content type and accept to be application/json, since this is the only format we support in our services.

Is this possible to do with Jersey without causing an error? We're using version 1.11.

Thanks!
Todd

-- 
Todd Nine
On Tuesday, June 19, 2012 at 12:16 PM, Todd Nine wrote:
> Hi all, 
>   We're using Jersey in conjunction with the Spring framework.  We've configured the following options for our spring servlet.  You can view the source here.
> 
> 
> https://github.com/usergrid/stack/blob/master/rest/src/main/webapp/WEB-INF/web.xml#L80
> 
> 
> 
> We primarily deal with json data as our main Content-Type.  Is it possible to configure the Spring Servlet to set the content type to json if no content type is present in the request header?
> 
> Thanks,
> 
> Todd
>