szilora
asked on
Java client for RESTful service
I'm trying to write a java client to access a restful service without using jersey or other libs. Using HttpURLConnection works great. I can hit the service and get a result back. I can also use the setRequestMethod() to specify whether I'm doing a GET, POST, etc.
What I cannot figure out how to do is specify the return content-type. That is, for a service that can return either application/xml or application/json (or other types), how do I specify which one I want back? I can use addRequestProperty("Conten t-Type","a pplication /xml") to say what I'm sending in the request, but how to I specify content type for the response?
Thanks!
What I cannot figure out how to do is specify the return content-type. That is, for a service that can return either application/xml or application/json (or other types), how do I specify which one I want back? I can use addRequestProperty("Conten
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER