www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alice Averbukh <...@webstreetsecurities.com>
Subject mod_jserv/4470: when a servlet is called as a SSI from jhtml page, getWriter() method doesn't work
Date Mon, 24 May 1999 23:33:14 GMT

>Number:         4470
>Category:       mod_jserv
>Synopsis:       when a servlet is called as a SSI from jhtml page, getWriter() method
doesn't work
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    jserv
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Mon May 24 16:40:01 PDT 1999
>Last-Modified:
>Originator:     ana@webstreetsecurities.com
>Organization:
apache
>Release:        1.1.3
>Environment:
Solaris
>Description:
 when a servlet is called as a SSI from jhtml page, getWriter() method of 
ServletRequest doesn't work. I found a work-around but I've
waisted a couple of hours, I think it would be a good idea to mention it
in the "README" that comes with the installation.


Right now calling getWriter() causes an exception to be thrown:

--

<!-- java.lang.IllegalStateException: Already called getOutputStream.
        at org.apache.jserv.JServConnection.getWriter(Compiled Code)
        at HelloYouToo.doGet(Compiled Code)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at org.apache.jservssi.ServletInfoRequest.runServlet(Compiled Code)
        at org.apache.jservssi.JServSSI.interpretPage(Compiled Code)
        at org.apache.jservssi.JServSSI.doGet(Compiled Code)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at org.apache.jserv.JServConnection.run(Compiled Code)
        at java.lang.Thread.run(Compiled Code)
-->
>How-To-Repeat:
Here is what's contained in my .jhtml file, 

<SERVLET NAME="HelloYouToo">
</SERVLET>


-----
My HelloYouToo servlet contains the following code:

----

public class HelloYouToo extends HttpServlet
{ 
  

 public void doGet (HttpServletRequest request,
		      HttpServletResponse response)
    throws ServletException, IOException {
      
      PrintWriter out = response.getWriter();
      
      out.println("<center><BR><BR><BR><BR> HELLO YOU TOO! <BR><BR><BR>");
    
   }

}

>Fix:
No, but her's a work-around.

The work-around is to call:

PrintWriter outWrite = new PrintWriter(response.getOutputStream(), true);
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <apbugs@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or      ]
["Re: general/1098:").  If the subject doesn't match this       ]
[pattern, your message will be misfiled and ignored.  The       ]
["apbugs" address is not added to the Cc line of messages from  ]
[the database automatically because of the potential for mail   ]
[loops.  If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request from a  ]
[developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]




Mime
View raw message