empty input string

From: No Spam (nospam.invalid_at_verizon.net)
Date: 01/27/04


Date: Tue, 27 Jan 2004 19:43:50 GMT

I have a Java class called from a servlet that runs fine on Win2000
Tomcat but gives an empty InputStream each time I try it on a Unix
Solaris machine. Both the Win2000 PC and Unix machine are using J2SDK
1.4.2 and Tomcat 4.1.24.
At this point I'm just trying to display the request contents. Here is a
snippet:

    public void processRequest(HttpServletRequest httpRequest) {

        System.out.println("Request length is " +
httpRequest.getContentLength() + " bytes.");

        InputStream is = null;

        try {
            is = request.getInputStream();
        }
        catch (java.io.IOException e) {
            System.out.println("Error getting input stream from HTTP
request.");
        }

        System.out.println("== BEGIN ==");
        try {
            java.io.InputStreamReader in = new
java.io.InputStreamReader(is, "UTF-8");
            java.io.BufferedReader data = new java.io.BufferedReader(in);
            String line;
            while ((line = data.readLine()) != null) {
                System.out.println(line);
            }
        } catch (java.io.IOException e) {
            System.out.println("IO Error: " + e.getMessage());
        }
        System.out.println("== END ==");

The content length is always correct so there must be something I am
missing with the input stream.
I see all the request contents on Win2000 but see only
== BEGIN ==
== END ==
on the Unix machine.

This has been quite a sticky problem so ANY help is appreciated.

Thanks,
T



Relevant Pages

  • empty input string
    ... Tomcat but gives an empty InputStream each time I try it on a Unix ... Both the Win2000 PC and Unix machine are using J2SDK ... At this point I'm just trying to display the request contents. ...
    (comp.lang.java.programmer)
  • Re: Tomcat 3.2.4 problem after response.sendRedirect(...)
    ... > I am currently struggling with a Tomcat issue. ... When I send a redirect within the service method of my controller ... coming in before the thread in which the original request was processed ... you're not trying to cache request objects or the ...
    (comp.lang.java.programmer)
  • Re: how does an application server works?
    ... i assume that tomcat5.exe takes this request and start processing. ... I think the first thing you need to ask is which applications are installed on that Tomcat instance, and what do their config files say they will do? ... Yes I'm being lazy, but that should get you started... ... So I guess one of the first things it does is look for a default page, which might be a JSP, and then compile that before serving it up. ...
    (comp.lang.java.programmer)
  • Re: Using HttpURLConnection to POST to Servlet in Tomcat 5 results in GET not POST on server side
    ... > system worked fine with Tomcat 4.1.18: the servlet was invoked with a POST ... > request and it could read the content of the request using an InputStream. ...
    (comp.lang.java)
  • Re: [Tomcat] Sehr viele Requests verarbeiten
    ... Ich meine, wenn du PHP durch Java (Tomcat) ersetzt, die Datenbank aber gleich bleibt und die Zeit im Request im wesentlichen in der DB verbracht wird, wird dir Java nichts bringen. ... das Problem bei PHP ist eben das ständige "Neuübersetzen" und das PHP nach dem Ausliefern des Bildes eben noch beschäftigt ist, die Daten an die DB loszuwerden. ...
    (de.comp.lang.java)