0

I'm working on a Google App Engine application that needs to read PDF files from a HTTPS connection that requires accepting the root certificate.

I managed to read from a main class, accessing the keystore with the certificate included.

Unfortunately when using the code on App Engine, it tells me I can not use HttpsURLConnection class to create the SSL context that allows me to create the HTTPS connection to the server.

URL url = new URL("https://sede.dgt.gob.es/WEB_TTRA_CONSULTA/ServletVisualizacion?params=nNo5ZWovvSC5yTu9s4kDdX4GzPZvWMyYo3P%2FsuhoF4DJImPyqstz8tHRwBQcTuZk%0D%0A&formato=PDF");

URLConnection conexion = url.openConnection();
((HttpsURLConnection) conexion).setSSLSocketFactory(sslSocketFactory);
conexion.connect();

InputStream is = conexion.getInputStream();

What kind I use for it?

How do I access the keystore on the server? work with the binary file on disk?

Philipp Reichart
  • 20,771
  • 6
  • 58
  • 65
user1358518
  • 93
  • 2
  • 13

1 Answers1

0

You must use the com.google.appengine.api.urlfetch.URLFetchService to make calls to external URLS on AppEngine.

koma
  • 6,486
  • 2
  • 27
  • 53
  • AppEngine re-implements `URLConnection` on top of its `UrlFetchService`, so `new Url().openConnection()` usually works. The OP seems to have an issue with not being able to set a custom keystore, see http://stackoverflow.com/questions/13042461/loading-a-custom-key-store-in-google-app-engine-java-application. – Philipp Reichart Nov 18 '13 at 22:24