JAX-RS Client API:
WebTarget target = ClientBuilder.newClient().target(RESOURCE_URL) def response = target.request(TEXT_PLAIN_TYPE).get(String) response == "Hello World!"
Jersey Groovy DSL:
def response = GET[RESOURCE_URL].text response == "Hello World!"
(Press 'h' to highlight important sections of code.)
JAX-RS Client API:
WebTarget target = ClientBuilder.newClient().target(RESOURCE_URL) def response = target.path("Jersey").request(TEXT_PLAIN_TYPE).get(String) response == "Hello Jersey!"
Jersey Groovy DSL:
def response = GET[RESOURCE_URL/"Jersey"].text response == "Hello Jersey!"
(Press 'h' to highlight important sections of code.)
JAX-RS Client API:
WebTarget target = ClientBuilder.newClient().target(RESOURCE_URL) def response = target.path("Jersey").request(APPLICATION_XML_TYPE).get(Message) response instanceof Message response.greeting == "Hello Jersey!"
Jersey Groovy DSL:
def response = (GET[RESOURCE_URL/"Jersey"] & APPLICATION_XML_TYPE) as Message response instanceof Message response.greeting == "Hello Jersey!"
(Press 'h' to highlight important sections of code.)
JAX-RS Client API:
WebTarget target = ClientBuilder.newClient().target(RESOURCE_URL) def Entity entity = Entity.entity("Jersey", TEXT_PLAIN_TYPE); def response = target.request().post(entity, String) response == "Hello Jersey!"
Jersey Groovy DSL:
def response = POST[RESOURCE_URL] << "Jersey" as String response == "Hello Jersey!"
(Press 'h' to highlight important sections of code.)
JAX-RS Client API:
WebTarget target = ClientBuilder.newClient().target(RESOURCE_URL) def Entity entity = Entity.entity(new Message("Jersey", new Date()), APPLICATION_JSON_TYPE) def response = target.request().post(entity, String) response == "Hello Jersey!"
Jersey Groovy DSL:
def response = (POST[RESOURCE_URL] | APPLICATION_JSON_TYPE) \ << new Message("Jersey", new Date()) as String response == "Hello Jersey!"
(Press 'h' to highlight important sections of code.)
Important contact information goes here.