|
From: Morch, H. <hol...@na...> - 2011-09-08 07:43:16
|
Hi Jeff,
I have the same issue. I think the idea is that if you return a string RESTeasy expects that it is in the correct format (json, xml or whatever). I don't know why this is the case.
For me one solution would be to exclude StringTextStar provider from registry. I don't want to disable automatic discovery of providers completely but just exclude this provider. If the Jackson provider would be used, the response would be correct.
Kind regards,
Holger
-----Original Message-----
From: Jeff Schnitzer [mailto:je...@in...]
Sent: Donnerstag, 8. September 2011 09:18
To: res...@li...
Subject: Re: [Resteasy-developers] java.lang.String JSON formated
After a few minutes with the debugger, yeah, looks like the problem is that StringTextStar is being chosen. It's just ahead of ResteasyJacksonProvider in the priority list. This seems odd.
Could this have something to do with StringTextStar having @Produces("*/*")? Shouldn't this be @Produces("text/*")? It certainly can't produce application/json.
Jeff
On Thu, Sep 8, 2011 at 12:00 AM, Jeff Schnitzer <je...@in...> wrote:
> Looks like someone else has this problem, but no response. I looked
> at the headers and I'm getting back application/json as the
> content-type, but no quotes.
>
> Should I log this as a bug? Any workaround short of wrapping all
> strings in another object?
>
> Jeff
>
> On Wed, Feb 9, 2011 at 5:02 AM, Morch, Holger <hol...@na...> wrote:
>> Hello,
>>
>>
>>
>> I’ve a Method which returns just a Sting. The @Produces mime types
>> are {"application/*+json", "application/json", "text/json"} but if
>> one requests the data he gets only the String which is returned by
>> the Method. Correct JSON format would be a quoted string (http://www.json.org/ Section:
>> string).
>>
>> Example:
>> Method return value: Test
>>
>> HTTP Content: Test
>>
>> Expected Content: “Test”
>>
>>
>>
>> I’m using Jackson as JSON Provider and I think he would format it correctly.
>> Unfortunately the StringTextStar MessageBodyWriter is chosen instead
>> of Jackson. I saw that you’re sorting the MessageBodyWirters somehow
>> and I’m sure you have good reasons to sort this way. Is there a way
>> to get Jackson as MessageBodyWriter in this case? How can I do that?
>>
>>
>>
>> Kind regards
>>
>> Holger
>>
>>
>>
>> -------------------------------------------
>>
>>
>>
>> Holger Morch
>> Software Engineer
>>
>> NAVTEQ Germany GmbH & Co.KG
>>
>>
>>
>> ________________________________
>> The information contained in this communication may be CONFIDENTIAL
>> and is intended only for the use of the recipient(s) named above. If
>> you are not the intended recipient, you are hereby notified that any
>> dissemination, distribution, or copying of this communication, or any
>> of its contents, is strictly prohibited. If you have received this
>> communication in error, please notify the sender and delete/destroy
>> the original message and any copy of it from your computer or paper files.
>>
>> ---------------------------------------------------------------------
>> --------- The ultimate all-in-one performance toolkit: Intel(R)
>> Parallel Studio XE:
>> Pinpoint memory and threading errors before they happen.
>> Find and fix more than 250 security defects in the development cycle.
>> Locate bottlenecks in serial and parallel code that limit performance.
>> http://p.sf.net/sfu/intel-dev2devfeb
>> _______________________________________________
>> Resteasy-developers mailing list
>> Res...@li...
>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>
>>
>
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops? How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Resteasy-developers mailing list
Res...@li...
https://lists.sourceforge.net/lists/listinfo/resteasy-developers
The information contained in this communication may be CONFIDENTIAL and is intended only for the use of the recipient(s) named above. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please notify the sender and delete/destroy the original message and any copy of it from your computer or paper files.
|