Hmm. So what dependency should I use? Changing to
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0-rc3</version>
</dependency>
gives me
java.lang.NoClassDefFoundError: javax/ws/rs/MessageProcessingException
at
org.apache.cxf.jaxrs.impl.ResponseBuilderImpl.build(ResponseBuilderImpl.java:61)
at
org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:128)
at
org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:86)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
[...]
in my application...
Regards,
Daniel
On 22.03.2013, at 10:32, Sergey Beryozkin wrote:
> Hi
> On 22/03/13 06:17, Daniel Bimschas wrote:
>> OK, that works now. Thanks again, Sergey!
>>
>> But: it only works when I cast to ResponseImpl as javax.ws.rs.core.Response
>> doesn't provide a readEntity method.
>>
> You may be still having jsr311-api in the dependencies ? See
>
> http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/javax/ws/rs/core/Response.html
>
> Cheers, Sergey
>
>> Cheers,
>> Daniel
>>
>> On 21.03.2013, at 22:50, Sergey Beryozkin wrote:
>>
>>> Hi
>>> On 21/03/13 21:30, Daniel Bimschas wrote:
>>>> Hi there!
>>>>
>>>> I'm currently trying to work with the CXF client API and the nice proxy
>>>> feature it provides. Now, one of my API methods returns a
>>>> javax.ws.rs.core.Response wrapping an entity. This entity is a JAXB
>>>> annotated class which is serialized to JSON and shall be deserialized on
>>>> client side. Now, when I execute the client I get the following error
>>>> message:
>>>>
>>>> java.lang.ClassCastException:
>>>> sun.net.www.protocol.http.HttpURLConnection$HttpInputStream cannot be cast
>>>> to MyDtoClass
>>>>
>>>> According to [1] one can use the ResponseReader class such that the stream
>>>> will be deserialized to the expected type. However, it seems that starting
>>>> with CXF 2.7.0 (I'm using 2.7.3) this class is missing. Can you enlighten
>>>> me here?
>>>>
>>> I'm really late on updating the documentation on the JAX-RS 2.0 features,
>>> the 2.0 implementation work is still ongoing,
>>>
>>> The following will work:
>>>
>>> MyClass myclass = myResponse.readEntity(MyClass.class)
>>>
>>> Cheers, Sergey
>>>
>>>> Cheers,
>>>> Daniel
>>>>
>>>> [1]
>>>> http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-Limitations
>>
>
>