HTTPS using Jersey Client
java, jersey
Solution
Construct your client as such
HostnameVerifier hostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
ClientConfig config = new DefaultClientConfig();
SSLContext ctx = SSLContext.getInstance("SSL");
ctx.init(null, myTrustManager, null);
config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new HTTPSProperties(hostnameVerifier, ctx));
Client client = Client.create(config);
Ripped from this blog post with more details: http://blogs.oracle.com/enterprisetechtips/entry/consuming_restful_web_services_with
For information on setting up your certs, see this nicely answered SO question: Using HTTPS with REST in Java
Problem
How do I send GET requests using the Jersey Client API to a server which runs on the HTTPS protocol. Is there any sample code that I can use ?
Related problems
- Java Keytool error after importing certificate , "keytool error: java.io.FileNotFoundException & Access Denied"
- Using HTTPS with REST in Java
- Java: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
- Accessing secure restful web services using jersey client