Hello,

I set up a server which can serve a resource in both
APPLICATION_JAVA_OBJECT, as well as APPLICATION_JAVA_OBJECT_GWT
representation.
I can test this using
new
ClientResource("http://blockedcontent:8888/service/hello";).get(MediaType.APPLICATION_JAVA_OBJECT);
and
new
ClientResource("http://blockedcontent:8888/service/hello";).get(MediaType.APPLICATION_JAVA_OBJECT_GWT);

However, when using the ClientResource.wrap() I cannot select the MediaType.
- when org.restlet.ext.gwt-2.0.6.jar is in the client's classpath, the
accepted mediatypes of the request always are
[application/x-java-serialized-object+gwt:1.0,
application/x-java-serialized-object:1.0,
application/x-java-serialized-object+xml:1.0]

- when org.restlet.ext.gwt-2.0.6.jar is not in the client's classpath, the
accepted mediatypes are
[application/x-java-serialized-object:1.0,
application/x-java-serialized-object+xml:1.0]

Setting the accepted mediatypes as described here does not work
http://restlet-discuss.1400322.n2.nabble.com/Restlet-Server-GWT-restlet-client-tp6200833p6200833.html
i.e., I tried both
ClientResource cr = new
ClientResource("http://blockedcontent:8888/service/hello";);
cr.getClientInfo().setAcceptedMediaTypes(
        Arrays.asList(new Preference(MediaType.APPLICATION_JAVA_OBJECT)));
ContactResource resource = cr.wrap(ContactResource.class);
Contact contact = resource.retrieve();
// ...

and
ClientResource cr = new
ClientResource("http://blockedcontent:8888/service/hello";);
ContactResource resource = cr.wrap(ContactResource.class);
ClientProxy p = (ClientProxy) resource;
p.getClientResource().getClientInfo().setAcceptedMediaTypes(
        Arrays.asList(new Preference(MediaType.APPLICATION_JAVA_OBJECT)));
Contact contact = resource.retrieve();

But I get always get the GWT representation when the gwt jar is in the
classpath. This fails to deserialize since I call from a Java program, not a
GWT app. I want to get the java object mediatype.

Thus, it seems that the client's accepted media types of a wrapped resource
are solely derived from the libraries on the classpath and cannot be
overwritten.
So,how can I use a java serialized object mediatype with
ClientResource.wrap, even though the gwt jar is in the classpath?


--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Cannot-select-MediaType-when-using-ClientResource-wrap-tp6264755p6264755.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2719056

Reply via email to