0 Replies Latest reply on Jun 11, 2003 5:51 PM by nuprn1

    jetty setCharacterEncoding issue

    nuprn1 Newbie

      Hello all,

      We have moved our apps from jboss/tomcat to jboss/jetty and ran into a small hiccup.

      I have yet to run into any othe issues using the MultipartWrapper for uploading files(in jetty), this seems to be isolated to calling setCharacterEncoding.

      "This method must be called prior to reading request parameters or reading input using getReader()."


      jboss3.2.0RC3 | jetty 4.2.9 | java1.4

      <SNIP!>
      com.oreilly.servlet.MultipartWrapper

      public void doPost ( HttpServletRequest request , HttpServletResponse response ) throws ServletException {
      doPostOrGet(request,response);
      }

      private void doPostOrGet ( HttpServletRequest request , HttpServletResponse response ) throws ServletException {

      if (request instanceof MultipartWrapper) {

      try {

      // Cast the request to a MultipartWrapper
      MultipartWrapper multi = (MultipartWrapper) request;

      request.setCharacterEncoding("UTF8");
      </SNIP!>



      2003-06-11 14:19:48,901 WARN [org.jboss.jbossweb] WARNING: Exception for /tools/psd/SingleHeadTextGenerator
      java.lang.IllegalStateException: getReader() or getInputStream() called
      at org.mortbay.jetty.servlet.ServletHttpRequest.setCharacterEncoding(ServletHttpRequest.java:601)
      at javax.servlet.ServletRequestWrapper.setCharacterEncoding(ServletRequestWrapper.java:158)
      at com.adobe.wtgtools.psd.ui.SingleHeadTextServlet.doPostOrGet(SingleHeadTextServlet.java:104)
      at com.adobe.wtgtools.psd.ui.SingleHeadTextServlet.doPost(SingleHeadTextServlet.java:93)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
      at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:326)
      at com.oreilly.servlet.MultipartFilter.doFilter(MultipartFilter.java:62)
      at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:318)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:270)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:558)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1713)
      at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:550)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1663)
      at org.mortbay.http.HttpServer.service(HttpServer.java:863)
      at org.jboss.jetty.Jetty.service(Jetty.java:470)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:773)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:937)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:790)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:201)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)