RESTEasy has a manual API for invoking requests: org.jboss.resteasy.client.ClientRequest See the Java Documentation for a complete description of this class. A simple example is the following:
ClientRequest request = new ClientRequest("http://localhost:8080/some/path");
request.header("custom-header", "value");
// We're posting XML and a JAXB object
request.body("application/xml", someJaxb);
// we're expecting a String back
ClientResponse<String> response = request.post(String.class);
if (response.getStatus() == 200) // OK!
{
String str = response.getEntity();
}
ClientRequest request = new ClientRequest("http://localhost:8080/some/path");
request.header("custom-header", "value");
// We're posting XML and a JAXB object
request.body("application/xml", someJaxb);
// we're expecting a String back
ClientResponse<String> response = request.post(String.class);
if (response.getStatus() == 200) // OK!
{
String str = response.getEntity();
}
Copy to ClipboardCopied!Toggle word wrapToggle overflow