Author: mwringe
Date: 2010-02-26 11:12:40 -0500 (Fri, 26 Feb 2010)
New Revision: 1886
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/workspace/UIPortalApplication.gtmpl
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
Log:
Return the markup headers as strings instead of elements so that we can print the markup
headers without the xml encoding line (GTNPORTAL-762).
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/workspace/UIPortalApplication.gtmpl
===================================================================
---
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/workspace/UIPortalApplication.gtmpl 2010-02-26
14:54:09 UTC (rev 1885)
+++
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/workspace/UIPortalApplication.gtmpl 2010-02-26
16:12:40 UTC (rev 1886)
@@ -89,7 +89,7 @@
<script type="text/javascript"
src="/eXoResources/javascript/eXo/i18n/MessageResource_<%=lang%>.js"></script>
<%
- def headerElements = rcontext.getExtraMarkupHeaders();
+ def headerElements = rcontext.getExtraMarkupHeadersAsStrings();
if (headerElements != null)
{
for (element in headerElements)
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-02-26
14:54:09 UTC (rev 1885)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-02-26
16:12:40 UTC (rev 1886)
@@ -42,7 +42,14 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
import java.io.IOException;
+import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.net.URLDecoder;
@@ -355,6 +362,27 @@
}
}
+ public List<String> getExtraMarkupHeadersAsStrings() throws Exception
+ {
+ List<String> markupHeaders = new ArrayList<String>();
+
+ if (extraMarkupHeaders != null && !extraMarkupHeaders.isEmpty())
+ {
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,
"yes");
+
+ for (Element element : extraMarkupHeaders)
+ {
+ DOMSource source = new DOMSource(element);
+ StreamResult result = new StreamResult(new StringWriter());
+ transformer.transform(source, result);
+ markupHeaders.add(result.getWriter().toString());
+ }
+ }
+
+ return markupHeaders;
+ }
+
/**
* Get the extra markup headers to add to the head of the html.
* @return The markup to be added.
Show replies by date