JBoss Portal SVN: r6203 - trunk/core/src/main/org/jboss/portal/core/util/markup.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-09 21:21:09 -0500 (Fri, 09 Feb 2007)
New Revision: 6203
Modified:
trunk/core/src/main/org/jboss/portal/core/util/markup/Element.java
Log:
some javadoc to explain the use case of the empty Element field.
Modified: trunk/core/src/main/org/jboss/portal/core/util/markup/Element.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/util/markup/Element.java 2007-02-10 02:16:20 UTC (rev 6202)
+++ trunk/core/src/main/org/jboss/portal/core/util/markup/Element.java 2007-02-10 02:21:09 UTC (rev 6203)
@@ -35,7 +35,12 @@
/** . */
final String bodyContent;
- /** . */
+ /**
+ * If empty is false and the body content is null then we will output the start tag and
+ * the end tag instead of an empty tag. The use case is for the script element which
+ * when it is empty raise issues on IE, so it start element and end element have to be
+ * used.
+ */
final boolean empty;
/** . */
19 years, 2 months
JBoss Portal SVN: r6202 - in trunk: core/src/main/org/jboss/portal/core/deployment and 6 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-09 21:16:20 -0500 (Fri, 09 Feb 2007)
New Revision: 6202
Added:
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/NamedMetaElementMetaData.java
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ScriptElementMetaData.java
trunk/core/src/main/org/jboss/portal/core/util/markup/
trunk/core/src/main/org/jboss/portal/core/util/markup/Attribute.java
trunk/core/src/main/org/jboss/portal/core/util/markup/Element.java
Modified:
trunk/core-samples/src/resources/portal-samples-war/WEB-INF/jboss-portlet.xml
trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
trunk/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java
trunk/core/src/main/org/jboss/portal/core/metadata/portlet/HeaderContentMetaData.java
trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java
trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
Log:
JBPORTAL-1246 : Error while creating javascript includes using jboss-portlet.xml
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2007-02-09 23:32:40 UTC (rev 6201)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/portlet/HeaderInterceptor.java 2007-02-10 02:16:20 UTC (rev 6202)
@@ -25,6 +25,8 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.core.metadata.portlet.HeaderContentMetaData;
import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
+import org.jboss.portal.core.metadata.portlet.ElementMetaData;
+import org.jboss.portal.core.util.markup.Element;
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
import org.jboss.portal.portlet.invocation.PortletInterceptor;
@@ -85,8 +87,9 @@
{
for (Iterator i = headerContent.getElements().iterator(); i.hasNext();)
{
- HeaderContentMetaData.Element element = (HeaderContentMetaData.Element)i.next();
- writer.write(element.outputToStringWith(contextPath));
+ ElementMetaData elementMD = (ElementMetaData)i.next();
+ Element element = elementMD.getElement();
+ writer.write(element.toString(contextPath));
}
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java 2007-02-09 23:32:40 UTC (rev 6201)
+++ trunk/core/src/main/org/jboss/portal/core/deployment/JBossApplicationMetaDataFactory.java 2007-02-10 02:16:20 UTC (rev 6202)
@@ -26,6 +26,7 @@
import org.jboss.portal.core.metadata.portlet.HeaderContentMetaData;
import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
+import org.jboss.portal.core.metadata.portlet.ElementMetaData;
import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
@@ -76,28 +77,25 @@
String type = attrs.getValue("type");
String media = attrs.getValue("media");
String rel = attrs.getValue("rel");
- child = HeaderContentMetaData.Element.createLinkElement(type, rel, href, title, media);
+ ElementMetaData elt = ElementMetaData.createLinkElement(type, rel, href, title, media);
+ elt.init();
+ child = elt;
}
else if ("script".equalsIgnoreCase(localName))
{
String src = attrs.getValue("src");
String type = attrs.getValue("type");
- child = HeaderContentMetaData.Element.createScriptElement(type, src);
+ ElementMetaData elt = ElementMetaData.createScriptElement(type, src);
+ elt.init();
+ child = elt;
}
else if ("meta".equalsIgnoreCase(localName))
{
String name = attrs.getValue("name");
String content = attrs.getValue("content");
- if (name == null)
- {
- throw new IllegalArgumentException("'name' attribute of meta element must NOT be null. http-equiv meta " +
- "elements are not currently supported.");
- }
- if (content == null)
- {
- throw new IllegalArgumentException("Content attribute required for meta element: " + name);
- }
- child = HeaderContentMetaData.Element.createNamedMetaElement(name, content);
+ ElementMetaData elt = ElementMetaData.createNamedMetaElement(name, content);
+ elt.init();
+ child = elt;
}
}
if (child == null)
@@ -121,9 +119,9 @@
JBossPortletMetaData portlet = (JBossPortletMetaData)parent;
portlet.setHeaderContent(headerContent);
}
- else if (child instanceof HeaderContentMetaData.Element)
+ else if (child instanceof ElementMetaData)
{
- HeaderContentMetaData.Element element = (HeaderContentMetaData.Element)child;
+ ElementMetaData element = (ElementMetaData)child;
HeaderContentMetaData headerContent = (HeaderContentMetaData)parent;
headerContent.getElements().add(element);
}
@@ -151,12 +149,13 @@
service.setRef(value);
}
}
- else if (object instanceof HeaderContentMetaData.Element)
+ else if (object instanceof ElementMetaData)
{
if ("script".equals(localName))
{
- HeaderContentMetaData.Element element = (HeaderContentMetaData.Element)object;
- element.setBodyContent(value);
+ ElementMetaData elt = (ElementMetaData)object;
+ elt.setBodyContent(value);
+ elt.init();
}
}
else
Added: trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ElementMetaData.java 2007-02-10 02:16:20 UTC (rev 6202)
@@ -0,0 +1,113 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.metadata.portlet;
+
+import org.jboss.portal.core.util.markup.Element;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class ElementMetaData
+{
+
+ /** . */
+ protected final String typeAttribute;
+
+ /** . */
+ protected String bodyContent;
+
+ /** . */
+ protected Element element;
+
+ protected ElementMetaData(String typeAttribute)
+ {
+ this.typeAttribute = typeAttribute;
+ }
+
+ public void init()
+ {
+ element = buildElement();
+ }
+
+ protected abstract Element buildElement();
+
+ public Element getElement()
+ {
+ return element;
+ }
+
+ public String getTypeAttribute()
+ {
+ return typeAttribute;
+ }
+
+ public String getBodyContent()
+ {
+ return bodyContent;
+ }
+
+ public void setBodyContent(String bodyContent)
+ {
+ this.bodyContent = bodyContent;
+ }
+
+ /**
+ * Create a meta header element. <p>This element will create a meta tag.</p>
+ *
+ * @param name name attribute of the meta element
+ * @param content content attribute of the meta element
+ * @return a new meta header element
+ */
+ public static ElementMetaData createNamedMetaElement(String name, String content)
+ {
+ return new NamedMetaElementMetaData(name, content);
+ }
+
+ /**
+ * Create a link header element. <p>This element will create a link tag.</p>
+ *
+ * @param type the type attribute of the link
+ * @param rel the rel attribute of the link
+ * @param href the href attribute of the link
+ * @param title the title attribute of the link
+ * @param media the media attribute of the link
+ * @return a new link header element
+ */
+ public static ElementMetaData createLinkElement(String type, String rel, String href, String title, String media)
+ {
+ return new LinkElementMetaData(rel, type, href, title, media);
+ }
+
+ /**
+ * Create a script header element. <p>This element will create a script tag.</p>
+ *
+ * @param type the type attribute of this script
+ * @param src the src attribute of this script
+ * @return a new script header element
+ */
+ public static ElementMetaData createScriptElement(String type, String src)
+ {
+ return new ScriptElementMetaData(type, src);
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/core/metadata/portlet/HeaderContentMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/portlet/HeaderContentMetaData.java 2007-02-09 23:32:40 UTC (rev 6201)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/portlet/HeaderContentMetaData.java 2007-02-10 02:16:20 UTC (rev 6202)
@@ -53,244 +53,4 @@
{
return elements;
}
-
- /** representation of an header element. */
- public static abstract class Element
- {
-
- /** . */
- public static final String LINK = "link";
-
- /** . */
- public static final String SCRIPT = "script";
-
- /** . */
- public static final String META = "meta";
-
- /** . */
- protected final String type;
-
- /** . */
- protected final String elementType;
-
- /** . */
- private String bodyContent;
-
- protected Element(String elementType, String type)
- {
- this.type = type;
- this.elementType = elementType;
- }
-
- public String getElementType()
- {
- return elementType;
- }
-
- public String getType()
- {
- return type;
- }
-
- /**
- * Create a link header element. <p>This element will create a link tag.</p>
- *
- * @param type the type attribute of the link
- * @param rel the rel attribute of the link
- * @param href the href attribute of the link
- * @param title the title attribute of the link
- * @param media the media attribute of the link
- * @return a new link header element
- */
- public static Element createLinkElement(String type, String rel, String href, String title, String media)
- {
- return new LinkElement(rel, type, href, title, media);
- }
-
- /**
- * Create a script header element. <p>This element will create a script tag.</p>
- *
- * @param type the type attribute of this script
- * @param src the src attribute of this script
- * @return a new script header element
- */
- public static Element createScriptElement(String type, String src)
- {
- return new ScriptElement(type, src);
- }
-
- public String getBodyContent()
- {
- return bodyContent;
- }
-
- public void setBodyContent(String bodyContent)
- {
- this.bodyContent = bodyContent;
- }
-
-
- public String outputToStringWith(String contextPath)
- {
- StringBuffer buffer = new StringBuffer(64);
- buffer.append("<").append(elementType);
- outputAttribute("type", type, buffer);
-
- // sub-class specific output
- outputSpecificWith(contextPath, buffer);
-
- if (bodyContent != null && !"".equals(bodyContent))
- {
- buffer.append(">").append(bodyContent).append("</").append(elementType).append(">\n");
- }
- else
- {
- buffer.append(" />\n");
- }
- return buffer.toString();
- }
-
- protected void outputAttribute(String name, String value, StringBuffer buffer)
- {
- if (value != null && value.length() > 0)
- {
- buffer.append(" ").append(name).append("='").append(value).append("'");
- }
- }
-
- protected void outputLocationAttribute(String name, String value, String contextPath, StringBuffer buffer)
- {
- if (value != null)
- {
- buffer.append(" ").append(name).append("='");
- if (value.startsWith("/"))
- {
- buffer.append(contextPath);
- }
- buffer.append(value).append("'");
- }
- }
-
- protected abstract void outputSpecificWith(String contextPath, StringBuffer buffer);
- /**
- * Create a meta header element. <p>This element will create a meta tag.</p>
- *
- * @param name name attribute of the meta element
- * @param content content attribute of the meta element
- * @return a new meta header element
- */
- public static Element createNamedMetaElement(String name, String content)
- {
- return new NamedMetaElement(name, content);
- }
- }
-
- public static class LinkElement extends Element
- {
-
- /** . */
- private String rel;
-
- /** . */
- private String href;
-
- /** . */
- private String title;
-
- /** . */
- private String media;
-
- public LinkElement(String rel, String type, String href, String title, String media)
- {
- super(LINK, type);
- this.rel = rel;
- this.href = href;
- this.title = title;
- this.media = media;
- }
-
- public String getRel()
- {
- return rel;
- }
-
- public String getHref()
- {
- return href;
- }
-
- public String getTitle()
- {
- return title;
- }
-
- public String getMedia()
- {
- return media;
- }
-
- protected void outputSpecificWith(String contextPath, StringBuffer buffer)
- {
- outputAttribute("rel", rel, buffer);
- outputLocationAttribute("href", href, contextPath, buffer);
- outputAttribute("title", title, buffer);
- outputAttribute("media", media, buffer);
- }
- }
-
- public static class ScriptElement extends Element
- {
-
- /** . */
- private String src;
-
- public ScriptElement(String type, String src)
- {
- super(SCRIPT, type);
- this.src = src;
- }
-
- protected void outputSpecificWith(String contextPath, StringBuffer buffer)
- {
- outputLocationAttribute("src", src, contextPath, buffer);
- }
-
- public String getSrc()
- {
- return src;
- }
- }
-
- public static class NamedMetaElement extends Element
- {
-
- /** . */
- private String name;
-
- /** . */
- private String content;
-
- public NamedMetaElement(String name, String content)
- {
- super(META, null);
- this.name = name;
- this.content = content;
- }
-
- protected void outputSpecificWith(String contextPath, StringBuffer buffer)
- {
- outputAttribute("name", name, buffer);
- outputAttribute("content", content, buffer);
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getContent()
- {
- return content;
- }
- }
}
Added: trunk/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/portlet/LinkElementMetaData.java 2007-02-10 02:16:20 UTC (rev 6202)
@@ -0,0 +1,105 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.metadata.portlet;
+
+import org.jboss.portal.core.util.markup.Element;
+import org.jboss.portal.core.util.markup.Attribute;
+
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class LinkElementMetaData extends ElementMetaData
+{
+
+ /** . */
+ private String relAttribute;
+
+ /** . */
+ private String hrefAttribute;
+
+ /** . */
+ private String titleAttribute;
+
+ /** . */
+ private String mediaAttribute;
+
+ public LinkElementMetaData(String rel, String type, String href, String title, String media)
+ {
+ super(type);
+
+ //
+ this.relAttribute = rel;
+ this.hrefAttribute = href;
+ this.titleAttribute = title;
+ this.mediaAttribute = media;
+ }
+
+ public Element buildElement()
+ {
+ ArrayList attributes = new ArrayList(5);
+ if (typeAttribute != null && typeAttribute.length() > 0)
+ {
+ attributes.add(new Attribute("type", typeAttribute, false));
+ }
+ if (relAttribute != null && relAttribute.length() > 0)
+ {
+ attributes.add(new Attribute("rel", relAttribute, false));
+ }
+ if (hrefAttribute != null && hrefAttribute.length() > 0)
+ {
+ attributes.add(new Attribute("href", hrefAttribute, true));
+ }
+ if (titleAttribute != null && titleAttribute.length() > 0)
+ {
+ attributes.add(new Attribute("title", titleAttribute, false));
+ }
+ if (mediaAttribute != null && mediaAttribute.length() > 0)
+ {
+ attributes.add(new Attribute("media", mediaAttribute, false));
+ }
+ return new Element("link", null, true, (Attribute[])attributes.toArray(new Attribute[attributes.size()]));
+ }
+
+ public String getRelAttribute()
+ {
+ return relAttribute;
+ }
+
+ public String getHrefAttribute()
+ {
+ return hrefAttribute;
+ }
+
+ public String getTitleAttribute()
+ {
+ return titleAttribute;
+ }
+
+ public String getMediaAttribute()
+ {
+ return mediaAttribute;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/metadata/portlet/NamedMetaElementMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/portlet/NamedMetaElementMetaData.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/portlet/NamedMetaElementMetaData.java 2007-02-10 02:16:20 UTC (rev 6202)
@@ -0,0 +1,90 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.metadata.portlet;
+
+import org.jboss.portal.core.util.markup.Element;
+import org.jboss.portal.core.util.markup.Attribute;
+
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class NamedMetaElementMetaData extends ElementMetaData
+{
+
+ /** . */
+ private String nameAttribute;
+
+ /** . */
+ private String contentAttribute;
+
+ public NamedMetaElementMetaData(String name, String content)
+ {
+ super(null);
+
+ //
+ if (name == null)
+ {
+ throw new IllegalArgumentException("'name' attribute of meta element must NOT be null. http-equiv meta " +
+ "elements are not currently supported.");
+ }
+ if (content == null)
+ {
+ throw new IllegalArgumentException("Content attribute required for meta element: " + name);
+ }
+
+ //
+ this.nameAttribute = name;
+ this.contentAttribute = content;
+ }
+
+ public String getNameAttribute()
+ {
+ return nameAttribute;
+ }
+
+ public String getContentAttribute()
+ {
+ return contentAttribute;
+ }
+
+ public Element buildElement()
+ {
+ ArrayList attributes = new ArrayList(3);
+ if (typeAttribute != null && typeAttribute.length() > 0)
+ {
+ attributes.add(new Attribute("type", typeAttribute, false));
+ }
+ if (nameAttribute != null && nameAttribute.length() > 0)
+ {
+ attributes.add(new Attribute("name", nameAttribute, false));
+ }
+ if (contentAttribute != null && contentAttribute.length() > 0)
+ {
+ attributes.add(new Attribute("content", contentAttribute, false));
+ }
+ return new Element("meta", null, true, (Attribute[])attributes.toArray(new Attribute[attributes.size()]));
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ScriptElementMetaData.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ScriptElementMetaData.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/metadata/portlet/ScriptElementMetaData.java 2007-02-10 02:16:20 UTC (rev 6202)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.metadata.portlet;
+
+import org.jboss.portal.core.util.markup.Element;
+import org.jboss.portal.core.util.markup.Attribute;
+
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ScriptElementMetaData extends ElementMetaData
+{
+
+ /** . */
+ private String srcAttribute;
+
+ public ScriptElementMetaData(String type, String src)
+ {
+ super(type);
+
+ //
+ this.srcAttribute = src;
+ }
+
+ protected String getElementValue()
+ {
+ return "script";
+ }
+
+ public Element buildElement()
+ {
+ ArrayList attributes = new ArrayList(2);
+ if (typeAttribute != null && typeAttribute.length() > 0)
+ {
+ attributes.add(new Attribute("type", typeAttribute, false));
+ }
+ if (srcAttribute != null && srcAttribute.length() > 0)
+ {
+ attributes.add(new Attribute("src", srcAttribute, true));
+ }
+ return new Element("script", null, false, (Attribute[])attributes.toArray(new Attribute[attributes.size()]));
+ }
+
+ public String getSrcAttribute()
+ {
+ return srcAttribute;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/util/markup/Attribute.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/util/markup/Attribute.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/util/markup/Attribute.java 2007-02-10 02:16:20 UTC (rev 6202)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.util.markup;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class Attribute
+{
+
+ /** . */
+ final String name;
+
+ /** . */
+ final String value;
+
+ /** . */
+ final boolean location;
+
+ public Attribute(String name, String value, boolean location)
+ {
+ this.name = name;
+ this.value = value;
+ this.location = location;
+ }
+}
Added: trunk/core/src/main/org/jboss/portal/core/util/markup/Element.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/util/markup/Element.java (rev 0)
+++ trunk/core/src/main/org/jboss/portal/core/util/markup/Element.java 2007-02-10 02:16:20 UTC (rev 6202)
@@ -0,0 +1,91 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.util.markup;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class Element
+{
+
+ /** . */
+ final String name;
+
+ /** . */
+ final String bodyContent;
+
+ /** . */
+ final boolean empty;
+
+ /** . */
+ final Attribute[] attributes;
+
+ public Element(String name, String bodyContent, boolean empty, Attribute[] attributes)
+ {
+ this.name = name;
+ this.bodyContent = bodyContent;
+ this.empty = empty;
+ this.attributes = attributes;
+ }
+
+ public String toString(String contextPath)
+ {
+ if (contextPath == null)
+ {
+ throw new IllegalArgumentException("No context path provided");
+ }
+ StringBuffer buffer = new StringBuffer(64);
+ buffer.append("<").append(name);
+ for (int i = 0;i < attributes.length;i++)
+ {
+ Attribute attribute = attributes[i];
+ if (attribute.location)
+ {
+ buffer.append(" ").append(attribute.name).append("=\"");
+ if (attribute.value.startsWith("/"))
+ {
+ buffer.append(contextPath);
+ }
+ buffer.append(attribute.value).append('"');
+ }
+ else
+ {
+ buffer.append(" ").append(attribute.name).append("=\"").append(attribute.value).append('"');
+ }
+ }
+ if (bodyContent != null && bodyContent.length() > 0)
+ {
+ buffer.append(">").append(bodyContent).append("</").append(name).append(">\n");
+ }
+ else if (empty)
+ {
+ buffer.append("/>\n");
+ }
+ else
+ {
+ buffer.append(">").append("</").append(name).append(">\n");
+ }
+ return buffer.toString();
+ }
+}
Modified: trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java 2007-02-09 23:32:40 UTC (rev 6201)
+++ trunk/core/src/main/org/jboss/portal/test/core/deployment/JBossApplicationMetaDataFactoryTestCase.java 2007-02-10 02:16:20 UTC (rev 6202)
@@ -29,6 +29,9 @@
import org.jboss.portal.core.metadata.portlet.HeaderContentMetaData;
import org.jboss.portal.core.metadata.portlet.JBossApplicationMetaData;
import org.jboss.portal.core.metadata.portlet.JBossPortletMetaData;
+import org.jboss.portal.core.metadata.portlet.LinkElementMetaData;
+import org.jboss.portal.core.metadata.portlet.ScriptElementMetaData;
+import org.jboss.portal.core.metadata.portlet.NamedMetaElementMetaData;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -74,23 +77,20 @@
List elements = headerContent.getElements();
assertEquals(3, elements.size());
- HeaderContentMetaData.LinkElement link = (HeaderContentMetaData.LinkElement)elements.get(0);
- assertEquals(HeaderContentMetaData.Element.LINK, link.getElementType());
- assertEquals("text/css", link.getType());
- assertEquals("stylesheet", link.getRel());
- assertEquals("stylesheet title", link.getTitle());
- assertEquals("screen", link.getMedia());
- assertEquals("test.css", link.getHref());
+ LinkElementMetaData link = (LinkElementMetaData)elements.get(0);
+ assertEquals("text/css", link.getTypeAttribute());
+ assertEquals("stylesheet", link.getRelAttribute());
+ assertEquals("stylesheet title", link.getTitleAttribute());
+ assertEquals("screen", link.getMediaAttribute());
+ assertEquals("test.css", link.getHrefAttribute());
- HeaderContentMetaData.ScriptElement script = (HeaderContentMetaData.ScriptElement)elements.get(1);
- assertEquals(HeaderContentMetaData.Element.SCRIPT, script.getElementType());
- assertEquals("text/javascript", script.getType());
- assertEquals("test.js", script.getSrc());
+ ScriptElementMetaData script = (ScriptElementMetaData)elements.get(1);
+ assertEquals("text/javascript", script.getTypeAttribute());
+ assertEquals("test.js", script.getSrcAttribute());
- HeaderContentMetaData.NamedMetaElement meta = (HeaderContentMetaData.NamedMetaElement)elements.get(2);
- assertEquals(HeaderContentMetaData.Element.META, meta.getElementType());
- assertNull(meta.getType());
- assertEquals("description", meta.getName());
- assertEquals("test content", meta.getContent());
+ NamedMetaElementMetaData meta = (NamedMetaElementMetaData)elements.get(2);
+ assertNull(meta.getTypeAttribute());
+ assertEquals("description", meta.getNameAttribute());
+ assertEquals("test content", meta.getContentAttribute());
}
}
Modified: trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
===================================================================
--- trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2007-02-09 23:32:40 UTC (rev 6201)
+++ trunk/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2007-02-10 02:16:20 UTC (rev 6202)
@@ -159,7 +159,7 @@
todo
-->
<!ATTLIST meta
- name CDATA #IMPLIED
+ name CDATA #REQUIRED
content CDATA #REQUIRED>
<!--
Modified: trunk/core-samples/src/resources/portal-samples-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core-samples/src/resources/portal-samples-war/WEB-INF/jboss-portlet.xml 2007-02-09 23:32:40 UTC (rev 6201)
+++ trunk/core-samples/src/resources/portal-samples-war/WEB-INF/jboss-portlet.xml 2007-02-10 02:16:20 UTC (rev 6202)
@@ -37,7 +37,7 @@
<portlet-name>HeaderContentPortlet</portlet-name>
<remotable>false</remotable>
<header-content>
- <link rel="stylesheet" type="text/css" href="/portlet-styles/HeaderContent.css" title="" media="screen"/>
+ <link rel="stylesheet" type="text/css" href="/portlet-styles/HeaderContent.css" media="screen"/>
<script type="text/javascript" src="/portlet-styles/HeaderContent.js"/>
<meta name="description" content="test"/>
</header-content>
19 years, 2 months
JBoss Portal SVN: r6201 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-09 18:32:40 -0500 (Fri, 09 Feb 2007)
New Revision: 6201
Modified:
docs/trunk/referenceGuide/en/modules/wsrp.xml
Log:
- Updated for 2.6 (still needs more work).
- Added section on Producer configuration.
- Added section on using SSL.
- Fixed an issue with one of the given examples (xml was invalid).
- General improvements.
Modified: docs/trunk/referenceGuide/en/modules/wsrp.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/wsrp.xml 2007-02-09 23:10:31 UTC (rev 6200)
+++ docs/trunk/referenceGuide/en/modules/wsrp.xml 2007-02-09 23:32:40 UTC (rev 6201)
@@ -32,34 +32,51 @@
<para>More information on WSRP can be found on the
<ulink url="http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wsrp">official website for WSRP</ulink>.
- We suggest reading the <ulink url="http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wsrp">primer</ulink>
+ We suggest reading the <ulink
+ url="http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wsrp">primer</ulink>
for a good, albeit technical, overview of WSRP.
</para>
</sect1>
<sect1>
<title>Deploying JBoss Portal's WSRP services</title>
- <para>JBoss Portal provides a base level support of the WSRP 1.0 standard and offers
+ <para>JBoss Portal provides a complete support of WSRP 1.0 standard interfaces and offers
both consumer and producer services. WSRP support is provided by the <emphasis>portal-wsrp.sar</emphasis>
- service archive, included in the main <emphasis>jboss-portal.sar</emphasis> service archive.</para>
+ service archive, included in the main <emphasis>jboss-portal.sar</emphasis> service archive, if
+ you've obtained JBoss Portal from a binary distribution. If you don't intend on using WSRP, we
+ recommend that you remove the <emphasis>portal-wspr.sar</emphasis> from the main
+ <emphasis>jboss-portal.sar</emphasis> service archive.</para>
<para>If you've obtained the source distribution of JBoss Portal, you need to build and deploy the WSRP service
separately. Please follow the instructions on how to install
- <ulink url="http://docs.jboss.com/jbportal/v2.4/reference-guide/en/html_single/#insta...">JBoss Portal
+ <ulink url="http://docs.jboss.com/jbportal/v2.6/reference-guide/en/html_single/#insta...">JBoss Portal
from the sources</ulink>. Once this is done, navigate to <emphasis>JBOSS_PORTAL_HOME_DIRECTORY/wsrp</emphasis>
and type:
<programlisting>build deploy</programlisting>
At the end of the build process, <emphasis>portal-wsrp.sar</emphasis> is copied to
<emphasis>JBOSS_HOME/server/default/deploy</emphasis>.
+ </para>
- <note>
- WSRP is built upon the JBoss WS web service stack. There is a known issue with the version 1.0.0.GA of JBoss
- WS (bundled with JBoss Application Server 4.0.4.GA) that prevents the complete deployment of JBoss
- Portal's WSRP service if the user is not online or behind a firewall/proxy. This has been addressed in
- version 1.0.2.GA of JBoss WS. Please follow the instructions on
- <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=WSRP_UpdateJBossWS">how to upgrade JBoss WS</ulink>
- as found on <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossPortal">JBoss Portal's wiki</ulink>.
- </note>
- </para>
+ <sect2>
+ <title>Considerations to use WSRP behind firewall</title>
+ <para>WSRP is built upon the JBoss WS web service stack. There is a known issue with the version 1.0.0.GA of JBoss
+ WS (bundled with JBoss Application Server 4.0.4.GA) that prevents the complete deployment of JBoss
+ Portal's WSRP service if the user is not online or behind a firewall/proxy. For this reason, we recommend
+ that you deploy Portal on JBoss Application Server 4.0.5.GA. Alternatively, you can also perform a manual
+ upgrade of JBoss WS, in which case we recommend that you use JBoss WS version 1.0.4.GA (and later).
+ Please follow the instructions on
+ <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=WSRP_UpdateJBossWS">how to upgrade JBoss WS</ulink>
+ as found on <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossPortal">JBoss Portal's wiki</ulink>.
+ </para>
+ </sect2>
+
+ <sect2>
+ <title>Considerations to use WSRP with SSL</title>
+ <para>It is possible to use WSRP over SSL for secure exchanges of data. Please refer to the
+ <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=WSRPUseSSL">instructions</ulink>. on
+ how to do so as found on
+ <ulink url="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossPortal">JBoss Portal's wiki</ulink>.
+ </para>
+ </sect2>
</sect1>
<sect1>
@@ -76,11 +93,12 @@
<para>
<programlisting>
<![CDATA[
-<?xml version="1.0" encoding="UTF-8"?>
-<portlet>
- <portlet-name>BasicPortlet</portlet-name>
- <remotable>true</remotable>
-</portlet>]]>
+<portlet-app>
+ <portlet>
+ <portlet-name>BasicPortlet</portlet-name>
+ <remotable>true</remotable>
+ </portlet>
+</portlet-app>]]>
</programlisting>
</para>
<para>
@@ -125,16 +143,17 @@
the URL for the Producer's WSDL definition or the URLs for the individual endpoints.
</para>
<para>
- JBoss Portal's Producer is automatically set up when you deploy a portal instance. Assuming you're running a
+ JBoss Portal's Producer is automatically set up when you deploy a portal instance with the WSRP service.
+ Assuming you're running a
default configuration (i.e. you haven't changed the server's port number), you can access the WSDL file at
- <literal>http://localhost:8080/portal-wsrp/MarkupService?wsdl</literal>. You can acces the endpoint URLs are:
+ <literal>http://localhost:8080/portal-wsrp/MarkupService?wsdl</literal>. You can access the endpoint URLs at:
<itemizedlist>
<listitem>http://localhost:8080/portal-wsrp/ServiceDescriptionService</listitem>
<listitem>http://localhost:8080/portal-wsrp/MarkupService</listitem>
<listitem>http://localhost:8080/portal-wsrp/RegistrationService</listitem>
<listitem>http://localhost:8080/portal-wsrp/PortletManagementService</listitem>
</itemizedlist>
- </para>
+ </para>
</sect1>
<sect1>
@@ -153,24 +172,19 @@
in the list of portlet provider in the Management portlet on the Admin page of JBoss Portal. You can then
examine the list of portlets that are exposed by this producer and configure the portlets just like you
would for local portlets.
- <note>
- As of 2.4, the optional Portlet Management interface of WSRP is <emphasis role="bold">NOT</emphasis>
- supported. It is therefore not possible to clone and configure portlets on the consumer side. This will
- be supported in 2.6.
- </note>
</para>
<para>
JBoss Portal's default configuration exposes some of the sample portlets for remote consumption. As a way to
test the WSRP service, a default consumer has been configured to consume these portlets. To make sure that
- the service indeed works, checks that there is a portlet provider with the <emphasis>self</emphasis>
+ the service indeed works, check that there is a portlet provider with the <emphasis>self</emphasis>
identifier in the portlet providers list in the Management portlet of the Admin page. All local portlets
- marked as remotable are therefore exposed as remote portlets via the <emphasis>self</emphasis> portlet
+ marked as remotable are exposed as remote portlets via the <emphasis>self</emphasis> portlet
provider so that you can check that they work as expected with WSRP. The <emphasis>portal-wsrp.sar</emphasis>
file contains a <emphasis>default-wsrp.xml</emphasis> that configures this default producer. This file can
be edited or removed if needed.
</para>
<para>
- Let's see work through the steps of defining access to a remote producer so that its portlets can be
+ Let's work through the steps of defining access to a remote producer so that its portlets can be
consumed within JBoss Portal. We will configure access to BEA's public WSRP producer. To do so, you will
need to create a <emphasis>-wsrp.xml</emphasis> file (which we will call here
<emphasis>public-bea-wsrp.xml</emphasis> but the name does not matter as long as it ends with
@@ -223,9 +237,9 @@
</mediaobject>
</para>
<para>
- From there on out, you should be able to configure the portlet just as any other, barring the restriction
- that the (optional) WSRP Portlet Management interface is not yet supported in 2.4. If everything went well,
- you created an instance of the portlet and assigned it to a window in a page. If you go to that page, you
+ From there on out, you should be able to configure WSRP portlets just as any other. In particular, you
+ can create an instance of one of the remote portlets offered by BEA's public producer just like you would
+ create an instance of a local portlet and then assign it to a window in a page. If you go to that page, you
should see something similar to below for this portlet:
<mediaobject>
@@ -245,7 +259,7 @@
afterwards. This is accomplished via the <emphasis role="bold"><producer-id></emphasis> element.</para>
<para>JBoss Portal also needs to learn about the remote producer's endpoints to be able to connect to the
- remote web services and perform the WSRP invocations. Two options are currently supported to provide this
+ remote web services and perform WSRP invocations. Two options are currently supported to provide this
information:
</para>
@@ -290,15 +304,19 @@
consumer and the remote producer, it is possible to cache some of the information sent by the producer (such
as the list of offered portlets) for a given duration. The rate at which the information is refreshed is
defined by the <emphasis role="bold"><expiration-cache></emphasis> element which specifies the
- refreshing period in seconds.
+ refreshing period in seconds. For example, providing a value of 120 for expiration-cache means that the
+ producer information will not be refreshed for 2 minutes after it has been somehow accessed. If no value
+ is provided, JBoss Portal will always access the remote producer regardless of whether the remote
+ information has changed or not. Since, in most instances, the information provided by the producer does not
+ change often, we recommend that you use this caching facility to minimize bandwidth usage.
</para>
<para>Additionally, some producers require consumers to register with them before authorizing them to access
- their offered portlets. JBoss Portal currently only supports a very basic subset of in-band registration
- and it is thus possible to provide required registration information in the producer configuration so that
- the Portal consumer can register with the remote producer when required.
+ their offered portlets. If you know that information beforehand, you can provide the required registration
+ information in the producer configuration so that the Portal consumer can register with the remote
+ producer when required.
<note>At this time, though, only simple String properties are supported and it is not possible to configure
- complex registration data.</note>
+ complex registration data. This should however be sufficient for most cases.</note>
</para>
<para>Registration configuration is done via the <emphasis role="bold"><registration-data></emphasis>
@@ -316,7 +334,7 @@
<sect2>
<title>Examples</title>
- <para>Here is an example of a WSRP descriptor with a 2 minutes caching time and manual definition of the endpoint
+ <para>Here is an example of a WSRP descriptor with a 2 minute caching time and manual definition of the endpoint
URLs:</para>
<para>
@@ -367,4 +385,146 @@
</para>
</sect2>
</sect1>
+
+ <sect1>
+ <title>Configuring JBoss Portal's WSRP Producer</title>
+ <sect2>
+ <title>Overview</title>
+ <para>
+ You can configure the behavior of Portal's WSRP Producer by editing the <emphasis>conf/config.xml</emphasis>
+ file found in <emphasis>portal-wsrp.sar</emphasis>. Several aspects can be modified with respects to whether
+ registration is required for consumers to access the Producer's services.
+ </para>
+ </sect2>
+ <sect2>
+ <title>Default configuration</title>
+ <para>
+ Let's look at the default configuration:
+ <programlisting>
+ <![CDATA[
+<producer-configuration>
+ <registration-configuration fullServiceDescriptionRequiresRegistration="true">
+ <registration-property-validator>org.jboss.portal.registration.policies.DefaultRegistrationPropertyValidator</registration-property-validator>
+ </registration-configuration>
+</producer-configuration>]]>
+ </programlisting>
+ The top element <emphasis role="bold"><producer-configuration></emphasis> contains a single
+ <emphasis role="bold"><registration-configuration></emphasis> element that defines a
+ <emphasis>fullServiceDescritpionRequiresRegistration</emphasis> attribute with the value "true". This
+ configuration specifies that the WSRP producer requires registration to access its services but does not
+ require any specific registration properties (apart from what is mandated by the WSRP standard). It does,
+ however, require consumers to be registered before sending them a full service description. This means that
+ our WSRP producer will not provide the list of offered portlets and other capabilities to unregistered
+ consumers. The <emphasis role="bold"><registration-configuration></emphasis> element contains a
+ <emphasis role="bold"><registration-property-validator></emphasis> element. We will look into property
+ validators in greater detail later in <xref linkend="registration-configuration"/>. Suffice to say for now
+ that this allows users to customize how Portal's WSRP Producer decides whether a given registration property
+ is valid or not.
+ </para>
+ </sect2>
+ <sect2>
+ <title>Minimal producer configuration</title>
+ <para>
+ Requiring registration is optional: if you don't need your producer to require consumer registration, the
+ only thing you need to do is to provide an empty <emphasis
+ role="bold"><producer-configuration></emphasis>
+ element in <emphasis>portal-wsrp.sar/conf/config.xml</emphasis>.
+ </para>
+ </sect2>
+ <sect2 id="registration-configuration">
+ <title>Registration configuration</title>
+ <para>
+ In order to require consumers to register with Portal's producer before interacting with it, you need to
+ configure Portal's behavior with respect to registration. This is done via the
+ <emphasis role="bold"><registration-configuration></emphasis> element. This element is optional as
+ previously noted. It can be empty if you don't require registration properties. You can also specify
+ whether or not registration is required in order for consumers to access the Producer's full service
+ description, as noted in our discussion of the default configuration, above. This is done via the
+ <emphasis>fullServiceDescriptionRequiresRegistration</emphasis> attribute, which is optional. Acceptable
+ values for this attribute are "true" or "false", defaulting to "false" in which case the Producer will always
+ return the full service description, whether the consumer asking for it is registered or not.
+ </para>
+
+ <sect3>
+ <title>Customization of Registration handling behavior</title>
+ <para>
+ Registration handling behavior can be customized by users to suit their Producer needs. This is
+ accomplished by providing an implementation of the <emphasis role="bold">RegistrationPolicy</emphasis>
+ interface. This interface defines behaviors that are called by Portal's Registration service so that
+ decisions can be made appropriately. A default registration policy that provides basic
+ behaviors is provided and should be enough for most user needs.
+ </para>
+ <para>
+ While the default registration policy provides default behavior for most registration-related aspects,
+ there is still one aspect that requires configuration: whether a given value for a registration property
+ is acceptable by the WSRP Producer. This is accomplished by plugging a
+ <emphasis role="bold">RegistrationPropertyValidator</emphasis> in the default registration policy. This
+ allows users to define their own validation mechanism.
+ </para>
+ <para>Please refer to the Javadoc for <literal>org.jboss.portal.registration.RegistrationPolicy</literal>
+ and <literal>org.jboss.portal.Registration.policies.RegistrationPropertyValidator</literal> for more details
+ on what is expected of each method.
+ </para>
+ <para>As far as configuration of the Producer goes, a registration policy is required. This is accomplished
+ by specifying the qualified class name of the registration policy via the
+ <emphasis role="bold"><registration-policy></emphasis> element. Since we anticipate that most users
+ will use the default registration policy, it is possible to use
+ <emphasis role="bold"><registration-property-validator></emphasis> element and provide the class
+ name of your custom property validator instead. Since specifying a property validator only makes sense in
+ the context of the default registration policy, both elements are mutually exclusive.
+
+ <note>Since the policy or the validator are defined via their class name and dynamically loaded, it is
+ important that you make sure that the identified class is available to the application server. One way
+ to accomplish that is to deploy your policy implementation as JAR file in your AS instance deploy
+ directory. Note also that, since both policies and validators are dynamically instantiated, they must
+ provide a default, no-argument constructor.</note>
+ </para>
+ </sect3>
+
+ <sect3>
+ <title>Registration properties</title>
+ <para>You can also specify that consumers wishing to register with your producer provide acceptable values
+ for one or several registration properties. This is accomplished by providing a
+ <emphasis role="bold"><registration-property-description></emphasis> element per required registration
+ property. This element lets provide information about a given registration property such as its name, its type,
+ the hint and label that will be sent to remote consumers.
+ <note>
+ At this time, only String (xsd:string) properties are supported. If your application requires more complex
+ properties, please let us know.
+ </note>
+ </para>
+ </sect3>
+
+ </sect2>
+ <sect2>
+ <title>Example</title>
+ <para>
+ Here is an example of a producer configurations requiring registration, barring consumers from accessing its
+ complete service description until they are correctly registered and requires consumers to provide acceptable
+ values for two String registration properties named "name1" and "name2" respectively. The registration
+ service will use the <literal>com.example.portal.SomeCustomRegistrationPolicy</literal> class for its
+ registration policy.
+ <programlisting>
+ <![CDATA[
+<producer-configuration>
+ <registration-configuration fullServiceDescriptionRequiresRegistration="true">
+ <registration-policy>com.example.portal.SomeCustomRegistrationPolicy</registration-policy>
+ <registration-property-description>
+ <name>name1</name>
+ <type>xsd:string</type>
+ <hint xml:lang="en" resourceName="resource.hint1">hint1</hint>
+ <label xml:lang="en" resourceName="resource.label1">label1</label>
+ </registration-property-description>
+ <registration-property-description>
+ <name>name2</name>
+ <type>xsd:string</type>
+ <hint xml:lang="en" resourceName="resource.hint2">hint2</hint>
+ <label xml:lang="en" resourceName="resource.label2">label2</label>
+ </registration-property-description>
+ </registration-configuration>
+</producer-configuration>]]>
+ </programlisting>
+ </para>
+ </sect2>
+ </sect1>
</chapter>
19 years, 2 months
JBoss Portal SVN: r6200 - in trunk/registration/src/main/org/jboss/portal/registration: policies and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-09 18:10:31 -0500 (Fri, 09 Feb 2007)
New Revision: 6200
Modified:
trunk/registration/src/main/org/jboss/portal/registration/RegistrationPolicy.java
trunk/registration/src/main/org/jboss/portal/registration/policies/RegistrationPropertyValidator.java
Log:
- Javadoc update.
Modified: trunk/registration/src/main/org/jboss/portal/registration/RegistrationPolicy.java
===================================================================
--- trunk/registration/src/main/org/jboss/portal/registration/RegistrationPolicy.java 2007-02-09 22:51:23 UTC (rev 6199)
+++ trunk/registration/src/main/org/jboss/portal/registration/RegistrationPolicy.java 2007-02-09 23:10:31 UTC (rev 6200)
@@ -27,7 +27,8 @@
/**
* An interface allowing users of the Registration service to customize different aspects of how Consumers are handled.
- * Methods of this interface are used by RegistrationManager to make appropriate decisions.
+ * Methods of this interface are used by RegistrationManager to make appropriate decisions. Implementations of this
+ * interface <strong>MUST</strong> provide a no-argument constructor for instantiation from the class name.
*
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
Modified: trunk/registration/src/main/org/jboss/portal/registration/policies/RegistrationPropertyValidator.java
===================================================================
--- trunk/registration/src/main/org/jboss/portal/registration/policies/RegistrationPropertyValidator.java 2007-02-09 22:51:23 UTC (rev 6199)
+++ trunk/registration/src/main/org/jboss/portal/registration/policies/RegistrationPropertyValidator.java 2007-02-09 23:10:31 UTC (rev 6200)
@@ -27,7 +27,8 @@
/**
* An interface providing an entry point for WSRP deployers to plug their registration property validation mechanism in
- * {@link org.jboss.portal.registration.policies.DefaultRegistrationPolicy}.
+ * {@link org.jboss.portal.registration.policies.DefaultRegistrationPolicy}. Implementations of this interface
+ * <strong>MUST</strong> provide a no-argument constructor for instantiation from the class name.
*
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
19 years, 2 months
JBoss Portal SVN: r6199 - trunk/registration/src/main/org/jboss/portal/registration/policies.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-09 17:51:23 -0500 (Fri, 09 Feb 2007)
New Revision: 6199
Modified:
trunk/registration/src/main/org/jboss/portal/registration/policies/RegistrationPropertyValidator.java
Log:
- Javadoc.
Modified: trunk/registration/src/main/org/jboss/portal/registration/policies/RegistrationPropertyValidator.java
===================================================================
--- trunk/registration/src/main/org/jboss/portal/registration/policies/RegistrationPropertyValidator.java 2007-02-09 22:22:37 UTC (rev 6198)
+++ trunk/registration/src/main/org/jboss/portal/registration/policies/RegistrationPropertyValidator.java 2007-02-09 22:51:23 UTC (rev 6199)
@@ -26,11 +26,22 @@
import javax.xml.namespace.QName;
/**
+ * An interface providing an entry point for WSRP deployers to plug their registration property validation mechanism in
+ * {@link org.jboss.portal.registration.policies.DefaultRegistrationPolicy}.
+ *
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
* @since 2.6
*/
public interface RegistrationPropertyValidator
{
+ /**
+ * Validates the given value for the registration property identified by the specified name. If the value is
+ * acceptable, the method simply returns. An invalid value will raise an exception.
+ *
+ * @param propertyName the qualified name for the property name
+ * @param value the value that needs to be validated
+ * @throws IllegalArgumentException if the specified value is not acceptable for the specified property.
+ */
void validateValueFor(QName propertyName, Object value) throws IllegalArgumentException;
}
19 years, 2 months
JBoss Portal SVN: r6198 - trunk/registration/src/main/org/jboss/portal/registration/policies.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-09 17:22:37 -0500 (Fri, 09 Feb 2007)
New Revision: 6198
Modified:
trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java
Log:
- Correctly delegate to the validator even when the consumer already exists.
- Javadoc.
Modified: trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java
===================================================================
--- trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java 2007-02-09 17:42:03 UTC (rev 6197)
+++ trunk/registration/src/main/org/jboss/portal/registration/policies/DefaultRegistrationPolicy.java 2007-02-09 22:22:37 UTC (rev 6198)
@@ -39,7 +39,8 @@
import java.util.Map;
/**
- * Provides a default implementation of RegistrationPolicy.
+ * Provides a default implementation of RegistrationPolicy which should be enough for most user needs provided the
+ * appropriate {@link RegistrationPropertyValidator} has been configured to validate registration properties.
*
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -62,6 +63,9 @@
}
/**
+ * Only accepts the registration if no registration with identical values exists for the Consumer identified by the
+ * specified identify and delegates the validation of properties to the configured RegistrationPropertyValidator.
+ *
* @throws DuplicateRegistrationException if a Consumer with the same identity has already registered with the same
* registration properties.
*/
@@ -86,14 +90,12 @@
}
}
}
- else
+
+ // check that values are consistent with ProducerRegistrationRequirement
+ for (Iterator properties = registrationProperties.entrySet().iterator(); properties.hasNext();)
{
- // check that values are consistent with ProducerRegistrationRequirement
- for (Iterator properties = registrationProperties.entrySet().iterator(); properties.hasNext();)
- {
- Map.Entry property = (Map.Entry)properties.next();
- validator.validateValueFor((QName)property.getKey(), property.getValue());
- }
+ Map.Entry property = (Map.Entry)properties.next();
+ validator.validateValueFor((QName)property.getKey(), property.getValue());
}
}
@@ -136,11 +138,22 @@
// this is already the behavior in the RegistrationPersistenceManager so no need to do anything
}
+ /**
+ * Instructs this policy to use the specified RegistrationPropertyValidator. There shouldn't be any need to call this
+ * method manually, as the validator is configured via the WSRP Producer xml configuration file.
+ *
+ * @param validator
+ */
public void setValidator(RegistrationPropertyValidator validator)
{
this.validator = validator;
}
+ /**
+ * Retrieves the currently configured RegistrationPropertyValidator.
+ *
+ * @return
+ */
public RegistrationPropertyValidator getValidator()
{
return validator;
19 years, 2 months
JBoss Portal SVN: r6197 - trunk/portlet/src/main/org/jboss/portal/portlet/impl.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-09 12:42:03 -0500 (Fri, 09 Feb 2007)
New Revision: 6197
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java
Log:
javadoc for PortletRequestEncoder
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java 2007-02-09 16:02:20 UTC (rev 6196)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java 2007-02-09 17:42:03 UTC (rev 6197)
@@ -36,6 +36,14 @@
import java.util.Map;
/**
+ * This class is designed to provide the encoding in the query string of a URL of the following state :
+ * <ul>
+ * <li>A set of parameters</li>
+ * <li>A mode value</li>
+ * <li>A window state value</li>
+ * <li>A invocation type (action or render)</li>
+ * </ul>
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
@@ -61,7 +69,7 @@
this(new PortletParameters());
}
- public void encode(PortletURL portletURL)
+ public void encode(PortletURL portletURL) throws IllegalArgumentException
{
if (portletURL instanceof RenderURL)
{
@@ -83,7 +91,7 @@
StateString navigationalState,
StateString interactionState,
Mode mode,
- WindowState windowState)
+ WindowState windowState) throws IllegalArgumentException
{
queryParameters.clear();
19 years, 2 months
JBoss Portal SVN: r6196 - trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-02-09 11:02:20 -0500 (Fri, 09 Feb 2007)
New Revision: 6196
Modified:
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
Log:
Fixed bug while viewing files in the admin browser
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2007-02-09 12:50:04 UTC (rev 6195)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2007-02-09 16:02:20 UTC (rev 6196)
@@ -43,6 +43,7 @@
import org.jboss.portal.cms.CMSInterceptor;
import org.jboss.portal.cms.impl.jcr.JCRCommand;
import org.jboss.portal.cms.impl.jcr.JCRCMS;
+import org.jboss.portal.cms.impl.jcr.command.SearchCommand;
import org.jboss.portal.cms.model.File;
import org.jboss.portal.cms.model.Folder;
import org.jboss.portal.cms.hibernate.state.Tools;
@@ -168,22 +169,21 @@
protected Object invoke(JCRCommand invocation) throws Exception, InvocationException
{
if(ACLInterceptor.turnOff.get()==null )
- {
- Session session = Tools.getOpenSession();
- Transaction tx = session.beginTransaction();
-
+ {
//make the acl check before this command is executed
- User user = (User)JCRCMS.getUserInfo().get();
+
+ // Get the user executing the command
+ User user = (User)JCRCMS.getUserInfo().get();
-
//setup the security context with enough information for the authorization provider
//to be able to make an enforcement decision
PortalCMSSecurityContext securityContext = new PortalCMSSecurityContext(user);
securityContext.setAttribute("command",invocation);
-
//perform access check
PortalPermission cmsPermission = new CMSPermission(securityContext);
+ Session session = Tools.getOpenSession();
+ Transaction tx = session.beginTransaction();
boolean allowAccess = this.authorizationManager.checkPermission(cmsPermission);
tx.commit();
Tools.closeSession(session);
@@ -222,6 +222,8 @@
Transaction tx = session.beginTransaction();
Object filteredResponse = response;
+ JCRCommand command = (JCRCommand)securityContext.getAttribute("command");
+
try
{
@@ -257,7 +259,7 @@
folder.setFolders(filteredFolders);
folder.setFiles(filteredFiles);
}
- else if (filteredResponse instanceof List)
+ else if ((filteredResponse instanceof List) && (command instanceof SearchCommand))
{
List list = (List)filteredResponse;
List filteredFiles = new ArrayList();
19 years, 2 months
JBoss Portal SVN: r6195 - in trunk: core/src/main/org/jboss/portal/core/model/instance and 4 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-09 07:50:04 -0500 (Fri, 09 Feb 2007)
New Revision: 6195
Modified:
trunk/build/ide/intellij/idea60/modules/jems/jems.iml
trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/UserContextSupport.java
trunk/server/src/main/org/jboss/portal/server/AbstractServerURL.java
trunk/server/src/main/org/jboss/portal/server/ServerURL.java
Log:
refactored the PortletRequestEncoder to be more flexible
Modified: trunk/build/ide/intellij/idea60/modules/jems/jems.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/jems/jems.iml 2007-02-09 10:15:41 UTC (rev 6194)
+++ trunk/build/ide/intellij/idea60/modules/jems/jems.iml 2007-02-09 12:50:04 UTC (rev 6195)
@@ -12,7 +12,7 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="common" />
<orderEntry type="module" module-name="test" />
- <orderEntry type="module-library">
+ <orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jbossas/core-libs/lib/jboss-jmx.jar!/" />
@@ -39,7 +39,7 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module-library">
+ <orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jbossas/core-libs/lib/jboss-system.jar!/" />
@@ -120,7 +120,7 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module-library">
+ <orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jbossas/core-libs/lib/jboss-common.jar!/" />
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java 2007-02-09 10:15:41 UTC (rev 6194)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceURLFactory.java 2007-02-09 12:50:04 UTC (rev 6195)
@@ -78,17 +78,19 @@
InvokePortletInstanceCommand iic = (InvokePortletInstanceCommand)cmd;
if (iic.getInstanceId().equals(instanceId))
{
- ServerURL url = new AbstractServerURL();
+ AbstractServerURL url = new AbstractServerURL();
url.setPortalRequestPath(path);
if (cmd instanceof InvokePortletInstanceRenderCommand)
{
InvokePortletInstanceRenderCommand iprc = (InvokePortletInstanceRenderCommand)cmd;
- PortletRequestEncoder.encodeRender(url, iprc.getNavigationalState(), null, null);
+ PortletRequestEncoder encoder = new PortletRequestEncoder(url.getParameterMap());
+ encoder.encodeRender(iprc.getNavigationalState(), null, null);
}
else
{
InvokePortletInstanceActionCommand iprc = (InvokePortletInstanceActionCommand)cmd;
- PortletRequestEncoder.encodeAction(url, iprc.getNavigationalState(), iprc.getInteractionState(), null, null);
+ PortletRequestEncoder encoder = new PortletRequestEncoder(url.getParameterMap());
+ encoder.encodeAction(iprc.getNavigationalState(), iprc.getInteractionState(), null, null);
}
return url;
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2007-02-09 10:15:41 UTC (rev 6194)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectURLFactory.java 2007-02-09 12:50:04 UTC (rev 6195)
@@ -96,12 +96,14 @@
{
StateString interactionState = ((InvokePortletWindowActionCommand)iwaCmd).getInteractionState();
StateString navigationalState = ((InvokePortletWindowActionCommand)iwaCmd).getNavigationalState();
- PortletRequestEncoder.encodeAction(url, navigationalState, interactionState, mode, windowState);
+ PortletRequestEncoder encoder = new PortletRequestEncoder(url.getParameterMap());
+ encoder.encodeAction(navigationalState, interactionState, mode, windowState);
}
else
{
StateString navigationalState = ((InvokePortletWindowRenderCommand)iwaCmd).getNavigationalState();
- PortletRequestEncoder.encodeRender(url, navigationalState, mode, windowState);
+ PortletRequestEncoder encoder = new PortletRequestEncoder(url.getParameterMap());
+ encoder.encodeRender(navigationalState, mode, windowState);
}
}
else if (cmd instanceof ImportPageToDashboardCommand)
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java 2007-02-09 10:15:41 UTC (rev 6194)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java 2007-02-09 12:50:04 UTC (rev 6195)
@@ -24,10 +24,13 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.PortletParameters;
-import org.jboss.portal.server.ServerURL;
+import org.jboss.portal.portlet.PortletURL;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.ActionURL;
import java.util.Iterator;
import java.util.Map;
@@ -39,13 +42,52 @@
public class PortletRequestEncoder
{
- public static void encodeAction(
- ServerURL url,
+ /** . */
+ private ParameterMap queryParameters;
+
+ public PortletRequestEncoder(ParameterMap queryParameters)
+ {
+ if (queryParameters == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.queryParameters = queryParameters;
+ }
+
+ public PortletRequestEncoder()
+ {
+ this(new PortletParameters());
+ }
+
+ public void encode(PortletURL portletURL)
+ {
+ if (portletURL instanceof RenderURL)
+ {
+ RenderURL renderURL = (RenderURL)portletURL;
+ encodeRender(renderURL.getNavigationalState(), renderURL.getMode(), renderURL.getWindowState());
+ }
+ else if (portletURL instanceof ActionURL)
+ {
+ ActionURL actionURL = (ActionURL)portletURL;
+ encodeAction(actionURL.getNavigationalState(), actionURL.getInteractionState(), actionURL.getMode(), actionURL.getWindowState());
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public void encodeAction(
StateString navigationalState,
StateString interactionState,
Mode mode,
WindowState windowState)
{
+ queryParameters.clear();
+
+ //
int meta = PortletRequestDecoder.ACTION_MASK;
//
@@ -60,33 +102,35 @@
// Add the parameters
PortletParameters parameters = ((PortletParametersStateString)interactionState).getParameters();
- configure(url, parameters);
+ configure(parameters);
}
else
{
meta |= PortletRequestDecoder.OPAQUE_MASK;
// Set interaction state
- url.setParameterValue(PortletRequestDecoder.INTERACTION_STATE_PARAMETER, interactionState.getStringValue());
+ queryParameters.setValue(PortletRequestDecoder.INTERACTION_STATE_PARAMETER, interactionState.getStringValue());
// We may have navigational state
if (navigationalState != null)
{
- url.setParameterValue(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, navigationalState.getStringValue());
+ queryParameters.setValue(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, navigationalState.getStringValue());
}
}
}
//
- configure(meta, url, mode, windowState);
+ configure(meta, mode, windowState);
}
- public static void encodeRender(
- ServerURL url,
+ public void encodeRender(
StateString navigationalState,
Mode mode,
WindowState windowState)
{
+ queryParameters.clear();
+
+ //
int meta = PortletRequestDecoder.RENDER_MASK;
//
@@ -96,50 +140,55 @@
{
// Add the parameters
PortletParameters parameters = ((PortletParametersStateString)navigationalState).getParameters();
- configure(url, parameters);
+ configure(parameters);
}
else
{
meta |= PortletRequestDecoder.OPAQUE_MASK;
//
- url.setParameterValue(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, navigationalState.getStringValue());
+ queryParameters.setValue(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, navigationalState.getStringValue());
}
}
//
- configure(meta, url, mode, windowState);
+ configure(meta, mode, windowState);
}
- private static void configure(ServerURL url, PortletParameters parameters)
+ public ParameterMap getQueryParameters()
{
+ return queryParameters;
+ }
+
+ private void configure(PortletParameters parameters)
+ {
for (Iterator i = parameters.entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry)i.next();
String name = (String)entry.getKey();
String[] values = (String[])entry.getValue();
- url.setParameterValues(name, values);
+ queryParameters.setValues(name, values);
}
}
- private static void configure(int meta, ServerURL url, Mode mode, WindowState windowState)
+ private void configure(int meta, Mode mode, WindowState windowState)
{
if (mode != null)
{
meta |= PortletRequestDecoder.MODE_MASK;
- setMetaParameter(url, PortletRequestDecoder.MODE_PARAMETER, mode.toString());
+ setMetaParameter(PortletRequestDecoder.MODE_PARAMETER, mode.toString());
}
if (windowState != null)
{
meta |= PortletRequestDecoder.WINDOW_STATE_MASK;
- setMetaParameter(url, PortletRequestDecoder.WINDOW_STATE_PARAMETER, windowState.toString());
+ setMetaParameter(PortletRequestDecoder.WINDOW_STATE_PARAMETER, windowState.toString());
}
- setMetaParameter(url, PortletRequestDecoder.META_PARAMETER, Integer.toHexString(meta));
+ setMetaParameter(PortletRequestDecoder.META_PARAMETER, Integer.toHexString(meta));
}
- private static void setMetaParameter(ServerURL serverURL, String name, String value)
+ private void setMetaParameter(String name, String value)
{
- String[] values = serverURL.getParameterValues(name);
+ String[] values = queryParameters.getValues(name);
if (values == null)
{
values = new String[]{value};
@@ -151,6 +200,6 @@
tmp[0] = value;
values = tmp;
}
- serverURL.setParameterValues(name, values);
+ queryParameters.setValues(name, values);
}
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/UserContextSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/UserContextSupport.java 2007-02-09 10:15:41 UTC (rev 6194)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/UserContextSupport.java 2007-02-09 12:50:04 UTC (rev 6195)
@@ -27,6 +27,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -34,23 +35,36 @@
*/
public class UserContextSupport implements UserContext
{
+
+ /**
+ * Returns null.
+ */
public String getId()
{
- throw new UnsupportedOperationException();
+ return null;
}
+ /**
+ * Returns <code>Collections.EMPTY_MAP</code>.
+ */
public Map getInformations()
{
- throw new UnsupportedOperationException();
+ return Collections.EMPTY_MAP;
}
+ /**
+ * Returns <code>Locale.ENGLISH</code>.
+ */
public Locale getLocale()
{
- throw new UnsupportedOperationException();
+ return Locale.ENGLISH;
}
+ /**
+ * Returns <code>Collections.EMPTY_LIST</code>.
+ */
public List getLocales()
{
- throw new UnsupportedOperationException();
+ return Collections.EMPTY_LIST;
}
}
Modified: trunk/server/src/main/org/jboss/portal/server/AbstractServerURL.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/AbstractServerURL.java 2007-02-09 10:15:41 UTC (rev 6194)
+++ trunk/server/src/main/org/jboss/portal/server/AbstractServerURL.java 2007-02-09 12:50:04 UTC (rev 6195)
@@ -96,7 +96,7 @@
return (String[])map.get(name);
}
- public Map getParameterMap()
+ public ParameterMap getParameterMap()
{
return map;
}
Modified: trunk/server/src/main/org/jboss/portal/server/ServerURL.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerURL.java 2007-02-09 10:15:41 UTC (rev 6194)
+++ trunk/server/src/main/org/jboss/portal/server/ServerURL.java 2007-02-09 12:50:04 UTC (rev 6195)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.server;
+import org.jboss.portal.common.util.ParameterMap;
+
import java.util.Iterator;
import java.util.Map;
@@ -59,5 +61,5 @@
/**
*
*/
- Map getParameterMap();
+ ParameterMap getParameterMap();
}
19 years, 2 months
JBoss Portal SVN: r6194 - trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-02-09 05:15:41 -0500 (Fri, 09 Feb 2007)
New Revision: 6194
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
Log:
CMS Admin was failing on rendering because of the workflow management
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-02-08 19:31:07 UTC (rev 6193)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-02-09 10:15:41 UTC (rev 6194)
@@ -1452,7 +1452,7 @@
User user = renderRequest.getUser();
PortalCMSSecurityContext securityContext = new PortalCMSSecurityContext(user);
securityContext.setAttribute("manageWorkflow", "true");
- securityContext.setAttribute("approvePublish", this.approvePublish);
+ securityContext.setAttribute("approvePublish", getApprovePublish());
PortalPermission cmsPermission = new CMSPermission(securityContext);
isAccessible = this.authorizationManager.checkPermission(cmsPermission);
19 years, 2 months