1 Reply Latest reply on Dec 3, 2008 9:41 AM by Chris Laprun

    How to set response HTTP headers in serverResource

    jaro skraban Newbie

      Hello,

      I try to configure response header in service the resource of my portlet (new feature in 286). According to the spec ResourceResponse.setProperty should do it if invoked before ResourceResponse.setContentType - see example

      public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
      
       response.setProperty("Pragma", "public");
       response.setProperty("Expires", "0");
       response.setContentType("text/html");
       PrintWriter pw = response.getWriter();
       pw.write("Hello");
      }
      


      Unfortunately this does not work :(