Hai all,
Good morning.
I have a small problem in accessing
servlets using URLConnection in stand-alone application. Following is the snippet of client and servlet.
URL url = new URL("http://mymachine/abc/Servlet");
HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
httpConnection.setDoOutput(true);
httpConnection.setDoInput(true);
httpConnection.setRequestMethod("POST");
httpConnection.setUseCaches(false);
httpConnection.setRequestProperty("Content-type", "application/octet-stream");
httpConnection.setAllowUserInteraction(false);
PrintWriter out = new PrintWriter(httpConnection.getOutputStream());
String str = "Hello world";
out.println(str);
out.close();
Servlet
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
System.out.println("in doGet");
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
System.out.println("in doPost");
}
But it does not seem to invoke any of these methods in servlet.
FYI : I have deployed this servlet in Weblogic 6.1.
Poornachandran