how to convert REST call related to Curl command into java client? how to convert REST call related to Curl command into java client? curl curl

how to convert REST call related to Curl command into java client?


There's a lightweight curl wrapper API available for java. Check it out: CurlJava


you can write your own java Rest client ,from that code you can call your rest .

public class ClientJerseyGet {

public static void main(String[] args) {    try {        Client client = Client.create();        String restUrl="https://www.sample.com/sell/fileupload?realm=YourSiteID";        WebResource webResource = client.resource(restUrl);        ClientResponse response = webResource.accept("application/xml")                .get(ClientResponse.class);        String output = response.getEntity(String.class);        System.out.println("Server response : " + response.getStatus());        System.out.println();        System.out.println(output);        if (response.getStatus() != 200) {            throw new RuntimeException("Failed : HTTP error code : "                    + response.getStatus());        }    } catch (Exception e) {        e.printStackTrace();    }}

}

for more Details you can follow :http://entityclass.in/rest/jerseyClientGetXml.htm