1

I want to add a HTTP header property to a RenderResponse.

I've written a RenderFilter with which I gain access to the RenderResponse. Unfortunately, when I call setProperty and set a property, it never gets to the client. I'm checking this with Firebug.

The response hasn't been comitted before.

  • 1
    What portal server are you using? I don't think there is a standard way to achieve this. From the documentation I see no relation between response properties and http headers. After all, the response from portal to the browser might have already been committed by the time your portlet gets rendered. – Jörn Horstmann Nov 23 '11 at 09:42
  • Would this be possible with Seam? –  Nov 23 '11 at 17:22

1 Answers1

0

JBoss 4.2.3 would be the Application Server version, the portal version is then probably 2.6.x or 2.7, right?

The portlet 2.0 api supported in portal 2.7 would allow you to set cache related properties using constants defined in MimeResponse. But I guess these also only apply to the communication between portal and portlet and don't get passed on to the browser.

It might be possible to set HTTP headers using a custom layout implemented as a jsp. A scriptlet on that page should then have access to the actual response stream send to the browser.

Jörn Horstmann
  • 33,639
  • 11
  • 75
  • 118
  • Yes, the portal version is 2.7. Would this be somehow possible with Seam? –  Nov 23 '11 at 19:24
  • And since my site is a portlet running in a portal, I guess that such a scriptlet would be called "to late", wouldn't it? –  Nov 23 '11 at 19:27
  • I see no way that a portlet could tell the portal to send a specific header to the browser, using seam in the portlet would not change that. Maybe you could describe what header you want to set or which problem you want to solve with it, so we could think of a different way to solve it. – Jörn Horstmann Nov 23 '11 at 20:12
  • I want to set this property: https://blogs.msdn.com/themes/blogs/generic/post.aspx?WeblogApp=ie&y=2008&m=06&d=10&WeblogPostName=introducing-ie-emulateie7&GroupKeys= Unfortunately I can't embed the meta tag since it won't be the first one. –  Nov 23 '11 at 20:33
  • 1
    The reference guide contains an example to set the page title (http://docs.jboss.org/jbportal/v2.7.1/referenceGuide/html_single/#d0e6942). Similar code could be used to add a meta tag, but it also is not guaranteed to be the first meta tag inside the html head. Since setting this header or meta tag affects all portlets on a page I think it would be best to set it from a custom portal layout or modify the layouts deployed in `jboss-portal.sar/portal-core.war/layouts`. – Jörn Horstmann Nov 23 '11 at 21:06
  • Thank you for the tip. But unfortunately, the `meta` tag is not the first one. –  Nov 24 '11 at 08:22