import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
public class RestClientTest {
public static void main(String[] args) {
Client client = Client.create();
WebResource webResource = client.resource("http://localhost:8080/book.rest/rest/helloworld");
ClientResponse response = webResource.accept("text/plain").get(ClientResponse.class);
if (response.getStatus() != 200) {
System.out.println("fail:" + response.getStatus());
}
String output = response.getEntity(String.class);
System.out.println("response : "+output);
}
}
Dosyayı İndir