Hi,
I have a problem with UrlConnections. I have to call a UrlConnections from a
servlet and that has caused same wierd stuff. If I change them URL to for
example yahoo.se then everything works (get method), but as soon as I use
post method it doesn't work. (and yes the  parameters are right)
Anyone got any idea? Due to the fact that the try{} doesn't giva any
exception there's no printed error message..


 greetings Matt

   try{
      URL url = new URL("http://adress/servlet/package.file");
      HttpURLConnection urlConn = (HttpURLConnection)url.openConnection();
      urlConn.connect();
      urlConn.setDoOutput(true);
      urlConn.setRequestMethod("POST");
      String postStr = "para1=" + para1+"&para2=" + para2 +"&para3="+para3 ;
      PrintWriter urlOut = new PrintWriter(urlConn.getOutputStream());
      urlOut.print(postStr);
      urlOut.close();
      BufferedReader in = new BufferedReader(
        new InputStreamReader(
        urlConn.getInputStream()));
      String inputLine;
      while ((inputLine = in.readLine()) != null)
        System.out.println(inputLine);
      in.close();
      urlOut.close();
   }catch (Exception e) {
      response.setContentType("text/html");
      PrintWriter out = new PrintWriter (response.getOutputStream());
      e.printStackTrace(out);
      out.close();
   }

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to