Hi,
try something like:

ClientInfo clientInfo = new ClientInfo();
clientInfo.setAcceptedMediaTypes(new ArrayList<Preference<MediaType>>().);
clientInfo.getAcceptedMediaTypes().add(new Preference<MediaType>(MediaType.APPLICATION_JAVA_OBJECT));
request.setClientInfo(clientInfo);

jon

Stanczak Group wrote:
Here's the code:

Request request = new Request(Method.GET, "http://localhost:8182/users/dog";); ChallengeResponse authentication = new ChallengeResponse(ChallengeScheme.HTTP_BASIC, "admin", "admin");
       request.setChallengeResponse(authentication);
       Client client = new Client(Protocol.HTTP);
       Response response = client.handle(request);
       String str = (String) response.getEntityAsObject();
       System.out.println(str);

Keeps requesting MediaType.TEXT_PLAIN but I'm trying to get an object. I have the server setup to send object.


if (variant.getMediaType().equals(MediaType.APPLICATION_JAVA_OBJECT)) {
           result = new ObjectRepresentation("Testing....");
           System.out.println("\nAPPLICATION_JAVA_OBJECT\n");
       }

Where am I going wrong?


Reply via email to