Did did see a Representation in the Request constructor. Is that what I
should use. I'll try that.
Stanczak Group wrote:
I don't have a request.setClientInfo() in my request object. Do I have
an older version? I'm using 1.0.4.
Jonathan Hall wrote:
Whoops,
clientInfo.setAcceptedMediaTypes(new
ArrayList<Preference<MediaType>>().);
should be:
clientInfo.setAcceptedMediaTypes(new
ArrayList<Preference<MediaType>>());
Jonathan Hall wrote:
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?
--
Justin Stanczak
Stanczak Group
812-735-3600
"All that is necessary for the triumph of evil is that good men do nothing."
Edmund Burke