3 Replies Latest reply on Dec 12, 2008 5:12 AM by Kevin Conner

    Returning image and setting http headers

    S Shetty Newbie

      Hi,

      We have an existing system that uses servlets. We are replacing the system to use JBoss ESB.

      One of our servlets, sets http headers on the response. And also returns a jpeg image (written to the OutputStream of response).

      The current code does something on these lines:

       response.setHeader("Cache-Control", "no-store");
       response.setDateHeader("Expires", 0);
       response.setContentType("image/jpeg");
       ServletOutputStream responseOutputStream = response.getOutputStream();
       responseOutputStream.write(jprgImage);
       responseOutputStream.flush();
       responseOutputStream.close();
      


      Can this be done using the jbr-provider ?

      I tried to set the header params using HttpResponse. but that doesnt appear to work.
       HttpResponse resp = new HttpResponse(200);
       resp.addHeader(new HttpHeader("Expires", "0"));
       message.getBody().add(HttpResponse.RESPONSE_KEY, resp);
       return message;
      


      Any help appreciated.

      Thanks

      :)
      SShetty