Hi,
request.getInputStream() always gives me an empty stream, even though
request.getContentLength() is non-zero (18)!
public class TestServlet extends HttpServlet {
ResourceBundle rb = ResourceBundle.getBundle("LocalStrings");
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
InputStream inputStream = request.getInputStream();
int length = request.getContentLength(); // 18
String contentType= request.getContentType();
// application/x-www-form-urlencoded
int bytesAvailable = inputStream.available(); // 0
byte[] buf = new byte[1024];
int bytesread;
// bytesread is always -1
while((bytesread = inputStream.read(buf)) != -1)
{
// do stuff
}
}
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
doGet(request, response);
}
}
So bytesAvailable () is always 0, and inputStream.read(buf) immediately
returns -1.
Could there be something wrong with the configuration of Tomcat? If so,
what could it be?
I'm using Tomcat 5.0.25.
Thanks in advance,
Rob
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
_
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]