Second time request.getInputStream() returns -1.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #1

    Second time request.getInputStream() returns -1.

    I am calling two methods having request object.
    In two method I am retrieving ServletInputStr eam using request.getInpu tStream.
    For first method call it's working fine but for second method call it's not working.

    [code=java]
    .....
    .....
    method1(request );
    method2(request );
    .....
    .....


    void method1(HttpSer vlet request){
    ServletInputStr eam in = request.getInpu tStream();
    byte []b = new byte[128];
    int i = in.readLine(b,0 ,128);
    System.out.prin tln("The i: " + i);
    }

    void method2(HttpSer vlet request){
    ServletInputStr eam in = request.getInpu tStream();
    byte []b = new byte[128];
    int i = in.readLine(b,0 ,128);
    System.out.prin tln("The i: " + i);
    }
    [/code]

    First time it's returning the expected value but ..... second tome it's returning -1.

    What could be the reason?
    Please help!

    Debasis Jana.
    Debasis Jana.
Working...