[jboss-user] [JBoss Portal] - How to set response HTTP headers in serverResource

jaro777 do-not-reply at jboss.com
Wed Dec 3 08:55:42 EST 2008


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 :(

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4194040#4194040

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4194040



More information about the jboss-user mailing list