juneau-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Bognar <jamesbog...@gmail.com>
Subject Re: How to get a class to return standard JSON as the default
Date Fri, 09 Feb 2018 14:51:52 GMT
Hi Gary,

Try using a default request header:

@RestResource(

defaultRequestHeaders= {

"Accept: application/json"

},

)

I'll take a closer look at how "no" Accept header is handled.  I think it
depends on what tool you're using.  Poster for example sends "Accept: */*"
if you don't specify a value, and that might return a somewhat-random
result.

On Thu, Feb 8, 2018 at 9:11 PM, Gary Gregory <garydgregory@gmail.com> wrote:

> Hi All:
>
> I want to return _standard_ JSON (see json.org) when no Accept header is
> sent to my @RestResource class. I cannot seem to get that to work no matter
> what. I get Juneau's non-standard single quote JSON.
>
> Standard JSON uses double quotes, not single quotes.
>
> If I specify 'application/json' in the Accept, then I do get standard JSON.
>
> I cannot get this to work no matter what I try in my class's
> @RestResource's serializer attribute.
>
> I also want to support the normal set of serializers so users can specify
> any Accept header value Juneau supports.
>
> Thank you,
> Gary
>

Mime
View raw message