[jboss-cvs] jboss-portal/core/src/main/org/jboss/portal/core/aspects/portlet ...
Chris Laprun
chris.laprun at jboss.com
Mon Aug 14 16:34:51 EDT 2006
User: claprun
Date: 06/08/14 16:34:51
Modified: core/src/main/org/jboss/portal/core/aspects/portlet
HeaderInterceptor.java
Log:
JBPORTAL-981:
- Added support for named meta tag. No current support for http-equiv meta tags.
- Re-factored HeaderContentMetaData.
- Cleaned-up HeaderInterceptor.
Revision Changes Path
1.2 +3 -127 jboss-portal/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: HeaderInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- HeaderInterceptor.java 11 Jul 2006 23:19:29 -0000 1.1
+++ HeaderInterceptor.java 14 Aug 2006 20:34:51 -0000 1.2
@@ -36,11 +36,10 @@
import java.util.Iterator;
/**
- * todo : possibility to optimize the writer stuff
- *
* @author <a href="mailto:mholzner at novell.com">Martin Holzner</a>
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
+ * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
+ * @version $Revision: 1.2 $
*/
public class HeaderInterceptor extends PortletInterceptor
{
@@ -58,44 +57,6 @@
RenderInvocation render = (RenderInvocation)invocation;
FragmentResult fragment = (FragmentResult)result;
- /*
- Properties props = fragment.getProperties();
-
-
- // Is there a rewrite token and a unique id to use for the rewrite ?
- String rewrite = props.getProperty(RewriteHelper.REWRITE_FLAG);
- String prefix = "jbp_" + Integer.toHexString(invocation.getWindowContext().getId().hashCode()) + "_";
- if (Boolean.valueOf(rewrite).booleanValue())
- {
- // If no namespace prefix was presented, then use the window id as the unique token
- if (props.getProperty(RewriteHelper.NAMESPACE_PREFIX) != null)
- {
- prefix = props.getProperty(RewriteHelper.NAMESPACE_PREFIX);
- }
- }
-
- // Rewrite the content only if it is a chars result
- if (fragment.getType() == FragmentResult.TYPE_CHARS)
- {
- // Get the chars out of
- StringWriter writer = fragment.getChars();
- writer.flush();
- String content = writer.toString();
-
- // If there are any rewrite tokens in the content, and rewrite
- // is requested (via the response props) then replace the rewrite token with a unique id
- content = RewriteHelper.wsrpRewriteContent(content, prefix);
- fragment.resetBuffer();
- writer.write(content);
- }
-
- // If there is content that needs to be injected into the header, check if it needs rewrite as well
- String headerChars = props.getProperty(RewriteHelper.HEADER_CONTENT);
- if (headerChars != null)
- {
- headerChars = RewriteHelper.wsrpRewriteContent(headerChars, prefix);
- }
-*/
// Add declaratively injected header content here (get it via the component)
String headerChars = fragment.getHeader(); // Chris' modif: note that the header might to be re-written...
PortletContainer container = ((ContainerPortletInfo)render.getInfo()).getContainer();
@@ -126,92 +87,7 @@
for (Iterator i = headerContent.getElements().iterator(); i.hasNext();)
{
HeaderContentMetaData.Element element = (HeaderContentMetaData.Element)i.next();
- String elementType = element.getElementType();
-
- //
- writer.write("<");
- writer.write(elementType);
-
- //
- String rel = element.getRel();
- if (rel != null)
- {
- writer.write(" rel='");
- writer.write(rel);
- writer.write("'");
- }
-
- //
- String src = element.getSrc();
- if (src != null)
- {
- // adopt the context and inject a theme id param for the theme
- // servlet to be able to pick up the resource from the correct theme
- writer.write(" src='");
- if (src.startsWith("/"))
- {
- writer.write(contextPath);
- }
- writer.write(src);
- writer.write("'");
- }
-
- //
- String type = element.getType();
- if (type != null)
- {
- writer.write(" type='");
- writer.write(type);
- writer.write("'");
- }
-
- //
- String href = element.getHref();
- if (href != null)
- {
- // adopt the context and inject a theme id param for the theme
- // servlet to be able to pick up the resource from the correct theme
- writer.write(" href='");
- if (href.startsWith("/"))
- {
- writer.write(contextPath);
- }
- writer.write(href);
- writer.write("'");
- }
-
- //
- String title = element.getTitle();
- if (title != null && !"".equals(title))
- {
- writer.write(" title='");
- writer.write(title);
- writer.write("'");
- }
-
- //
- String media = element.getMedia();
- if (media != null && !"".equals(media))
- {
- writer.write(" media='");
- writer.write(media);
- writer.write("'");
- }
-
- //
- String bodyContent = element.getBodyContent();
- if (bodyContent != null && !"".equals(bodyContent))
- {
- writer.write(">");
- writer.write(bodyContent);
- writer.write("</");
- writer.write(elementType);
- writer.write(">");
- }
- else
- {
- writer.write(" />");
- }
+ writer.write(element.outputToStringWith(contextPath));
}
}
More information about the jboss-cvs-commits
mailing list