tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mandar Joshi" <mand...@commerceroute.com>
Subject Re: Anybody doing doPost successfully ?
Date Fri, 16 Feb 2001 19:36:22 GMT
Hi ,

This is for a Servlet-

Well I tried it in both ways - 

Posting data using a java client like this

    URL url = new URL(http://mandar:8080/commerceroute/servletname);
    URLConnection conn = url.openConnection();
    if(conn instanceof HttpURLConnection)
    {
     HttpURLConnection httpConn = (HttpURLConnection) conn;
     httpConn.setRequestMethod("POST");
     httpConn.setDoOutput(true);
     out.write(arr);
     System.out.println("bytes written : " + arr.length);
     out.flush();
     out.close();
     out = null;
     httpConn.getContent();
     InputStream ins = httpConn.getInputStream();
     InputStreamReader rd = new InputStreamReader(ins);
    // read from rd
    }

Using a html page like this

<HTML>
<HEAD>
<TITLE>RosettaNet Request POST</TITLE>
</HEAD>
<BODY>
<FORM METHOD=POST ACTION="http://mandar:8080/commerceroute/servletname" >
<INPUT TYPE=HIDDEN NAME=ERNO
VALUE="Test_Data">
<INPUT TYPE=SUBMIT NAME="Submit">
</FORM>
</BODY>
</HTML>

In both cases the servlet seems to be stuck while reading from the  request.InputStream


Mandar
  ----- Original Message ----- 
  From: CPC Livelink Admin 
  To: tomcat-user@jakarta.apache.org 
  Sent: Friday, February 16, 2001 11:23 AM
  Subject: RE: Anybody doing doPost successfully ?


  I have successfully received post data in a JSP both using the getParameter and using the
com.oreilly.servlet utility classes. 

  How are you sending the post data?  Are you using a web browser and form, or are you trying
to post it yourself using an applet or something.  The process does work, so it must be something
unique to the way you are sending the info.

  Regards,
  Paul

    -----Original Message-----
    From: Mandar Joshi [mailto:mandarj@commerceroute.com]
    Sent: Friday, February 16, 2001 1:39 PM
    To: tomcat-user@jakarta.apache.org
    Subject: Anybody doing doPost successfully ?


    Hi,
    I am still not successful in getting data in doPost. anybody is doing it successfully
?

    Regards,
    Mandar
      ----- Original Message ----- 
      From: Mandar Joshi 
      To: tomcat-user@jakarta.apache.org 
      Sent: Thursday, February 15, 2001 6:15 PM
      Subject: No Data available in doPost ?


      Hi,

      I am doing the following thing in my doPost() method.

      __________________________________________________________________________________________________________

          public void doPost(HttpServletRequest request,HttpServletResponse response) throws
ServletException, IOException
          {
               try
               {
                 InputStream ins = request.getInputStream();
                 logMsg("Bytes available " + ins.available());
               }
          }
      ____________________________________________________________________________________________________________

      I am posting some data to this servlet but I am getting the available bytes to be 0
??

      Any guess why is this happening ?

      TIA
      Mandar

Mime
View raw message