Can't get any response from HttpsURLConnection
Deal frens,
Currently i'm doing a codeto get a response from https link in my servlet. I don't know where the lack of my coding, but i don't get any response from the server when i execute my code. here is my code
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.net.ssl.*;
public class Servlet1 extends HttpServlet {
private static final String CONTENT_TYPE = "text/html";
//Initialize global variables
public void init() throws ServletException {
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
String authentURL = "https://server1.tst.cvs/servlet/RequestHandler?login=admin&pwd=admin&method=viewUser&username=00032a0183db";
out.println("<html>");
out.println("<head><title>Servlet1</title></head>");
URL url = new URL(authentURL);
HttpsURLConnection URLconn = (HttpsURLConnection) url.openConnection();
// HttpsURLConnection conn = null;
URLconn.setDoInput(true);
URLconn.setDoOutput(true);
URLconn.setRequestMethod("GET");
URLconn.setUseCaches(false);
OutputStream authOut = URLconn.getOutputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(URLconn.getInputStream()));
out.println("<body bgcolor=\"#ffffff\">");
out.println("
The servlet has received a GET. This is the reply.
");out.println("output"+authOut);
out.println("output2"+URLconn.getContent().toString());
out.println("output3"+reader);
out.println("</body></html>");
}
//Clean up resources
public void destroy() {
}
}
the result suppose i get when i execute the script is..
userdata=234&uname=00032a0183db&concurrentlogins=1
i don't have any problem when i paste the link
https://server1.tst.cvs/servlet/RequestHandler?login=admin&pwd=admin&method=viewUser&username=00032a0183db
and i able to get the response
userdata=234&uname=00032a0183db&concurrentlogins=1
please..please help..what is wrong with my code

