Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

For HTTPS, couln't get url.openStream  RSS feed

 
Faxin Zhao
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to get the XML output from a URL and transfer to a HTML page.
When I tyied my http web app, is OK.
But, when I tried my https web app, got the problem.
I checked my code, and knew it caused by this line:
BufferedReader in = new BufferedReader(new InputStreamReader(verisign.openStream()));
That means I couldn't get the input stream from url.openStream
And I got more error messages as following:
java.io.FileNotFoundException: https://myTestSvr/myApp/servlet/myDocList?myAccountNo=321456&myTeamNo=2&myAccessCode=A
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at myDocList.doPost(myDocList.java:143)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:749)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:842)
at com.gefionsoftware.server.ServletContextImpl$ServletHandler.call(ServletContextImpl.java)
at com.gefionsoftware.server.ServletContextImpl.executeServlet(ServletContextImpl.java)
at com.gefionsoftware.server.NamedDispatcherImpl.forward(NamedDispatcherImpl.java)
at com.gefionsoftware.server.servlets.InvokerServlet.service(InvokerServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:842)
at com.gefionsoftware.server.ServletContextImpl$ServletHandler.call(ServletContextImpl.java)
at com.gefionsoftware.server.ServletContextImpl.executeServlet(ServletContextImpl.java)
at com.gefionsoftware.server.ServletContextImpl.execute(ServletContextImpl.java)
at com.gefionsoftware.server.GenericServer.execute(GenericServer.java)
at com.gefionsoftware.server.lws.LiteWebServer$RequestHandler.run(LiteWebServer.java)
at se.pureit.util.ThreadPool$WorkThread.startRunnable(ThreadPool.java)
at se.pureit.util.ThreadPool$WorkThread.run(ThreadPool.java)

Some advices?
Thanks in advance.
Here are some lines from my servlet:
String url = "https://myTestSvr/myApp/servlet/myDocList?" +
"myAccountNo=" + myAccountNo +
"&myTeamNo=" + myTeamNo +
"&myAccessCode=" + myAccessCode ;
System.out.println(java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()));
System.getProperties().put(new String("java.protocol.handler.pkgs"),new String("com.sun.net.ssl.internal.www.protocol"));
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
try
{
URL verisign = new URL(url);
BufferedReader in = new BufferedReader(new InputStreamReader(verisign.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
catch (Exception e) {
e.printStackTrace();
PrintWriter pw = new PrintWriter(new FileWriter("d:/exception.txt"));
e.printStackTrace(pw);
pw.flush();
pw.close();
return;
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!