Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Sending a POST request to a REST service using Jersey Client

View post_jersey_client.java
1 2 3 4 5 6 7 8 9
ClientConfig config = new DefaultClientConfig();
Client client = Client.create(config);
WebResource service = client.resource(getBaseURI());
 
MultivaluedMap<String, String> formData = new MultivaluedMapImpl();
formData.add("parameter1", "value1");
formData.add("parameter2", "value2");
 
ClientResponse response = service.path("resource").accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, formData);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.