title: Remove duplicate header entries from doHeaders()
body: <p>I have several portlets which each use an aggregation of pooled CSS and JS files within a single web application. Currently each portlet will add appropriate head tags in doHeaders(). However, this causes duplicate tags within the head when more than one portlet is on the same page.</p>
  
  <p>Currently the portlets are deployed on <a href="http://www.exoplatform.com/company/en/home" rel="nofollow">eXo</a> which runs on GateIn. eXo has it's own JS AMD framework and portlet skin system, but we add head elements using doHeaders() to be as platform-agnostic as possible for risk mitigation. </p>
  
  <p>Head elements are added in the following manner:</p>
  
  <pre><code>@Override
  public void doHeaders(RenderRequest request, RenderResponse response)
  {
      Element element = response.createElement("link");
      element.setAttribute("type", "text/css");
      element.setAttribute("rel", "stylesheet");
      element.setAttribute("href", request.getContextPath() + "/service/resource/themes/stylesheet.css");
      response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, element);
  }
  </code></pre>
  
  <p>I need to remove duplicate entries from the head or prevent duplicates from being written in the first place.</p>
  
  <p>I am attempting to write a common RenderFilter which could strip duplicate head elements. But I cannot seem to get access to the current Element properties from the <a href="http://portals.apache.org/pluto/portlet-2.0-apidocs/javax/portlet/RenderResponse.html" rel="nofollow">RenderResponse</a>; I can only setProperty() or addProperty().</p>
  
  <p>I could also write the RenderFilter to replace each individual portlet's doHeaders() method and add the entire CSS and JS pool to the head. But I cannot ensure that this logic would run only per user session page render.</p>