import com.sun.jersey.api.client.*;
public class BaseClientMain {
public static void main(String[] args) throws Exception {
try {
Client client = Client.create();
WebResource webResource = client.resource("http://localhost:8080/rest/api/2/issue/QA-31");
ClientResponse response = webResource.accept("application/json")
.header("Authorization", "Basic YWRtaW4lM0FhZG1pbg==")
.header("X-Atlassian-Token", "no-check")
.get(ClientResponse.class);
String msgback = response.getEntity(String.class);
System.out.println(msgback);
response.close();
} catch (UniformInterfaceException e) {
e.printStackTrace();
} catch (ClientHandlerException e) {
e.printStackTrace();
}
}
} |