Explain to me why there is no content-type?

On 8/7/2013 8:23 AM, Arnd Schröter wrote:
> Hi Bill,
>
> thanks for your reply. It only works if YAML support is not included in
> RESTeasy. But in JBoss Application Server it is included
> https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Web_Platform/5/html/RESTEasy_Reference_Guide/Built_in_YAML_Provider.html.
>
> In this case ResteasyProviderFactory.getMessageBodyReader returns the
> YamlProvider for the unkown content-type (*/*)  which is not able to
> unmarshal the XML data to the Java class.
>
> Arnd
>
>> I dont understand your problem.  You invoke a HTTP GET request on the
>> DataExport service, works fine.  What does "method inside JBoss
>> Application server" mean?
>>
>> On 8/7/2013 3:19 AM, Arnd Schröter wrote:
>>> Hello together,
>>>
>>> i am using RESTeasy to collect XML data from an external REST-API. It
>>> looks like:
>>>
>>> @Produces("application/xml")
>>> public interface DataExport {
>>>
>>>       @GET
>>>       @Path("results.htm")
>>>       Summary getData(@QueryParam("filterRule") final String filterRule,
>>> @QueryParam("startTime") final long startTime, @QueryParam("endTime")
>>> final long endTime, @QueryParam("attributeSieve") final String
>>> attributeSieve) throws Exception;
>>> }
>>>
>>> The returned Summary is a JAXB generated class based on a XSD.
>>>
>>> Calling this method outside a JBoss Application server works fine since
>>> RESTeasy internally uses the "JaxBXmlRootElemtProvider" message body
>>> reader to convert the XML string into the required object.
>>> Calling this method inside a JBoss Application server as part of a bean
>>> throws an exception saying that String cannot be casted to Summary. I
>>> found out that this comes from the fact that internally another message
>>> body reader is used, namely the "YamlProvider".
>>>
>>> What i found out is that this is connected to the response of the query
>>> which does not contain a content type. Since in the readers list the
>>> YamlProvider comes before JaxBXmlRootElemtProvider the YamlProvider is
>>> chosen which cannot convert the data.
>>>
>>> Do you have any idea how i can solve this issue despite adding the
>>> content type to the response?
>>>
>>> Thank you in advance,
>>> Arnd
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Get 100% visibility into Java/.NET code with AppDynamics Lite!
>>> It's a free troubleshooting tool designed for production.
>>> Get down to code-level detail for bottlenecks, with <2% overhead.
>>> Download for free and get started troubleshooting in minutes.
>>> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
>>> _______________________________________________
>>> Resteasy-users mailing list
>>> Resteasy-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/resteasy-users
>>>
>

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users

Reply via email to