3 Replies Latest reply on Apr 2, 2002 11:22 AM by Jules Gosnell


    Erik Turesson Novice


      I am using Jboss 3.0 beta2, ie the latest from CVS and I use Jetty as webserver/servlet engine.

      I have a jsp page in which I want to return an image to the client.
      Thats the only purpose of this page. I use it in my htmlpages to
      specify the source for my images.

      I have one static method in a helper class. It look like this.

      public static void downloadFile(HttpServletResponse response,
      byte[] b,
      String contentType){
      response.getOutputStream().write(b, 0, b.length);
      }catch(Exception e){
      System.out.println("downLoadFile " + e);

      My call in my jsp page looks lik this.

      image is an internal object of mine.
      image.getImage() returns byte[] and image.getContentType() returns a
      I have not used the response object before in my page or called the
      getWriter method.

      My page works fine except for that I recieve a IllegalStateException
      every time.
      The stacktrace tells that it occures in the following line of code.

      The image is however returned fine to the client.

      What is wrong?

      /Erik Turesson