You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mandar Joshi <ma...@commerceroute.com> on 2001/02/16 19:38:56 UTC

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

Re: Anybody doing doPost successfully ?

Posted by Mandar Joshi <ma...@commerceroute.com>.
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

RE: Anybody doing doPost successfully ?

Posted by CPC Livelink Admin <cp...@fitzpatrick.cc>.
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