Reputation: 24134
My app queries other web services via SSL. I've used Apache HttpClient to create https POST calls on my server to other web services. When I deployed my app to App Engine I got the following error:
java.lang.NoClassDefFoundError: javax.net.ssl.KeyManagerFactory is a restricted class.
Please see the Google App Engine developer's guide for more details.
My question is, how can I make HTTPS calls on Google App engine?
Upvotes: 3
Views: 1090
Reputation: 33476
Apache HttpClient is not supported out-of-the-box by App Engine. You will have to write a custom ConnectionManager that wraps UrlFetch. This post explains it pretty well and provides you with sample code. I used that code successfully on App Engine before.
Upvotes: 4
Reputation: 24910
You can just use a URL class to make HTTPS connections on the app-engine.
Something like this --
URL url = new URL(yourHttpsURL);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuilder responseBody = new StringBuilder();
String line;
while ((line = reader.readLine()) != null)
responseBody.append(line);
reader.close();
The app engine also supports host validation using the FetchOptions class in the low-level API.
Upvotes: 1