JBoss Portal SVN: r9809 - modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-02-06 15:39:58 -0500 (Wed, 06 Feb 2008)
New Revision: 9809
Modified:
modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF/portlet.xml
Log:
- Changed initial zip code so that it's more obvious when the public render parameters are used.
Modified: modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF/portlet.xml 2008-02-06 20:02:05 UTC (rev 9808)
+++ modules/portlet/trunk/test/src/test/resources/google-weather-portlet-war/WEB-INF/portlet.xml 2008-02-06 20:39:58 UTC (rev 9809)
@@ -42,7 +42,7 @@
<portlet-preferences>
<preference>
<name>zipcode</name>
- <value>94102</value>
+ <value>80201</value>
<read-only>false</read-only>
</preference>
</portlet-preferences>
16 years, 4 months
JBoss Portal SVN: r9808 - tags/JBoss_Portal_2_6_4/server/src/main/org/jboss/portal/server.
by portal-commits@lists.jboss.org
Author: prabhat.jha(a)jboss.com
Date: 2008-02-06 15:02:05 -0500 (Wed, 06 Feb 2008)
New Revision: 9808
Modified:
tags/JBoss_Portal_2_6_4/server/src/main/org/jboss/portal/server/PortalConstants.java
Log:
updating the version number
Modified: tags/JBoss_Portal_2_6_4/server/src/main/org/jboss/portal/server/PortalConstants.java
===================================================================
--- tags/JBoss_Portal_2_6_4/server/src/main/org/jboss/portal/server/PortalConstants.java 2008-02-06 19:58:09 UTC (rev 9807)
+++ tags/JBoss_Portal_2_6_4/server/src/main/org/jboss/portal/server/PortalConstants.java 2008-02-06 20:02:05 UTC (rev 9808)
@@ -36,7 +36,7 @@
{
/** Current version. */
- public static final Version VERSION = new Version("JBoss Portal", 2, 6, 3, new Version.Qualifier(Version.Qualifier.Prefix.SNAPSHOT), "Ninja");
+ public static final Version VERSION = new Version("JBoss Portal", 2, 6, 4, new Version.Qualifier(Version.Qualifier.Prefix.GA), "Ninja");
/** The default portal name. */
public static final String DEFAULT_PORTAL_NAME = "default";
16 years, 4 months
JBoss Portal SVN: r9806 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib and 9 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-02-06 14:02:10 -0500 (Wed, 06 Feb 2008)
New Revision: 9806
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ActionURL286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286TagTEI.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/Namespace286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/RenderURL286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLParameter286Tag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLProperty286Tag.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/ActionURLTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/DefineObjectsTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/NamespaceTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/RenderURLTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ActionURLTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/NamespaceTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/RenderURLTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/TaglibTestCase.java
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/actionURL.jsp
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/defineObjects.jsp
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/namespace.jsp
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/renderURL.jsp
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/actionURL.jsp
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/defineObjects.jsp
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/namespace.jsp
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/renderURL.jsp
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp
Removed:
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/taglib.jsp
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/BaseURLImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/ActionURLTag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/GenerateURLTag.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/RenderURLTag.java
modules/portlet/trunk/portlet/src/main/resources/org/jboss/portal/portlet/portlet_2_0.tld
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/TaglibTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/DefineObjectsTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/portlet.xml
modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/WEB-INF/portlet.xml
Log:
- JSR 286 taglib impl
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/BaseURLImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/BaseURLImpl.java 2008-02-06 18:49:08 UTC (rev 9805)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/BaseURLImpl.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -109,17 +109,35 @@
public void write(Writer writer, boolean b) throws IOException
{
- EntityEncoder.FULL.encode(toString(), new WriterCharWriter(writer));
+ if (b)
+ {
+ EntityEncoder.FULL.encode(toString(), new WriterCharWriter(writer));
+ }
+ else
+ {
+ EntityEncoder.BASIC.encode(toString(), new WriterCharWriter(writer));
+ }
}
public void addProperty(String s, String s1)
{
- throw new NotYetImplemented();
+ if (s == null)
+ {
+ throw new IllegalArgumentException("property name cannot be null");
+ }
+
+ //TODO:
+
}
public void setProperty(String s, String s1)
{
- throw new NotYetImplemented();
+ if (s == null)
+ {
+ throw new IllegalArgumentException("property name cannot be null");
+ }
+
+ //TODO:
}
public String toString()
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/ActionURLTag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/ActionURLTag.java 2008-02-06 18:49:08 UTC (rev 9805)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/ActionURLTag.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -22,6 +22,9 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.taglib;
+import javax.portlet.PortletURL;
+import javax.portlet.BaseURL;
+
/**
* The actionURL tag for the JSR 168 Portlet specification.
* <p/>
@@ -45,4 +48,15 @@
{
return typeParameter;
}
+
+ protected BaseURL generateURL() throws Exception
+ {
+ PortletURL newPortletURL = (PortletURL)super.generateURL();
+
+ setWindowState(newPortletURL);
+
+ setPortletMode(newPortletURL);
+
+ return newPortletURL;
+ }
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/GenerateURLTag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/GenerateURLTag.java 2008-02-06 18:49:08 UTC (rev 9805)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/GenerateURLTag.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.taglib;
-import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.PortletURLImpl;
import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
@@ -32,7 +31,7 @@
import javax.portlet.PortletURL;
import javax.portlet.WindowState;
import javax.portlet.WindowStateException;
-import javax.portlet.RenderRequest;
+import javax.portlet.BaseURL;
import javax.servlet.jsp.JspException;
import java.util.ArrayList;
import java.util.HashMap;
@@ -49,7 +48,7 @@
* @author <a href="mailto:sgwood@ix.netcom.com">Sherman Wood</a>
* @version $Revision: 5448 $
*/
-abstract class GenerateURLTag extends PortletTag
+public abstract class GenerateURLTag extends PortletTag
{
private String windowState;
private String portletMode;
@@ -186,7 +185,7 @@
*
* @return The PortelURL to decorate
*/
- private PortletURL getBasePortletEnvironmentAndURL()
+ protected BaseURL getBasePortletEnvironmentAndURL()
{
PortletRequestImpl preq = (PortletRequestImpl)getPortletRequest();
@@ -212,7 +211,7 @@
* @param portletURL
* @throws WindowStateException
*/
- private void setWindowState(PortletURL portletURL) throws WindowStateException
+ protected void setWindowState(PortletURL portletURL) throws WindowStateException
{
if (getWindowState() != null && getWindowState().trim().length() > 0)
{
@@ -227,7 +226,7 @@
* @param portletURL
* @throws PortletModeException
*/
- private void setPortletMode(PortletURL portletURL) throws PortletModeException
+ protected void setPortletMode(PortletURL portletURL) throws PortletModeException
{
if (getPortletMode() != null && getPortletMode().trim().length() > 0)
{
@@ -242,7 +241,7 @@
* @param portletURL
* @throws PortletSecurityException
*/
- private void setSecure(PortletURL portletURL) throws PortletSecurityException
+ protected void setSecure(BaseURL portletURL) throws PortletSecurityException
{
if (getSecure() != null && getSecure().trim().length() > 0)
{
@@ -255,7 +254,7 @@
}
}
- private void clearPreviousTag()
+ protected void clearPreviousTag()
{
parameters = new HashMap(5);
// windowCtx = null;
@@ -276,42 +275,44 @@
return EVAL_BODY_INCLUDE;
}
- /** Generate the URL */
- public int doEndTag() throws JspException
+ protected BaseURL generateURL() throws Exception
{
- String resultingURL = null;
- try
- {
+ BaseURL newPortletURL = getBasePortletEnvironmentAndURL();
- PortletURL newPortletURL = getBasePortletEnvironmentAndURL();
+ setSecure(newPortletURL);
- setWindowState(newPortletURL);
+ // Include parameters as part of the tag request.
- setPortletMode(newPortletURL);
+ if (!parameters.isEmpty())
+ {
+ newPortletURL.setParameters(getURLParameters());
+ }
+ return newPortletURL;
+ }
- setSecure(newPortletURL);
+ protected void writeURL(BaseURL portletURL) throws Exception
+ {
- // Include parameters as part of the tag request.
+ // If a variable was given in the tag to be set in the pageContext,
+ // do that. Otherwise, just write out the URL to the page.
- if (!parameters.isEmpty())
- {
- newPortletURL.setParameters(getURLParameters());
- }
+ if (getVar() != null)
+ {
+ pageContext.setAttribute(getVar(), portletURL.toString());
+ }
+ else
+ {
+ pageContext.getOut().print(portletURL.toString());
+ }
+ }
- resultingURL = newPortletURL.toString();
- // If a variable was given in the tag to be set in the pageContext,
- // do that. Otherwise, just write out the URL to the page.
-
- if (getVar() != null)
- {
- pageContext.setAttribute(getVar(), resultingURL);
- }
- else
- {
- pageContext.getOut().print(resultingURL);
- }
-
+ /** Generate the URL */
+ public int doEndTag() throws JspException
+ {
+ try
+ {
+ writeURL(generateURL());
}
catch (Exception e)
{
@@ -320,4 +321,6 @@
}
return EVAL_PAGE;
}
+
+
}
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/RenderURLTag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/RenderURLTag.java 2008-02-06 18:49:08 UTC (rev 9805)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/taglib/RenderURLTag.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -22,6 +22,9 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.taglib;
+import javax.portlet.PortletURL;
+import javax.portlet.BaseURL;
+
/**
* The renderURL tag for the JSR 168 Portlet specification.
* <p/>
@@ -45,4 +48,15 @@
{
return typeParameter;
}
+
+ protected BaseURL generateURL() throws Exception
+ {
+ PortletURL newPortletURL = (PortletURL)super.generateURL();
+
+ setWindowState(newPortletURL);
+
+ setPortletMode(newPortletURL);
+
+ return newPortletURL;
+ }
}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ActionURL286Tag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ActionURL286Tag.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ActionURL286Tag.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,80 @@
+/*
+* 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.portlet.impl.jsr286.taglib;
+
+import javax.portlet.PortletURL;
+import javax.portlet.BaseURL;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class ActionURL286Tag extends GenerateURL286Tag
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 7920291581022525492L;
+ public static String typeParameter = "action";
+
+ private String name;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ protected void setName(PortletURL portletURL)
+ {
+ if (name != null)
+ {
+ portletURL.setParameter("javax.portlet.action", name);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.portal.portlet.taglib.GenerateURLTag#addTypeParameter()
+ */
+ protected String getTypeValue()
+ {
+ return typeParameter;
+ }
+
+ protected BaseURL generateURL() throws Exception
+ {
+ PortletURL newPortletURL = (PortletURL)super.generateURL();
+
+ setWindowState(newPortletURL);
+
+ setPortletMode(newPortletURL);
+
+ setCopyCurrentRenderParameters(newPortletURL);
+
+ setName(newPortletURL);
+
+ return newPortletURL;
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286Tag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286Tag.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286Tag.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,185 @@
+/*
+* 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.portlet.impl.jsr286.taglib;
+
+import org.jboss.portal.portlet.impl.jsr168.taglib.GenerateURLTag;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.ResourceURLImpl;
+
+import javax.portlet.PortletURL;
+import javax.portlet.PortletContext;
+import javax.portlet.BaseURL;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Enumeration;
+import java.io.StringWriter;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public abstract class GenerateURL286Tag extends GenerateURLTag
+{
+ private Map<String, List> properties;
+
+ private String escapeXml;
+
+ private String copyCurrentRenderParameters;
+
+ private StringWriter stringWriter;
+
+ public String getEscapeXml()
+ {
+ return escapeXml;
+ }
+
+ public void setEscapeXml(String escapeXml)
+ {
+ this.escapeXml = escapeXml;
+ }
+
+ public String getCopyCurrentRenderParameters()
+ {
+ return copyCurrentRenderParameters;
+ }
+
+ public void setCopyCurrentRenderParameters(String copyCurrentRenderParameters)
+ {
+ this.copyCurrentRenderParameters = copyCurrentRenderParameters;
+ }
+
+ protected void setCopyCurrentRenderParameters(PortletURL portletURL)
+ {
+ //default is false
+ if (copyCurrentRenderParameters != null && copyCurrentRenderParameters.equalsIgnoreCase("true"))
+ {
+ portletURL.setParameters(getPortletRequest().getPrivateParameterMap());
+ }
+ }
+
+ protected boolean isEscapeXml()
+ {
+
+ boolean def = true;
+
+ String[] runtime = getConfig().getContainerRuntimeOptions().get("javax.portlet.escapeXml");
+
+ if (runtime != null && runtime.length > 0)
+ {
+ if (runtime[0].equalsIgnoreCase("true"))
+ {
+ def = true;
+ }
+ else if (runtime[0].equalsIgnoreCase("false"))
+ {
+ def = false;
+ }
+ }
+
+ if(escapeXml != null)
+ {
+ return Boolean.parseBoolean(escapeXml);
+ }
+
+ return def;
+ }
+
+ /**
+ * Add a named property. Cater for multiple properties with the same name by storing them in a list.
+ *
+ * @param name
+ * @param value
+ */
+ public void addProperty(String name, String value)
+ {
+ List<String> l = properties.get(name);
+ if (l == null)
+ {
+ l = new ArrayList<String>(5);
+ properties.put(name, l);
+ }
+
+ l.add(value);
+ }
+
+ protected void clearPreviousTag()
+ {
+ stringWriter = new StringWriter();
+ properties = new HashMap<String, List>();
+
+ super.clearPreviousTag();
+ }
+
+ protected BaseURL getBasePortletEnvironmentAndURL()
+ {
+ PortletRequestImpl preq = (PortletRequestImpl)getPortletRequest();
+
+ if ("resource".equals(getTypeValue()))
+ {
+ return ResourceURLImpl.createResourceURL(getInvocation(), preq);
+ }
+ else
+ {
+ return super.getBasePortletEnvironmentAndURL();
+ }
+ }
+
+ protected BaseURL generateURL() throws Exception
+ {
+ BaseURL newPortletURL = super.generateURL();
+
+ if (!properties.isEmpty())
+ {
+ for (String name : properties.keySet())
+ {
+ List<String> props = properties.get(name);
+ for (String prop : props)
+ {
+ newPortletURL.setProperty(name, prop);
+ }
+ }
+ }
+
+ return newPortletURL;
+ }
+
+ protected void writeURL(BaseURL portletURL) throws Exception
+ {
+
+ // If a variable was given in the tag to be set in the pageContext,
+ // do that. Otherwise, just write out the URL to the page.
+
+ portletURL.write(stringWriter, isEscapeXml());
+
+ if (getVar() != null)
+ {
+ pageContext.setAttribute(getVar(), stringWriter.toString());
+ }
+ else
+ {
+ pageContext.getOut().print(stringWriter.toString());
+ }
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286TagTEI.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286TagTEI.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/GenerateURL286TagTEI.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,93 @@
+/*
+* 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.portlet.impl.jsr286.taglib;
+
+import org.jboss.portal.portlet.impl.jsr168.taglib.GenerateURLTagTEI;
+
+import javax.servlet.jsp.tagext.TagData;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class GenerateURL286TagTEI extends GenerateURLTagTEI
+{
+
+ public boolean isValid(TagData data)
+ {
+ return true;
+// if (super.isValid(data) &&
+// isEscapeXmlValid(data) &&
+// isCopyCurrentRenderParameters(data))
+// {
+// return true;
+// }
+ //return false;
+ }
+
+ public boolean isEscapeXmlValid(TagData data)
+ {
+ Object o = data.getAttribute("escapeXml");
+ if (o != null && o != TagData.REQUEST_TIME_VALUE)
+ {
+ String s = (String)o;
+ if (s.toLowerCase().equals("true") ||
+ s.toLowerCase().equals("false"))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ public boolean isCopyCurrentRenderParameters(TagData data)
+ {
+ Object o = data.getAttribute("copyCurrentRenderParameters");
+ if (o != null && o != TagData.REQUEST_TIME_VALUE)
+ {
+ String s = (String)o;
+ if (s.toLowerCase().equals("true") ||
+ s.toLowerCase().equals("false"))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+
+}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/Namespace286Tag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/Namespace286Tag.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/Namespace286Tag.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,33 @@
+/*
+* 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.portlet.impl.jsr286.taglib;
+
+import org.jboss.portal.portlet.impl.jsr168.taglib.NamespaceTag;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class Namespace286Tag extends NamespaceTag
+{
+}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/RenderURL286Tag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/RenderURL286Tag.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/RenderURL286Tag.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,59 @@
+/*
+* 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.portlet.impl.jsr286.taglib;
+
+import javax.portlet.PortletURL;
+import javax.portlet.BaseURL;
+import javax.portlet.ResourceURL;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RenderURL286Tag extends GenerateURL286Tag
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -4232451651940217557L;
+ public static String typeParameter = "render";
+
+ /* (non-Javadoc)
+ * @see org.jboss.portal.portlet.taglib.GenerateURLTag#addTypeParameter()
+ */
+ protected String getTypeValue()
+ {
+ return typeParameter;
+ }
+
+ protected BaseURL generateURL() throws Exception
+ {
+ PortletURL newPortletURL = (PortletURL)super.generateURL();
+
+ setWindowState(newPortletURL);
+
+ setPortletMode(newPortletURL);
+
+ setCopyCurrentRenderParameters(newPortletURL);
+
+ return newPortletURL;
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286Tag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286Tag.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286Tag.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,104 @@
+/*
+* 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.portlet.impl.jsr286.taglib;
+
+import javax.portlet.PortletURL;
+import javax.portlet.ResourceURL;
+import javax.portlet.BaseURL;
+
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class ResourceURL286Tag extends GenerateURL286Tag
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -4132423536342433557L;
+ public static String typeParameter = "resource";
+
+ private String id;
+
+ private String cacheability;
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getCacheability()
+ {
+ return cacheability;
+ }
+
+ protected void setId(ResourceURL resourceURL)
+ {
+ if (id != null)
+ {
+ resourceURL.setResourceID(id);
+ }
+ }
+
+ public void setCacheability(ResourceURL resourceURL)
+ {
+ if (cacheability != null)
+ {
+ resourceURL.setCacheability(cacheability);
+ }
+ else
+ {
+ resourceURL.setCacheability("PAGE");
+ }
+ }
+
+
+ public void setCacheability(String cacheability)
+ {
+ this.cacheability = cacheability;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.portal.portlet.taglib.GenerateURLTag#addTypeParameter()
+ */
+ protected String getTypeValue()
+ {
+ return typeParameter;
+ }
+
+ protected BaseURL generateURL() throws Exception
+ {
+ BaseURL newPortletURL = super.generateURL();
+
+ setId((ResourceURL)newPortletURL);
+ setCacheability((ResourceURL)newPortletURL);
+
+ return newPortletURL;
+ }
+
+}
+
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/ResourceURL286TagTEI.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,66 @@
+/*
+* 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.portlet.impl.jsr286.taglib;
+
+import javax.servlet.jsp.tagext.TagData;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class ResourceURL286TagTEI extends GenerateURL286TagTEI
+{
+
+ public boolean isValid(TagData data)
+ {
+ if (super.isValid(data) &&
+ isCacheability(data))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isCacheability(TagData data)
+ {
+ Object o = data.getAttribute("cacheability");
+ if (o != null && o != TagData.REQUEST_TIME_VALUE)
+ {
+ String s = (String)o;
+ if (s.toLowerCase().equals("full") ||
+ s.toLowerCase().equals("portlet") ||
+ s.toLowerCase().equals("page"))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return true;
+ }
+ }
+}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLParameter286Tag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLParameter286Tag.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLParameter286Tag.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,33 @@
+/*
+* 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.portlet.impl.jsr286.taglib;
+
+import org.jboss.portal.portlet.impl.jsr168.taglib.URLParameterTag;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class URLParameter286Tag extends URLParameterTag
+{
+}
Added: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLProperty286Tag.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLProperty286Tag.java (rev 0)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr286/taglib/URLProperty286Tag.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,155 @@
+/*
+* 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.portlet.impl.jsr286.taglib;
+
+import org.jboss.portal.portlet.impl.jsr168.taglib.GenerateURLTag;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.TagSupport;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class URLProperty286Tag extends TagSupport
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1432342354333218087L;
+ private String name;
+ private String value;
+
+ /**
+ * The name of the property to add to the URL.
+ * <p/>
+ * If null or empty, no action is performed.
+ *
+ * @return Returns the name.
+ * @jsp.attribute required="true" rtexprvalue="true"
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /** @param name The name to set. */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * The value of the property to add to the URL.
+ * <p/>
+ * If null, it is processed as an empty value.
+ *
+ * @return Returns the value.
+ * @jsp.attribute required="true" rtexprvalue="true"
+ */
+ public String getValue()
+ {
+ return value;
+ }
+
+ /** @param value The value to set. */
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ /**
+ * No body to process
+ *
+ * @see javax.servlet.jsp.tagext.Tag#doStartTag()
+ */
+ public int doStartTag() throws JspException
+ {
+ return SKIP_BODY;
+ }
+
+ /**
+ * Include the property in the surround tag properties
+ *
+ * @see javax.servlet.jsp.tagext.Tag#doEndTag()
+ */
+ public int doEndTag() throws JspException
+ {
+ try
+ {
+ GenerateURL286Tag ancestorTag =
+ (GenerateURL286Tag)findAncestorWithClass(this, GenerateURL286Tag.class);
+
+ Property p = new Property(getName(), getValue());
+
+ if (p.isValid())
+ {
+ ancestorTag.addProperty(p.getName(), p.getValue());
+ }
+ else
+ {
+ // Should throw a JspException?
+ // Not according to the JSR 286 spec. Ignore it
+ }
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new JspException(e);
+ }
+ return EVAL_PAGE;
+ }
+
+ public class Property
+ {
+ private String name;
+ private String value;
+
+ /** @return Returns the name. */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Per JSR 286 spec, if null, return an empty value
+ *
+ * @return Returns the value.
+ */
+ public String getValue()
+ {
+ return value;
+ }
+
+ public Property(String name, String value)
+ {
+ this.name = name;
+ this.value = value;
+ }
+
+ public boolean isValid()
+ {
+ return name != null && name.length() > 0;
+ }
+ }
+
+}
Modified: modules/portlet/trunk/portlet/src/main/resources/org/jboss/portal/portlet/portlet_2_0.tld
===================================================================
--- modules/portlet/trunk/portlet/src/main/resources/org/jboss/portal/portlet/portlet_2_0.tld 2008-02-06 18:49:08 UTC (rev 9805)
+++ modules/portlet/trunk/portlet/src/main/resources/org/jboss/portal/portlet/portlet_2_0.tld 2008-02-06 19:02:10 UTC (rev 9806)
@@ -14,7 +14,7 @@
<tag>
<name>param</name>
- <tag-class>org.jboss.portal.portlet.impl.jsr168.taglib.URLParameterTag</tag-class>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.URLParameter286Tag</tag-class>
<body-content>empty</body-content>
<attribute>
@@ -33,9 +33,29 @@
</tag>
<tag>
+ <name>property</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.URLProperty286Tag</tag-class>
+ <body-content>empty</body-content>
+
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
<name>renderURL</name>
- <tag-class>org.jboss.portal.portlet.impl.jsr168.taglib.RenderURLTag</tag-class>
- <tei-class>org.jboss.portal.portlet.impl.jsr168.taglib.GenerateURLTagTEI</tei-class>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.RenderURL286Tag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.GenerateURL286TagTEI</tei-class>
<body-content>JSP</body-content>
<attribute>
@@ -58,7 +78,17 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>copyCurrentRenderParameters</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
</tag>
<tag>
@@ -71,8 +101,8 @@
<tag>
<name>actionURL</name>
- <tag-class>org.jboss.portal.portlet.impl.jsr168.taglib.ActionURLTag</tag-class>
- <tei-class>org.jboss.portal.portlet.impl.jsr168.taglib.GenerateURLTagTEI</tei-class>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.ActionURL286Tag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.GenerateURL286TagTEI</tei-class>
<body-content>JSP</body-content>
<attribute>
@@ -95,12 +125,62 @@
<rtexprvalue>true</rtexprvalue>
</attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>copyCurrentRenderParameters</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>name</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+
</tag>
<tag>
+ <name>resourceURL</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.ResourceURL286Tag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.ResourceURL286TagTEI</tei-class>
+ <body-content>JSP</body-content>
+
+ <attribute>
+ <name>secure</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>cacheability</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>id</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
<name>namespace</name>
- <tag-class>org.jboss.portal.portlet.impl.jsr168.taglib.NamespaceTag</tag-class>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.Namespace286Tag</tag-class>
<body-content>empty</body-content>
</tag>
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/ActionURLTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/ActionURLTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/ActionURLTestCase.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,111 @@
+/*
+* 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.test.portlet.jsr168.ext.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletURLImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletURL;
+import javax.portlet.WindowState;
+import javax.portlet.PortletMode;
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class ActionURLTestCase extends TaglibTestCase
+{
+ public ActionURLTestCase(PortletTestCase seq)
+ {
+
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/actionURL.jsp");
+
+ PortletURL pu1 = response.createActionURL();
+
+ pu1.setWindowState(WindowState.MAXIMIZED);
+ pu1.setPortletMode(PortletMode.EDIT);
+ pu1.setSecure(true);
+
+ PortletURL pu2 = response.createActionURL();
+ pu2.setSecure(false);
+
+ pu2.setParameter("testParam", new String[] {"testParamValue", "testParamValue2"});
+ pu2.setParameter("secondParam", "testParamValue");
+
+ // Create session
+ request.getPortletSession();
+
+ // escapeXml=true
+ String url1 = response.encodeURL(pu1.toString());
+
+ // escapeXml=false
+ String url2 = response.encodeURL(pu2.toString());
+
+ expectedResults = new String[]{ url1 , url1 , url2 };
+
+ include(dispatcher, request, response);
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResults(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
\ No newline at end of file
Copied: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/DefineObjectsTestCase.java (from rev 9794, modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/DefineObjectsTestCase.java)
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/DefineObjectsTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/DefineObjectsTestCase.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,95 @@
+/*
+* 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.test.portlet.jsr168.ext.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.Assertion;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletActionTestAction;
+import org.jboss.portal.unit.actions.PortletEventTestAction;
+import org.jboss.portal.unit.actions.PortletResourceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.jsr286.tck.taglib.*;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.*;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.EventRequest;
+import javax.portlet.EventResponse;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase({
+ Assertion.JSR286_113
+ })
+public class DefineObjectsTestCase extends TaglibTestCase
+{
+
+ //TODO: doesn't test include from action/event - the actionRequest/actionResponse/eventRequest/eventResponse objects
+
+ public DefineObjectsTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/defineObjects.jsp");
+
+ include(dispatcher, request, response);
+
+ expectedResult = "jspDispatch,renderRequest,renderResponse,portletConfig";
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ assertResult(context);
+
+ return new EndTestResponse();
+ }
+ });
+ }
+}
\ No newline at end of file
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/NamespaceTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/NamespaceTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/NamespaceTestCase.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,89 @@
+/*
+* 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.test.portlet.jsr168.ext.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletResourceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.jsr286.tck.taglib.*;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class NamespaceTestCase extends TaglibTestCase
+{
+
+ public NamespaceTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/namespace.jsp");
+
+ expectedResult = response.getNamespace();
+
+ include(dispatcher, request, response);
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResult(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
\ No newline at end of file
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/RenderURLTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/RenderURLTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/RenderURLTestCase.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,125 @@
+/*
+* 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.test.portlet.jsr168.ext.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.jsr286.tck.taglib.*;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.WindowState;
+import javax.portlet.PortletMode;
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class RenderURLTestCase extends TaglibTestCase
+{
+ public RenderURLTestCase(PortletTestCase seq)
+ {
+
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/renderURL.jsp");
+
+ PortletURL pu1 = response.createRenderURL();
+
+ pu1.setWindowState(WindowState.NORMAL);
+ pu1.setPortletMode(PortletMode.EDIT);
+ pu1.setSecure(true);
+
+ PortletURL pu2 = response.createRenderURL();
+ pu2.setSecure(false);
+
+ pu2.setParameter("testParam", new String[] {"testParamValue", "testParamValue2"});
+ pu2.setParameter("secondParam", "testParamValue");
+
+ // Create session
+ request.getPortletSession();
+
+ // escapeXml=true
+ String url1 = response.encodeURL(pu1.toString());
+
+
+ // escapeXml=false
+ String url2 = response.encodeURL(pu2.toString());
+
+
+ expectedResults = new String[]{ url2 };
+
+ include(dispatcher, request, response);
+
+
+// <portlet:renderURL windowState="normal" portletMode="edit" secure="true"/>
+//
+//<test_result_separator/>
+//
+//<portlet:renderURL windowState="normal" portletMode="edit" secure="true"/>
+//<%
+// //Put url placed as page variable
+// out.print(pageContext.getAttribute("testVar"));
+//%>
+//
+//<test_result_separator/>
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+
+
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResults(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
\ No newline at end of file
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/TaglibTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/TaglibTestCase.java 2008-02-06 18:49:08 UTC (rev 9805)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr168/ext/taglib/TaglibTestCase.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -31,6 +31,8 @@
import org.jboss.portal.unit.annotations.TestCase;
import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
@@ -42,12 +44,14 @@
import javax.portlet.PortletSession;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
+import java.io.Writer;
/**
* The goal is to test that cross context session attributes are set in container and are accessible from the direct
@@ -59,20 +63,58 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-@TestCase
-public class TaglibTestCase
+public abstract class TaglibTestCase
{
- public TaglibTestCase(PortletTestCase seq)
+
+ protected String startTag;
+ protected String endTag;
+ protected String expectedResult;
+ protected String[] expectedResults;
+
+
+ protected void include(PortletRequestDispatcher dispatcher, RenderRequest request, RenderResponse response) throws IOException, PortletException
{
- seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ startTag = "<div id=" + response.getNamespace() + ">";
+ endTag = "</div>";
+
+ Writer writer = response.getWriter();
+
+ writer.write(startTag);
+ dispatcher.include(request, response);
+ writer.write(endTag);
+ }
+
+ protected void assertResult(PortletTestContext context)
+ {
+ String prevResponse = new String(context.getResponseBody());
+
+ String portletResp = prevResponse.substring(prevResponse.indexOf(startTag) + startTag.length(), prevResponse.indexOf(endTag));
+
+ assertEquals(expectedResult, portletResp.trim());
+ }
+
+ protected void assertResults(PortletTestContext context)
+ {
+ String prevResponse = new String(context.getResponseBody());
+
+ String portletResp = prevResponse.substring(prevResponse.indexOf(startTag) + startTag.length(), prevResponse.indexOf(endTag));
+
+ String[] results = portletResp.split("<test_result_separator/>");
+
+ // Trim all results
+ for (int i = 0; i < results.length; i++)
{
- protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
- {
- response.setContentType("text/html");
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/usetaglib.jsp");
- dispatcher.include(request, response);
- return new EndTestResponse();
- }
- });
+ results[i] = results[i].trim();
+
+ }
+
+
+ assertEquals(expectedResults, results);
}
-}
\ No newline at end of file
+
+ protected PortletInvocation getInvocation(PortletRequest req)
+ {
+ // Get the invocation
+ return (PortletInvocation)req.getAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
+ }
+}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ActionURLTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ActionURLTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ActionURLTestCase.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,142 @@
+/*
+* 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.test.portlet.jsr286.tck.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletURLImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletURL;
+import javax.portlet.WindowState;
+import javax.portlet.PortletMode;
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class ActionURLTestCase extends TaglibTestCase
+{
+ public ActionURLTestCase(PortletTestCase seq)
+ {
+
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+
+ PortletURL url = response.createRenderURL();
+ url.setParameter("testParamOne", "testValue1");
+ url.setParameter("testParameterTwo", "testValue2");
+
+
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/actionURL.jsp");
+
+ PortletURL pu1 = response.createActionURL();
+
+ pu1.setWindowState(WindowState.MAXIMIZED);
+ pu1.setPortletMode(PortletMode.EDIT);
+ pu1.setSecure(true);
+ pu1.setParameter("javax.portlet.action", "testAction");
+
+ // Params from previos request
+ pu1.setParameter("testParamOne", "testValue1");
+ pu1.setParameter("testParameterTwo", "testValue2");
+
+ PortletURL pu2 = response.createActionURL();
+ pu2.setSecure(false);
+ pu2.setParameter("javax.portlet.action", "testAction");
+
+ pu2.setParameter("testParam", new String[] {"testParamValue", "testParamValue2"});
+ pu2.setParameter("secondParam", "testParamValue");
+ pu2.setProperty("testProperty", "testPropValue");
+ pu2.setProperty("testProperty", "testPropValue2");
+ pu2.setProperty("secondProperty", "testPropValue");
+
+ StringWriter sw = new StringWriter();
+
+ // Create session
+ request.getPortletSession();
+
+ // escapeXml=true
+ pu1.write(sw, true);
+ String url1 = response.encodeURL(sw.toString());
+
+ sw = new StringWriter();
+
+ // escapeXml=false
+ pu2.write(sw, false);
+ String url2 = response.encodeURL(sw.toString());
+ sw.flush();
+
+
+ expectedResults = new String[]{ url1, url1, url2};
+
+ include(dispatcher, request, response);
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResults(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/DefineObjectsTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/DefineObjectsTestCase.java 2008-02-06 18:49:08 UTC (rev 9805)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/DefineObjectsTestCase.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -58,14 +58,11 @@
@TestCase({
Assertion.JSR286_113
})
-public class DefineObjectsTestCase
+public class DefineObjectsTestCase extends TaglibTestCase
{
//TODO: doesn't test include from action/event - the actionRequest/actionResponse/eventRequest/eventResponse objects
- private String startTag;
- private String endTag;
-
public DefineObjectsTestCase(PortletTestCase seq)
{
seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
@@ -73,18 +70,14 @@
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
response.setContentType("text/html");
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/taglib.jsp");
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/defineObjects.jsp");
- startTag = "<div id=" + response.getNamespace() + ">";
- endTag = "</div>";
+ include(dispatcher, request, response);
- Writer writer = response.getWriter();
+ expectedResult = "jspDispatch,renderRequest,renderResponse,portletConfig,portletSession,portletSessionScope," +
+ "portletPreferences,portletPreferencesValues";
- writer.write(startTag);
- dispatcher.include(request, response);
- writer.write(endTag);
-
return new InvokeGetResponse(response.createRenderURL().toString());
}
});
@@ -95,15 +88,8 @@
{
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
- response.setContentType("text/html");
-
- String prevResponse = new String(context.getResponseBody());
-
- String portletResp = prevResponse.substring(prevResponse.indexOf(startTag) + startTag.length(), prevResponse.indexOf(endTag));
-
- assertEquals("jspDispatch,renderRequest,renderResponse,portletConfig,portletSession,portletSessionScope," +
- "portletPreferences,portletPreferencesValues", portletResp.trim());
-
+ assertResult(context);
+
return new InvokeGetResponse(response.createResourceURL().toString());
}
});
@@ -113,7 +99,7 @@
protected DriverResponse run(Portlet portlet, ResourceRequest request, ResourceResponse response, PortletTestContext context) throws IOException, PortletException
{
response.setContentType("text/html");
- PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/taglib.jsp");
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getRequestDispatcher("/defineObjects.jsp");
startTag = "<div id=" + response.getNamespace() + ">";
endTag = "</div>";
@@ -124,6 +110,9 @@
dispatcher.include(request, response);
writer.write(endTag);
+ expectedResult = "jspDispatch,resourceRequest,resourceResponse,portletConfig,portletSession,portletSessionScope," +
+ "portletPreferences,portletPreferencesValues";
+
return new InvokeGetResponse(response.createRenderURL().toString());
}
});
@@ -132,15 +121,8 @@
{
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
- response.setContentType("text/html");
+ assertResult(context);
- String prevResponse = new String(context.getResponseBody());
-
- String portletResp = prevResponse.substring(prevResponse.indexOf(startTag) + startTag.length(), prevResponse.indexOf(endTag));
-
- assertEquals("jspDispatch,resourceRequest,resourceResponse,portletConfig,portletSession,portletSessionScope," +
- "portletPreferences,portletPreferencesValues", portletResp.trim());
-
return new EndTestResponse();
}
});
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/NamespaceTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/NamespaceTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/NamespaceTestCase.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,88 @@
+/*
+* 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.test.portlet.jsr286.tck.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.unit.actions.PortletResourceTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.ResourceRequest;
+import javax.portlet.ResourceResponse;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class NamespaceTestCase extends TaglibTestCase
+{
+
+ public NamespaceTestCase(PortletTestCase seq)
+ {
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/namespace.jsp");
+
+ expectedResult = response.getNamespace();
+
+ include(dispatcher, request, response);
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResult(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/RenderURLTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/RenderURLTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/RenderURLTestCase.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,137 @@
+/*
+* 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.test.portlet.jsr286.tck.taglib;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.WindowState;
+import javax.portlet.PortletMode;
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class RenderURLTestCase extends TaglibTestCase
+{
+ public RenderURLTestCase(PortletTestCase seq)
+ {
+
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+
+ PortletURL url = response.createRenderURL();
+ url.setParameter("testParamOne", "testValue1");
+ url.setParameter("testParameterTwo", "testValue2");
+
+
+ return new InvokeGetResponse(url.toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/renderURL.jsp");
+
+ PortletURL pu1 = response.createRenderURL();
+
+ pu1.setWindowState(WindowState.NORMAL);
+ pu1.setPortletMode(PortletMode.EDIT);
+ pu1.setSecure(true);
+
+ // Params from previos request
+ pu1.setParameter("testParamOne", "testValue1");
+ pu1.setParameter("testParameterTwo", "testValue2");
+
+ PortletURL pu2 = response.createRenderURL();
+ pu2.setSecure(false);
+
+ pu2.setParameter("testParam", new String[] {"testParamValue", "testParamValue2"});
+ pu2.setParameter("secondParam", "testParamValue");
+ pu2.setProperty("testProperty", "testPropValue");
+ pu2.setProperty("testProperty", "testPropValue2");
+ pu2.setProperty("secondProperty", "testPropValue");
+
+ StringWriter sw = new StringWriter();
+
+ // Create session
+ request.getPortletSession();
+
+ // escapeXml=true
+ pu1.write(sw, true);
+ String url1 = response.encodeURL(sw.toString());
+
+ sw = new StringWriter();
+
+ // escapeXml=false
+ pu2.write(sw, false);
+ String url2 = response.encodeURL(sw.toString());
+ sw.flush();
+
+
+ expectedResults = new String[]{ url1, url1, url2};
+
+ include(dispatcher, request, response);
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResults(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/ResourceURLTestCase.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,131 @@
+/*
+* 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.test.portlet.jsr286.tck.taglib;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.portlet.Portlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletURL;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.WindowState;
+import javax.portlet.PortletMode;
+import javax.portlet.ResourceURL;
+import java.io.IOException;
+import java.io.StringWriter;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+@TestCase
+public class ResourceURLTestCase extends TaglibTestCase
+{
+ public ResourceURLTestCase(PortletTestCase seq)
+ {
+
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().
+ getRequestDispatcher("/resourceURL.jsp");
+
+ ResourceURL pu1 = response.createResourceURL();
+
+ pu1.setSecure(true);
+ pu1.setCacheability("FULL");
+
+ ResourceURL pu2 = response.createResourceURL();
+
+ pu2.setSecure(true);
+ pu2.setResourceID("testId1");
+
+
+ ResourceURL pu3 = response.createResourceURL();
+ pu3.setSecure(false);
+
+ pu3.setParameter("testParam", new String[] {"testParamValue", "testParamValue2"});
+ pu3.setParameter("secondParam", "testParamValue");
+ pu3.setProperty("testProperty", "testPropValue");
+ pu3.setProperty("testProperty", "testPropValue2");
+ pu3.setProperty("secondProperty", "testPropValue");
+
+
+ StringWriter sw = new StringWriter();
+
+ // Create session
+ request.getPortletSession();
+
+ // escapeXml=true
+ pu1.write(sw, true);
+ String url1 = response.encodeURL(sw.toString());
+
+ sw = new StringWriter();
+
+ // escapeXml=true
+ pu2.write(sw, true);
+ String url2 = response.encodeURL(sw.toString());
+
+ sw = new StringWriter();
+
+ // escapeXml=false
+ pu3.write(sw, false);
+ String url3 = response.encodeURL(sw.toString());
+
+
+ expectedResults = new String[]{ url1, url2, url3};
+
+ include(dispatcher, request, response);
+
+
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
+ {
+ response.setContentType("text/html");
+
+ assertResults(context);
+
+ return new EndTestResponse();
+ }
+ });
+
+
+ }
+}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/TaglibTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/TaglibTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/tck/taglib/TaglibTestCase.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,99 @@
+/*
+* 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.test.portlet.jsr286.tck.taglib;
+
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
+import static org.jboss.unit.api.Assert.assertEquals;
+
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.RenderResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.PortletException;
+import javax.servlet.ServletRequest;
+import java.io.Writer;
+import java.io.IOException;
+
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public abstract class TaglibTestCase
+{
+
+ protected String startTag;
+ protected String endTag;
+ protected String expectedResult;
+ protected String[] expectedResults;
+
+
+ protected void include(PortletRequestDispatcher dispatcher, RenderRequest request, RenderResponse response) throws IOException, PortletException
+ {
+ startTag = "<div id=" + response.getNamespace() + ">";
+ endTag = "</div>";
+
+ Writer writer = response.getWriter();
+
+ writer.write(startTag);
+ dispatcher.include(request, response);
+ writer.write(endTag);
+ }
+
+ protected void assertResult(PortletTestContext context)
+ {
+ String prevResponse = new String(context.getResponseBody());
+
+ String portletResp = prevResponse.substring(prevResponse.indexOf(startTag) + startTag.length(), prevResponse.indexOf(endTag));
+
+ assertEquals(expectedResult, portletResp.trim());
+ }
+
+ protected void assertResults(PortletTestContext context)
+ {
+ String prevResponse = new String(context.getResponseBody());
+
+ String portletResp = prevResponse.substring(prevResponse.indexOf(startTag) + startTag.length(), prevResponse.indexOf(endTag));
+
+ String[] results = portletResp.split("<test_result_separator/>");
+
+ // Trim all results
+ for (int i = 0; i < results.length; i++)
+ {
+ results[i] = results[i].trim();
+
+ }
+
+
+ assertEquals(expectedResults, results);
+ }
+
+ protected PortletInvocation getInvocation(PortletRequest req)
+ {
+ // Get the invocation
+ return (PortletInvocation)req.getAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
+ }
+}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-02-06 18:49:08 UTC (rev 9805)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-02-06 19:02:10 UTC (rev 9806)
@@ -1280,37 +1280,78 @@
"that the portlet must have when this link is executed, if no error condition ocurred"),
JSR286_319(new TCK(319), "PLT.26.2", "If the specified portlet mode is illegal for the current request, a " +
"JspException must be thrown."),
- JSR286_320(new TCK(320), "PLT.26.2", ""),
- JSR286_321(new TCK(321), "PLT.26.2", ""),
- JSR286_322(new TCK(322), "PLT.26.2", ""),
- JSR286_323(new TCK(323), Status.specUntestable(""), "PLT.26.2", ""),
- JSR286_324(new TCK(324), Status.specUntestable(""), "PLT.26.2", ""),
- JSR286_325(new TCK(325), Status.specUntestable(""), "PLT.26.2", ""),
- JSR286_326(new TCK(326), Status.specUntestable(""), "PLT.26.2", ""),
- JSR286_327(new TCK(327), "PLT.26.3", ""),
- JSR286_328(new TCK(328), "PLT.26.3", ""),
- JSR286_329(new TCK(329), "PLT.26.3", ""),
- JSR286_330(new TCK(330), "PLT.26.3", ""),
- JSR286_331(new TCK(331), "PLT.26.3", ""),
- JSR286_332(new TCK(332), "PLT.26.3", ""),
- JSR286_333(new TCK(333), "PLT.26.3", ""),
- JSR286_334(new TCK(334), "PLT.26.3", ""),
- JSR286_335(new TCK(335), Status.specUntestable(""), "PLT.26.3", ""),
- JSR286_336(new TCK(336), Status.specUntestable(""), "PLT.26.3", ""),
- JSR286_337(new TCK(337), Status.specUntestable(""), "PLT.26.3", ""),
- JSR286_338(new TCK(338), Status.specUntestable(""), "PLT.26.3", ""),
- JSR286_339(new TCK(339), "PLT.26.4", ""),
- JSR286_340(new TCK(340), "PLT.26.4", ""),
- JSR286_341(new TCK(341), "PLT.26.4", ""),
- JSR286_342(new TCK(342), "PLT.26.4", ""),
- JSR286_343(new TCK(343), "PLT.26.4", ""),
- JSR286_344(new TCK(344), "PLT.26.4", ""),
- JSR286_345(new TCK(345), "PLT.26.4", ""),
- JSR286_346(new TCK(346), "PLT.26.5", ""),
- JSR286_347(new TCK(347), "PLT.26.6", ""),
- JSR286_348(new TCK(348), "PLT.26.6", ""),
- JSR286_349(new TCK(349), "PLT.26.6", ""),
- JSR286_350(new TCK(350), "PLT.26.6", "")
+ JSR286_320(new TCK(320), "PLT.26.2", "If a portlet mode is not set for a URL, it must stay the same as the mode of " +
+ "the current request."),
+ JSR286_321(new TCK(321), "PLT.26.2", "If the result is exported as a JSP scoped variable, defined via the var " +
+ "attributes, nothing is written to the current JspWriter."),
+ JSR286_322(new TCK(322), "PLT.26.2", "If the given variable name already exists in the scope of the page or it " +
+ "is used within an iteration loop, the new value overwrites the old one."),
+ JSR286_323(new TCK(323), Status.specUntestable(""), "PLT.26.2", "If the specified security setting is not supported " +
+ "by the run-time environment, a JspException must be thrown"),
+ JSR286_324(new TCK(324), Status.specUntestable(""), "PLT.26.2", "copyCurrentRenderParameters (Type: boolean, " +
+ "non-required) – if set to true requests that the private render parameters of the portlet of the current " +
+ "request must be attached to this URL."),
+ JSR286_325(new TCK(325), Status.specUntestable(""), "PLT.26.2", "If additional <portlet:param> tags are specified " +
+ "parameters with the same name as an existing render parameter will get merged and the value defined in " +
+ "additional <portlet:param> tags must be pre-pended."),
+ JSR286_326(new TCK(326), Status.specUntestable(""), "PLT.26.2", "escapeXml (Type: boolean, non-required) – " +
+ "determines whether characters <,>,&,’,” in the resulting output should be converted to their corresponding " +
+ "character entity codes (‘<’ gets converted to ‘<’, ‘>’ gets converted to ‘>’ ‘&’ gets converted to " +
+ "‘&’, ‘‘’ gets converted to ‘'’, ‘”’ gets converted to ‘"’)."),
+ JSR286_327(new TCK(327), "PLT.26.3", "The portlet renderURL tag creates a URL that must point to the current " +
+ "portlet and must trigger a render request with the supplied parameters."),
+ JSR286_328(new TCK(328), "PLT.26.3", "If the specified window state is illegal for the current request, a " +
+ "JspException must be thrown."),
+ JSR286_329(new TCK(329), "PLT.26.3", "If a window state is not set for a URL, it should stay the same as the " +
+ "window state of the current request."),
+ JSR286_330(new TCK(330), "PLT.26.3", "portletMode (Type: String, non-required) – indicates the portlet mode that " +
+ "the portlet must have when this link is executed, if not error condition ocurred."),
+ JSR286_331(new TCK(331), "PLT.26.3", "If the specified portlet mode is illegal for the current request, a " +
+ "JspException must be thrown."),
+ JSR286_332(new TCK(332), "PLT.26.3", "If a portlet mode is not set for a URL, it must stay the same as the " +
+ "mode of the current request."),
+ JSR286_333(new TCK(333), "PLT.26.3", "If the result is exported as a JSP scoped variable, defined via the var " +
+ "attributes, nothing is written to the current JspWriter."),
+ JSR286_334(new TCK(334), "PLT.26.3", "If the given variable name already exists in the scope of the page or it " +
+ "is used within an iteration loop, the new value overwrites the old one"),
+ JSR286_335(new TCK(335), Status.specUntestable(""), "PLT.26.3", "If the security is not set for a URL, it must " +
+ "stay the same as the security setting of the current request."),
+ JSR286_336(new TCK(336), Status.specUntestable(""), "PLT.26.3", "copyCurrentRenderParameters (Type: boolean, " +
+ "non-required) – if set to true requests that the private render parameters of the portlet of the current " +
+ "request must attached to this URL."),
+ JSR286_337(new TCK(337), Status.specUntestable(""), "PLT.26.3", "If additional <portlet:param> tags are specified " +
+ "parameters with the same name as an existing render parameter will get merged and the value defined in " +
+ "additional <portlet:param> tags must be pre-pended."),
+ JSR286_338(new TCK(338), Status.specUntestable(""), "PLT.26.3", "escapeXml (Type: boolean, non-required) – " +
+ "deterrmines whether characters <,>,&,’,” in the resulting output should be converted to their corresponding " +
+ "character entity codes (‘<’ gets converted to ‘<’, ‘>’ gets converted to ‘>’ ‘&’ gets converted to " +
+ "‘&’, ‘‘’ gets converted to ‘'’, ‘”’ gets converted to ‘"’)."),
+ JSR286_339(new TCK(339), "PLT.26.4", "The portlet resourceURL tag creates a URL that must point to the current " +
+ "portlet and must trigger a serveResource request with the supplied parameters"),
+ JSR286_340(new TCK(340), "PLT.26.4", "The resourceURL must preserve the current portlet mode, window state and " +
+ "render parameters."),
+ JSR286_341(new TCK(341), "PLT.26.4", "If such a parameter has the same name as a render parameter in this URL, " +
+ "the render parameter value must be the last value in the attribute value array."),
+ JSR286_342(new TCK(342), "PLT.26.4", "If the result is exported as a JSP scoped variable, defined via the var " +
+ "attributes, nothing is written to the current JspWriter"),
+ JSR286_343(new TCK(343), "PLT.26.4", "If the given variable name already exists in the scope of the page or it " +
+ "is used within an iteration loop, the new value overwrites the old one."),
+ JSR286_344(new TCK(344), Status.specUntestable(""), "PLT.26.4", "If the security is not set for a URL, it must " +
+ "stay the same as the security setting of the current request."),
+ JSR286_345(new TCK(345), Status.specUntestable(""), "PLT.26.4", "escapeXml (Type: boolean, non-required) – " +
+ "determines whether characters <,>,&,’,” in the resulting output should be converted to their corresponding " +
+ "character entity codes (‘<’ gets converted to ‘<’, ‘>’ gets converted to ‘>’ ‘&’ gets converted to " +
+ "‘&’, ‘‘’ gets converted to ‘'’, ‘”’ gets converted to ‘"’)."),
+ JSR286_346(new TCK(346), "PLT.26.5", "This tag produces a unique value for the current portlet and must match " +
+ "the value of PortletResponse.getNamespace method."),
+ JSR286_347(new TCK(347), "PLT.26.6", "This tag defines a parameter that may be added to an actionURL, renderURL " +
+ "or resourceURL."),
+ JSR286_348(new TCK(348), Status.specUntestable(""), "PLT.26.6", "The param tag must not contain any body content."),
+ JSR286_349(new TCK(349), "PLT.26.6", "If the param tag has an empty value the specified parameter name must be " +
+ "removed from the URL."),
+ JSR286_350(new TCK(350), "PLT.26.6", "If the same name of a parameter occurs more than once within an actionURL, " +
+ "renderURL or resourceURL the values must be delivered as parameter value array with the values in the order " +
+ "of the declaration within the URL tag.")
;
Modified: modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/portlet.xml 2008-02-06 18:49:08 UTC (rev 9805)
+++ modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/WEB-INF/portlet.xml 2008-02-06 19:02:10 UTC (rev 9806)
@@ -31,7 +31,8 @@
<portlet-name>UniversalTestPortletA</portlet-name>
<portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
<supports>
- <mime-type>text/html</mime-type>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>EDIT</portlet-mode>
</supports>
<portlet-info>
<title></title>
Added: modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/actionURL.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/actionURL.jsp (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/actionURL.jsp 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,23 @@
+<%@ page language="java" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+<portlet:defineObjects/>
+
+<portlet:actionURL windowState="maximized" portletMode="edit" secure="true"/>
+
+<test_result_separator/>
+
+<portlet:actionURL windowState="maximized" portletMode="edit" secure="true" var="testVar"/>
+<%
+ //Put url placed as page variable
+ out.print(pageContext.getAttribute("testVar"));
+%>
+
+<test_result_separator/>
+
+<portlet:actionURL secure="false">
+
+ <portlet:param name="testParam" value="testParamValue"/>
+ <portlet:param name="testParam" value="testParamValue2"/>
+ <portlet:param name="secondParam" value="testParamValue"/>
+
+</portlet:actionURL>
Added: modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/defineObjects.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/defineObjects.jsp (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/defineObjects.jsp 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,23 @@
+<%@ page import="javax.portlet.RenderRequest" %>
+<%@ page import="javax.portlet.RenderResponse" %>
+<%@ page import="javax.portlet.PortletConfig" %>
+<%@ page language="java" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+<portlet:defineObjects/>
+<%
+ out.print("jspDispatch");
+
+ if (renderRequest != null && renderRequest instanceof RenderRequest)
+ {
+ out.print(",renderRequest");
+ }
+ if (renderResponse != null && renderResponse instanceof RenderResponse)
+ {
+ out.print(",renderResponse");
+ }
+ if (portletConfig != null && portletConfig instanceof PortletConfig)
+ {
+ out.print(",portletConfig");
+ }
+
+%>
\ No newline at end of file
Added: modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/namespace.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/namespace.jsp (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/namespace.jsp 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,4 @@
+<%@ page language="java" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+<portlet:defineObjects/>
+<portlet:namespace/>
\ No newline at end of file
Added: modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/renderURL.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/renderURL.jsp (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr168/ext/taglib-war/renderURL.jsp 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,9 @@
+<%@ page language="java" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+<portlet:defineObjects/>
+
+<portlet:renderURL secure="false">
+ <portlet:param name="testParam" value="testParamValue"/>
+ <portlet:param name="testParam" value="testParamValue2"/>
+ <portlet:param name="secondParam" value="testParamValue"/>
+</portlet:renderURL>
\ No newline at end of file
Modified: modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/WEB-INF/portlet.xml 2008-02-06 18:49:08 UTC (rev 9805)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/WEB-INF/portlet.xml 2008-02-06 19:02:10 UTC (rev 9806)
@@ -32,6 +32,7 @@
<portlet-class>org.jboss.portal.test.portlet.framework.UTP1</portlet-class>
<supports>
<mime-type>text/html</mime-type>
+ <portlet-mode>EDIT</portlet-mode>
</supports>
</portlet>
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/actionURL.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/actionURL.jsp (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/actionURL.jsp 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,29 @@
+<%@ page language="java" %>
+<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
+<portlet:defineObjects/>
+
+<portlet:actionURL windowState="maximized" portletMode="edit" secure="true" copyCurrentRenderParameters="true"
+ escapeXml="true" name="testAction"/>
+
+<test_result_separator/>
+
+<portlet:actionURL windowState="maximized" portletMode="edit" secure="true" copyCurrentRenderParameters="true"
+ escapeXml="true" name="testAction" var="testVar"/>
+<%
+ //Put url placed as page variable
+ out.print(pageContext.getAttribute("testVar"));
+%>
+
+<test_result_separator/>
+
+<portlet:actionURL secure="false" name="testAction" escapeXml="false">
+
+ <portlet:property name="testProperty" value="testPropValue"/>
+ <portlet:property name="testProperty" value="testPropValue2"/>
+ <portlet:property name="secondProperty" value="testPropValue"/>
+
+ <portlet:param name="testParam" value="testParamValue"/>
+ <portlet:param name="testParam" value="testParamValue2"/>
+ <portlet:param name="secondParam" value="testParamValue"/>
+
+</portlet:actionURL>
Copied: modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/defineObjects.jsp (from rev 9794, modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/taglib.jsp)
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/defineObjects.jsp (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/defineObjects.jsp 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,73 @@
+<%@ page import="org.jboss.unit.api.Assert" %>
+<%@ page import="javax.portlet.RenderRequest" %>
+<%@ page import="javax.portlet.RenderResponse" %>
+<%@ page import="javax.portlet.ActionRequest" %>
+<%@ page import="javax.portlet.ActionResponse" %>
+<%@ page import="javax.portlet.EventRequest" %>
+<%@ page import="javax.portlet.EventResponse" %>
+<%@ page import="javax.portlet.ResourceRequest" %>
+<%@ page import="javax.portlet.ResourceResponse" %>
+<%@ page import="javax.portlet.PortletConfig" %>
+<%@ page import="javax.portlet.PortletSession" %>
+<%@ page import="java.util.Map" %>
+<%@ page import="javax.portlet.PortletPreferences" %>
+<%@ page language="java" %>
+<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
+<portlet:defineObjects/>
+<%
+ out.print("jspDispatch");
+
+ if (renderRequest != null && renderRequest instanceof RenderRequest)
+ {
+ out.print(",renderRequest");
+ }
+ if (renderResponse != null && renderResponse instanceof RenderResponse)
+ {
+ out.print(",renderResponse");
+ }
+ if (actionRequest != null && actionRequest instanceof ActionRequest)
+ {
+ out.print(",actionRequest");
+ }
+ if (actionResponse != null && actionResponse instanceof ActionResponse)
+ {
+ out.print(",actionResponse");
+ }
+ if (eventRequest != null && eventRequest instanceof EventRequest)
+ {
+ out.print(",eventRequest");
+ }
+ if (eventResponse != null && eventResponse instanceof EventResponse)
+ {
+ out.print(",eventResponse");
+ }
+ if (resourceRequest != null && resourceRequest instanceof ResourceRequest)
+ {
+ out.print(",resourceRequest");
+ }
+ if (resourceResponse != null && resourceResponse instanceof ResourceResponse)
+ {
+ out.print(",resourceResponse");
+ }
+ if (portletConfig != null && portletConfig instanceof PortletConfig)
+ {
+ out.print(",portletConfig");
+ }
+ if (portletSession != null && portletSession instanceof PortletSession)
+ {
+ out.print(",portletSession");
+ }
+ if (portletSessionScope != null && portletSessionScope instanceof Map)
+ {
+ out.print(",portletSessionScope");
+ }
+ if (portletPreferences != null && portletPreferences instanceof PortletPreferences)
+ {
+ out.print(",portletPreferences");
+ }
+ if (portletPreferencesValues != null && portletPreferencesValues instanceof Map)
+ {
+ out.print(",portletPreferencesValues");
+ }
+
+%>
\ No newline at end of file
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/namespace.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/namespace.jsp (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/namespace.jsp 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,4 @@
+<%@ page language="java" %>
+<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
+<portlet:defineObjects/>
+<portlet:namespace/>
\ No newline at end of file
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/renderURL.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/renderURL.jsp (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/renderURL.jsp 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,27 @@
+<%@ page language="java" %>
+<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
+<portlet:defineObjects/>
+
+<portlet:renderURL windowState="normal" portletMode="edit" secure="true" copyCurrentRenderParameters="true"
+ escapeXml="true"/>
+
+<test_result_separator/>
+
+<portlet:renderURL windowState="normal" portletMode="edit" secure="true" copyCurrentRenderParameters="true"
+ escapeXml="true" var="testVar"/>
+<%
+ //Put url placed as page variable
+ out.print(pageContext.getAttribute("testVar"));
+%>
+
+<test_result_separator/>
+
+<portlet:renderURL secure="false" escapeXml="false">
+ <portlet:property name="testProperty" value="testPropValue"/>
+ <portlet:property name="testProperty" value="testPropValue2"/>
+ <portlet:property name="secondProperty" value="testPropValue"/>
+
+ <portlet:param name="testParam" value="testParamValue"/>
+ <portlet:param name="testParam" value="testParamValue2"/>
+ <portlet:param name="secondParam" value="testParamValue"/>
+</portlet:renderURL>
\ No newline at end of file
Added: modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/resourceURL.jsp 2008-02-06 19:02:10 UTC (rev 9806)
@@ -0,0 +1,26 @@
+<%@ page language="java" %>
+<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
+<portlet:defineObjects/>
+
+
+<portlet:resourceURL secure="true" escapeXml="true" cacheability="FULL"/>
+
+<test_result_separator/>
+
+<portlet:resourceURL secure="true" escapeXml="true" id="testId1" var="testVar"/>
+<%
+ //Put url placed as page variable
+ out.print(pageContext.getAttribute("testVar"));
+%>
+
+<test_result_separator/>
+
+<portlet:resourceURL secure="false" escapeXml="false">
+ <portlet:property name="testProperty" value="testPropValue"/>
+ <portlet:property name="testProperty" value="testPropValue2"/>
+ <portlet:property name="secondProperty" value="testPropValue"/>
+
+ <portlet:param name="testParam" value="testParamValue"/>
+ <portlet:param name="testParam" value="testParamValue2"/>
+ <portlet:param name="secondParam" value="testParamValue"/>
+</portlet:resourceURL>
Deleted: modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/taglib.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/taglib.jsp 2008-02-06 18:49:08 UTC (rev 9805)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/tck/taglib-war/taglib.jsp 2008-02-06 19:02:10 UTC (rev 9806)
@@ -1,73 +0,0 @@
-<%@ page import="org.jboss.unit.api.Assert" %>
-<%@ page import="javax.portlet.RenderRequest" %>
-<%@ page import="javax.portlet.RenderResponse" %>
-<%@ page import="javax.portlet.ActionRequest" %>
-<%@ page import="javax.portlet.ActionResponse" %>
-<%@ page import="javax.portlet.EventRequest" %>
-<%@ page import="javax.portlet.EventResponse" %>
-<%@ page import="javax.portlet.ResourceRequest" %>
-<%@ page import="javax.portlet.ResourceResponse" %>
-<%@ page import="javax.portlet.PortletConfig" %>
-<%@ page import="javax.portlet.PortletSession" %>
-<%@ page import="java.util.Map" %>
-<%@ page import="javax.portlet.PortletPreferences" %>
-<%@ page language="java" %>
-<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
-<portlet:defineObjects/>
-<%
- out.print("jspDispatch");
-
- if (renderRequest != null && renderRequest instanceof RenderRequest)
- {
- out.print(",renderRequest");
- }
- if (renderResponse != null && renderResponse instanceof RenderResponse)
- {
- out.print(",renderResponse");
- }
- if (actionRequest != null && actionRequest instanceof ActionRequest)
- {
- out.print(",actionRequest");
- }
- if (actionResponse != null && actionResponse instanceof ActionResponse)
- {
- out.print(",actionResponse");
- }
- if (eventRequest != null && eventRequest instanceof EventRequest)
- {
- out.print(",eventRequest");
- }
- if (eventResponse != null && eventResponse instanceof EventResponse)
- {
- out.print(",eventResponse");
- }
- if (resourceRequest != null && resourceRequest instanceof ResourceRequest)
- {
- out.print(",resourceRequest");
- }
- if (resourceResponse != null && resourceResponse instanceof ResourceResponse)
- {
- out.print(",resourceResponse");
- }
- if (portletConfig != null && portletConfig instanceof PortletConfig)
- {
- out.print(",portletConfig");
- }
- if (portletSession != null && portletSession instanceof PortletSession)
- {
- out.print(",portletSession");
- }
- if (portletSessionScope != null && portletSessionScope instanceof Map)
- {
- out.print(",portletSessionScope");
- }
- if (portletPreferences != null && portletPreferences instanceof PortletPreferences)
- {
- out.print(",portletPreferences");
- }
- if (portletPreferencesValues != null && portletPreferencesValues instanceof Map)
- {
- out.print(",portletPreferencesValues");
- }
-
-%>
\ No newline at end of file
16 years, 4 months
JBoss Portal SVN: r9805 - in modules/portlet/trunk/test/src: main/java/org/jboss/portal/portlet/test/controller and 6 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-06 13:49:08 -0500 (Wed, 06 Feb 2008)
New Revision: 9805
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerServlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BytesChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/CharsChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/Chunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/PortletChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/ResponseBuffer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
Removed:
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/classes/
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/web.xml
modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp
Log:
add support for response buffering
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java 2008-02-06 16:52:29 UTC (rev 9804)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java 2008-02-06 18:49:08 UTC (rev 9805)
@@ -90,6 +90,7 @@
buffer.append(':');
buffer.append(Integer.toString(clientReq.getServerPort()));
buffer.append(clientReq.getContextPath());
+ buffer.append(clientReq.getServletPath());
buffer.append('/');
buffer.append(StringCodec.encode(windowId));
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerServlet.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerServlet.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerServlet.java 2008-02-06 18:49:08 UTC (rev 9805)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.jsp;
+
+import org.jboss.portal.portlet.test.jsp.response.ResponseBuffer;
+import org.jboss.portal.portlet.test.jsp.response.Chunk;
+import org.jboss.portal.portlet.test.jsp.response.BytesChunk;
+import org.jboss.portal.portlet.test.jsp.response.CharsChunk;
+import org.jboss.portal.portlet.test.jsp.response.PortletChunk;
+import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.RequestDispatcher;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ControllerServlet extends HttpServlet
+{
+
+
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ RequestDispatcher dispatcher = req.getRequestDispatcher("/index.jsp");
+
+ //
+ BufferingResponse bufferingResponse = new BufferingResponse(resp);
+
+ //
+ dispatcher.include(req, bufferingResponse);
+
+ //
+ ResponseBuffer buffer = bufferingResponse.getBuffer();
+ buffer.close();
+
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ for (Chunk chunk : buffer.getChunks())
+ {
+ if (chunk instanceof BytesChunk)
+ {
+ BytesChunk bytesChunk = (BytesChunk)chunk;
+ writer.write(new String(bytesChunk.getBytes()));
+ }
+ else if (chunk instanceof CharsChunk)
+ {
+ CharsChunk bytesChunk = (CharsChunk)chunk;
+ writer.write(bytesChunk.getChars());
+ }
+ else if (chunk instanceof PortletChunk)
+ {
+ PortletChunk portletChunk = (PortletChunk)chunk;
+ writer.write("Portlet[" + portletChunk.getPortletName() + "," + portletChunk.getApplicationName() + "]");
+ }
+ }
+
+ //
+ writer.close();
+ }
+}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java 2008-02-06 18:49:08 UTC (rev 9805)
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.jsp.response;
+
+import org.jboss.portal.portlet.test.jsp.response.ResponseBuffer;
+import org.jboss.portal.portlet.test.jsp.response.Chunk;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.ServletOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class BufferingResponse extends HttpServletResponseWrapper
+{
+
+ /** . */
+ private final ResponseBuffer buffer = new ResponseBuffer();
+
+ public BufferingResponse(HttpServletResponse response)
+ {
+ super(response);
+ }
+
+ public ResponseBuffer getBuffer()
+ {
+ return buffer;
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ return buffer.getOutputStream();
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ return buffer.getWriter();
+ }
+
+ public void close()
+ {
+ buffer.close();
+ }
+
+ public void addChunk(Chunk chunk)
+ {
+ buffer.addChunk(chunk);
+ }
+}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BytesChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BytesChunk.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BytesChunk.java 2008-02-06 18:49:08 UTC (rev 9805)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.jsp.response;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class BytesChunk extends Chunk
+{
+
+ /** . */
+ private final byte[] bytes;
+
+ public BytesChunk(byte[] bytes)
+ {
+ this.bytes = bytes;
+ }
+
+ public byte[] getBytes()
+ {
+ return bytes;
+ }
+}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/CharsChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/CharsChunk.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/CharsChunk.java 2008-02-06 18:49:08 UTC (rev 9805)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.jsp.response;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class CharsChunk extends Chunk
+{
+
+ /** . */
+ private final char[] chars;
+
+ public CharsChunk(char[] chars)
+ {
+ this.chars = chars;
+ }
+
+ public char[] getChars()
+ {
+ return chars;
+ }
+}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/Chunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/Chunk.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/Chunk.java 2008-02-06 18:49:08 UTC (rev 9805)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.jsp.response;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class Chunk
+{
+
+
+
+}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/PortletChunk.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/PortletChunk.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/PortletChunk.java 2008-02-06 18:49:08 UTC (rev 9805)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.jsp.response;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletChunk extends Chunk
+{
+
+ /** . */
+ private final String portletName;
+
+ /** . */
+ private final String applicationName;
+
+ public PortletChunk(String portletName, String applicationName)
+ {
+ this.portletName = portletName;
+ this.applicationName = applicationName;
+ }
+
+ public String getPortletName()
+ {
+ return portletName;
+ }
+
+ public String getApplicationName()
+ {
+ return applicationName;
+ }
+}
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/ResponseBuffer.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/ResponseBuffer.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/ResponseBuffer.java 2008-02-06 18:49:08 UTC (rev 9805)
@@ -0,0 +1,181 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.jsp.response;
+
+import javax.servlet.ServletOutputStream;
+import java.io.IOException;
+import java.io.ByteArrayOutputStream;
+import java.io.StringWriter;
+import java.io.PrintWriter;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ResponseBuffer
+{
+
+ /** . */
+ private final List<Chunk> chunks = new LinkedList<Chunk>();
+
+ /** . */
+ private ChunkOutputStream chunkOutputStream;
+
+ /** . */
+ private ChunkWriter chunkWriter;
+
+ /** . */
+ private PrintWriter writer;
+
+ public List<Chunk> getChunks()
+ {
+ return chunks;
+ }
+
+ public void close()
+ {
+ try
+ {
+ if (chunkWriter != null)
+ {
+ chunkWriter.close();
+ }
+ else if (chunkOutputStream != null)
+ {
+ chunkOutputStream.close();
+ }
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public ServletOutputStream getOutputStream()
+ {
+ if (chunkOutputStream == null)
+ {
+ if (writer != null)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ chunkOutputStream = new ChunkOutputStream();
+ }
+
+ //
+ return chunkOutputStream;
+ }
+
+ public PrintWriter getWriter()
+ {
+ if (chunkWriter == null)
+ {
+ if (chunkOutputStream != null)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ chunkWriter = new ChunkWriter();
+ writer = new PrintWriter(chunkWriter);
+ }
+
+ //
+ return writer;
+ }
+
+ public void addChunk(Chunk chunk)
+ {
+ if (chunkWriter != null)
+ {
+ chunkWriter.writeChunk();
+ }
+ else if (chunkOutputStream != null)
+ {
+ chunkOutputStream.writeChunk();
+ }
+
+ //
+ chunks.add(chunk);
+ }
+
+ private class ChunkWriter extends StringWriter
+ {
+
+ public void writeChunk()
+ {
+ StringBuffer sb = getBuffer();
+ if (sb.length() > 0)
+ {
+ char[] chars = new char[sb.length()];
+ sb.getChars(0, sb.length(), chars, 0);
+ CharsChunk chunk = new CharsChunk(chars);
+ chunks.add(chunk);
+ sb.setLength(0);
+ }
+ }
+
+ public void close() throws IOException
+ {
+ super.close();
+
+ //
+ writeChunk();
+ }
+ }
+
+ private class ChunkOutputStream extends ServletOutputStream
+ {
+
+ /** . */
+ private final ByteArrayOutputStream bytebuffer = new ByteArrayOutputStream();
+
+ public void write(int b) throws IOException
+ {
+ bytebuffer.write(b);
+ }
+
+ public void writeChunk()
+ {
+ if (bytebuffer.size() > 0)
+ {
+ byte[] bytes = bytebuffer.toByteArray();
+ bytebuffer.reset();
+ BytesChunk chunk = new BytesChunk(bytes);
+ chunks.add(chunk);
+ }
+ }
+
+ public void close() throws IOException
+ {
+ super.close();
+
+ //
+ writeChunk();
+ }
+ }
+}
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib (from rev 9804, modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/taglib)
Modified: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/taglib/PageTag.java 2008-02-06 16:52:29 UTC (rev 9804)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java 2008-02-06 18:49:08 UTC (rev 9805)
@@ -20,9 +20,8 @@
* 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.portlet.test.taglib;
+package org.jboss.portal.portlet.test.jsp.taglib;
-import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.tagext.BodyTagSupport;
import javax.servlet.jsp.JspException;
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-06 18:49:08 UTC (rev 9805)
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.jsp.taglib;
+
+import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
+import org.jboss.portal.portlet.test.jsp.response.PortletChunk;
+
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletTag extends SimpleTagSupport
+{
+
+ /** . */
+ private String name;
+
+ /** . */
+ private String applicationName;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getApplicationName()
+ {
+ return applicationName;
+ }
+
+ public void setApplicationName(String applicationName)
+ {
+ this.applicationName = applicationName;
+ }
+
+ public void doTag() throws JspException, IOException
+ {
+ PageContext pageCtx = (PageContext)getJspContext();
+ pageCtx.getOut().flush();
+ BufferingResponse response = (BufferingResponse)pageCtx.getResponse();
+ response.addChunk(new PortletChunk(name, applicationName));
+ }
+}
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-06 16:52:29 UTC (rev 9804)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-06 18:49:08 UTC (rev 9805)
@@ -15,9 +15,6 @@
<antcall target="tests.call.single"/>
<antcall target="tests.call.all"/>
- <!--Cleanup-->
- <!--<delete dir="${test.temp.dir}"/>-->
-
</target>
<target name="tests.call.all" unless="tests">
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld 2008-02-06 16:52:29 UTC (rev 9804)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld 2008-02-06 18:49:08 UTC (rev 9805)
@@ -10,8 +10,24 @@
<tag>
<name>page</name>
- <tag-class>org.jboss.portal.portlet.test.taglib.PageTag</tag-class>
+ <tag-class>org.jboss.portal.portlet.test.jsp.taglib.PageTag</tag-class>
<body-content>JSP</body-content>
</tag>
+ <tag>
+ <name>portlet</name>
+ <tag-class>org.jboss.portal.portlet.test.jsp.taglib.PortletTag</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>applicationName</name>
+ <required>true</required>
+ <type>java.lang.String</type>
+ </attribute>
+ </tag>
+
</taglib>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/web.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/web.xml 2008-02-06 16:52:29 UTC (rev 9804)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/web.xml 2008-02-06 18:49:08 UTC (rev 9805)
@@ -38,8 +38,16 @@
<servlet-name>PortalServlet</servlet-name>
<servlet-class>org.jboss.portal.simple.SimplePortalServlet</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>ControllerServlet</servlet-name>
+ <servlet-class>org.jboss.portal.portlet.test.jsp.ControllerServlet</servlet-class>
+ </servlet>
<servlet-mapping>
<servlet-name>PortalServlet</servlet-name>
- <url-pattern>/*</url-pattern>
+ <url-pattern>/</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>ControllerServlet</servlet-name>
+ <url-pattern>/jsp/*</url-pattern>
+ </servlet-mapping>
</web-app>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp 2008-02-06 16:52:29 UTC (rev 9804)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp 2008-02-06 18:49:08 UTC (rev 9805)
@@ -5,7 +5,11 @@
<html>
<body>
<portal:page>
- HELLO!!!
+ BEFORE
+ <portal:portlet
+ name="GoogleMap"
+ applicationName="google-map-portlet"/>
+ AFTER
</portal:page>
</body>
</html>
16 years, 4 months
JBoss Portal SVN: r9804 - in modules/portlet/trunk/test/src: main/java/org/jboss/portal/portlet/test/taglib and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-06 11:52:29 -0500 (Wed, 06 Feb 2008)
New Revision: 9804
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/taglib/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/taglib/PageTag.java
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld
modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp
Log:
taglib blah
Added: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/taglib/PageTag.java
===================================================================
--- modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/taglib/PageTag.java (rev 0)
+++ modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/taglib/PageTag.java 2008-02-06 16:52:29 UTC (rev 9804)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.portlet.test.taglib;
+
+import javax.servlet.jsp.tagext.TagSupport;
+import javax.servlet.jsp.tagext.BodyTagSupport;
+import javax.servlet.jsp.JspException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PageTag extends BodyTagSupport
+{
+
+ public int doStartTag() throws JspException
+ {
+ System.out.println("START");
+
+
+ return EVAL_BODY_INCLUDE;
+ }
+
+ public int doEndTag() throws JspException
+ {
+ System.out.println("END");
+
+ return EVAL_PAGE;
+ }
+}
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld 2008-02-06 16:52:29 UTC (rev 9804)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ version="2.0">
+
+ <tlib-version>1.0</tlib-version>
+ <short-name>portal</short-name>
+
+ <tag>
+ <name>page</name>
+ <tag-class>org.jboss.portal.portlet.test.taglib.PageTag</tag-class>
+ <body-content>JSP</body-content>
+ </tag>
+
+</taglib>
Added: modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp (rev 0)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp 2008-02-06 16:52:29 UTC (rev 9804)
@@ -0,0 +1,11 @@
+<%@ page language="java" %>
+<%@ taglib uri="/WEB-INF/portal.tld" prefix="portal" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+<%@ page isELIgnored="false" %>
+<html>
+<body>
+<portal:page>
+ HELLO!!!
+</portal:page>
+</body>
+</html>
16 years, 4 months
JBoss Portal SVN: r9803 - in modules/portlet/trunk: portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-06 11:10:42 -0500 (Wed, 06 Feb 2008)
New Revision: 9803
Added:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/AbstractDispatchedSessionTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ApplicationScopeDispatchedSessionTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/PortletScopeDispatchedSessionTestCase.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ContentTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/DispatchingFilterTestCase.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/FiltersTestCase.java
modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/WEB-INF/portlet.xml
Log:
implement and test javax.portlet.servletDefaultSessionScope feature
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-02-06 15:25:41 UTC (rev 9802)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-02-06 16:10:42 UTC (rev 9803)
@@ -32,7 +32,6 @@
import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.portlet.PortletSession;
@@ -42,6 +41,7 @@
import javax.portlet.ResourceRequest;
import javax.portlet.EventRequest;
import javax.portlet.RenderRequest;
+import javax.portlet.PortletConfig;
import java.security.Principal;
import java.util.Enumeration;
import java.util.Locale;
@@ -118,7 +118,7 @@
private final Map<String, String[]> parameters;
/** . */
- private final int sessionScope = PortletSession.APPLICATION_SCOPE;
+ private final int sessionScope;
/** . */
private final LinkedList<Map<String, String>> containerAttributesStack;
@@ -130,7 +130,7 @@
private final ServletContext servletContext;
/** . */
- private DispatchedHttpSession[] session;
+ private DispatchedHttpSession session;
public DispatchedHttpServletRequest(
Dispatch dispatch,
@@ -140,12 +140,22 @@
{
super(dreq);
+ PortletConfig config = (PortletConfig)dreq.getAttribute(Constants.JAVAX_PORTLET_CONFIG);
+ Map<String, String[]> options = config.getContainerRuntimeOptions();
+ String[] sessionScopeOption = options.get("javax.portlet.servletDefaultSessionScope");
+ int sessionScope = PortletSession.APPLICATION_SCOPE;
+ if (sessionScopeOption != null && sessionScopeOption.length > 0 && "PORTLET_SCOPE".equals(sessionScopeOption[0]))
+ {
+ sessionScope = PortletSession.PORTLET_SCOPE;
+ }
+
//
this.dispatchType = dispatch.getType();
this.preq = preq;
this.dreq = dreq;
this.servletContext = servletContext;
this.containerAttributesStack = new LinkedList<Map<String, String>>();
+ this.sessionScope = sessionScope;
// Push dispatch
this.infos = pushDispatch(dispatch);
@@ -473,7 +483,7 @@
public final HttpSession getSession(boolean b)
{
- return getSession(b, PortletSession.APPLICATION_SCOPE);
+ return getSession(b, sessionScope);
}
public final HttpSession getSession()
@@ -665,19 +675,14 @@
*/
private HttpSession getSession(boolean create, int scope)
{
- if (session == null)
- {
- session = new DispatchedHttpSession[2];
- }
-
// Dereference an existing session if necessary
- if (session[scope] != null && !session[scope].isValid())
+ if (session != null && !session.isValid())
{
- session[scope] = null;
+ session = null;
}
// If we have a session here we are sure it is valid and ok to return it
- if (session[scope] != null)
+ if (session != null)
{
// So we do nothing
}
@@ -685,7 +690,7 @@
{
// For sure we need a session we will obtain a valid one
PortletSession portletSession = preq.getPortletSession();
- session[scope] = new DispatchedHttpSession(this, portletSession, scope);
+ session = new DispatchedHttpSession(this, portletSession, scope);
}
else
{
@@ -695,12 +700,12 @@
//
if (portletSession != null)
{
- session[scope] = new DispatchedHttpSession(this, portletSession, scope);
+ session = new DispatchedHttpSession(this, portletSession, scope);
}
}
//
- return session[scope];
+ return session;
}
// Subclasses
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java 2008-02-06 15:25:41 UTC (rev 9802)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java 2008-02-06 16:10:42 UTC (rev 9803)
@@ -50,7 +50,10 @@
private ContainerPortletApplicationInfo info;
/** . */
- public static final Set<String> SUPPORTED_OPTIONS = Collections.unmodifiableSet(Tools.toSet("javax.portlet.actionScopedRequestAttributes","javax.portlet.escapeXml"));
+ public static final Set<String> SUPPORTED_OPTIONS = Collections.unmodifiableSet(Tools.toSet(
+ "javax.portlet.actionScopedRequestAttributes",
+ "javax.portlet.escapeXml",
+ "javax.portlet.servletDefaultSessionScope"));
public PortletContextImpl(ServletContext servletContext)
{
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/AbstractDispatchedSessionTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/AbstractDispatchedSessionTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/AbstractDispatchedSessionTestCase.java 2008-02-06 16:10:42 UTC (rev 9803)
@@ -0,0 +1,153 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.portlet.jsr286.ext.dispatcher;
+
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.PortletTestContext;
+import org.jboss.portal.unit.JoinPoint;
+import org.jboss.portal.unit.base.AbstractUniversalTestPortlet;
+import org.jboss.portal.unit.actions.ServletServiceTestAction;
+import org.jboss.portal.unit.actions.PortletRenderTestAction;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTS1;
+import org.jboss.unit.driver.DriverResponse;
+import org.jboss.unit.driver.response.EndTestResponse;
+import static org.jboss.unit.api.Assert.*;
+import org.jboss.unit.remote.driver.handler.http.response.InvokeGetResponse;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.portlet.PortletException;
+import javax.portlet.RenderResponse;
+import javax.portlet.Portlet;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.PortletSession;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class AbstractDispatchedSessionTestCase
+{
+ public AbstractDispatchedSessionTestCase(
+ PortletTestCase seq,
+ JoinPoint portletJoinPoint,
+ final int sessionScope)
+ {
+ seq.bindAction(0, portletJoinPoint, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+ dispatcher.include(request, response);
+
+ //
+ PortletSession session = request.getPortletSession(false);
+ assertNotNull(session);
+ assertTrue(session.isNew());
+ assertEquals("foo_dispatched_value", session.getAttribute("foo", sessionScope));
+
+ //
+ return new InvokeGetResponse(response.createRenderURL().toString());
+ }
+ });
+ seq.bindAction(0, UTS1.SERVICE_JOIN_POINT, new ServletServiceTestAction()
+ {
+ public DriverResponse execute(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ HttpSession session = request.getSession(false);
+ assertNull(session);
+
+ //
+ session = request.getSession();
+ assertNotNull(session);
+ assertTrue(session.isNew());
+ session.setAttribute("foo", "foo_dispatched_value");
+ assertEquals("foo_dispatched_value", session.getAttribute("foo"));
+
+ //
+ return null;
+ }
+ });
+ seq.bindAction(1, portletJoinPoint, new PortletRenderTestAction()
+ {
+ protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
+ {
+ PortletSession session = request.getPortletSession(false);
+ assertNotNull(session);
+ assertFalse(session.isNew());
+ assertEquals("foo_dispatched_value", session.getAttribute("foo", sessionScope));
+
+ //
+ PortletRequestDispatcher dispatcher = ((AbstractUniversalTestPortlet)portlet).getPortletContext().getNamedDispatcher("UniversalServletA");
+ assertNotNull(dispatcher);
+ dispatcher.include(request, response);
+
+ //
+ try
+ {
+ session.isNew();
+ fail();
+ }
+ catch (IllegalStateException ignore)
+ {
+ }
+
+ //
+ return new EndTestResponse();
+ }
+ });
+ seq.bindAction(1, UTS1.SERVICE_JOIN_POINT, new ServletServiceTestAction()
+ {
+ public DriverResponse execute(Servlet servlet, HttpServletRequest request, HttpServletResponse response, PortletTestContext context) throws ServletException, IOException
+ {
+ HttpSession session = request.getSession(false);
+ assertNotNull(session);
+ assertFalse(session.isNew());
+ assertEquals("foo_dispatched_value", session.getAttribute("foo"));
+
+ //
+ session.invalidate();
+
+ try
+ {
+ session.isNew();
+ fail();
+ }
+ catch (IllegalStateException ignore)
+ {
+ }
+
+ //
+ return null;
+ }
+ });
+ }
+}
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ApplicationScopeDispatchedSessionTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ApplicationScopeDispatchedSessionTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ApplicationScopeDispatchedSessionTestCase.java 2008-02-06 16:10:42 UTC (rev 9803)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.portlet.jsr286.ext.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.JoinPoint;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.test.portlet.framework.UTP1;
+
+import javax.portlet.PortletSession;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class ApplicationScopeDispatchedSessionTestCase extends AbstractDispatchedSessionTestCase
+{
+ public ApplicationScopeDispatchedSessionTestCase(PortletTestCase seq)
+ {
+ super(seq, UTP1.RENDER_JOIN_POINT, PortletSession.APPLICATION_SCOPE);
+ }
+}
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ContentTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ContentTestCase.java 2008-02-06 15:25:41 UTC (rev 9802)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/ContentTestCase.java 2008-02-06 16:10:42 UTC (rev 9803)
@@ -27,6 +27,7 @@
import org.jboss.portal.unit.annotations.TestCase;
import org.jboss.portal.unit.actions.PortletRenderTestAction;
import org.jboss.portal.test.portlet.framework.UTP4;
+import org.jboss.portal.test.portlet.framework.UTP1;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
import static org.jboss.unit.api.Assert.*;
@@ -49,7 +50,7 @@
{
public ContentTestCase(PortletTestCase seq)
{
- seq.bindAction(0, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
{
@@ -69,7 +70,7 @@
return new InvokeGetResponse(response.createRenderURL().toString());
}
});
- seq.bindAction(1, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ seq.bindAction(1, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
{
@@ -95,7 +96,7 @@
return new InvokeGetResponse(response.createRenderURL().toString());
}
});
- seq.bindAction(2, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ seq.bindAction(2, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
{
@@ -122,7 +123,7 @@
return new InvokeGetResponse(response.createRenderURL().toString());
}
});
- seq.bindAction(3, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ seq.bindAction(3, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
{
@@ -149,7 +150,7 @@
return new InvokeGetResponse(response.createRenderURL().toString());
}
});
- seq.bindAction(4, UTP4.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ seq.bindAction(4, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws PortletException, IOException
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/DispatchingFilterTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/DispatchingFilterTestCase.java 2008-02-06 15:25:41 UTC (rev 9802)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/DispatchingFilterTestCase.java 2008-02-06 16:10:42 UTC (rev 9803)
@@ -26,6 +26,7 @@
import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.unit.actions.PortletRenderTestAction;
import org.jboss.portal.test.portlet.framework.UTP3;
+import org.jboss.portal.test.portlet.framework.UTP1;
import org.jboss.portal.unit.annotations.TestCase;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.response.EndTestResponse;
@@ -47,7 +48,7 @@
{
public DispatchingFilterTestCase(PortletTestCase seq)
{
- seq.bindAction(0, UTP3.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
Modified: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/FiltersTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/FiltersTestCase.java 2008-02-06 15:25:41 UTC (rev 9802)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/FiltersTestCase.java 2008-02-06 16:10:42 UTC (rev 9803)
@@ -26,6 +26,7 @@
import org.jboss.portal.unit.PortletTestContext;
import org.jboss.portal.unit.actions.PortletRenderTestAction;
import org.jboss.portal.test.portlet.framework.UTP2;
+import org.jboss.portal.test.portlet.framework.UTP1;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.unit.annotations.TestCase;
import org.jboss.unit.driver.DriverResponse;
@@ -50,7 +51,7 @@
{
public FiltersTestCase(PortletTestCase seq)
{
- seq.bindAction(0, UTP2.RENDER_JOIN_POINT, new PortletRenderTestAction()
+ seq.bindAction(0, UTP1.RENDER_JOIN_POINT, new PortletRenderTestAction()
{
protected DriverResponse run(Portlet portlet, RenderRequest request, RenderResponse response, PortletTestContext context) throws IOException, PortletException
{
Added: modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/PortletScopeDispatchedSessionTestCase.java
===================================================================
--- modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/PortletScopeDispatchedSessionTestCase.java (rev 0)
+++ modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/jsr286/ext/dispatcher/PortletScopeDispatchedSessionTestCase.java 2008-02-06 16:10:42 UTC (rev 9803)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.test.portlet.jsr286.ext.dispatcher;
+
+import org.jboss.portal.unit.PortletTestCase;
+import org.jboss.portal.unit.JoinPoint;
+import org.jboss.portal.unit.annotations.TestCase;
+import org.jboss.portal.test.portlet.framework.UTP1;
+import org.jboss.portal.test.portlet.framework.UTP2;
+
+import javax.portlet.PortletSession;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+@TestCase
+public class PortletScopeDispatchedSessionTestCase extends AbstractDispatchedSessionTestCase
+{
+ public PortletScopeDispatchedSessionTestCase(PortletTestCase seq)
+ {
+ super(seq, UTP2.RENDER_JOIN_POINT, PortletSession.PORTLET_SCOPE);
+ }
+}
\ No newline at end of file
Modified: modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/WEB-INF/portlet.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/WEB-INF/portlet.xml 2008-02-06 15:25:41 UTC (rev 9802)
+++ modules/portlet/trunk/test/src/test/resources/jsr286/ext/dispatcher-war/WEB-INF/portlet.xml 2008-02-06 16:10:42 UTC (rev 9803)
@@ -22,10 +22,10 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
- version="1.0">
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
<portlet>
@@ -48,28 +48,10 @@
<portlet-info>
<title></title>
</portlet-info>
+ <container-runtime-option>
+ <name>javax.portlet.servletDefaultSessionScope</name>
+ <value>PORTLET_SCOPE</value>
+ </container-runtime-option>
</portlet>
- <portlet>
- <portlet-name>TestUniversalPortletC</portlet-name>
- <portlet-class>org.jboss.portal.test.portlet.framework.UTP3</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- </supports>
- <portlet-info>
- <title></title>
- </portlet-info>
- </portlet>
-
- <portlet>
- <portlet-name>TestUniversalPortletD</portlet-name>
- <portlet-class>org.jboss.portal.test.portlet.framework.UTP4</portlet-class>
- <supports>
- <mime-type>text/html</mime-type>
- </supports>
- <portlet-info>
- <title></title>
- </portlet-info>
- </portlet>
-
</portlet-app>
16 years, 4 months
JBoss Portal SVN: r9802 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-06 10:25:41 -0500 (Wed, 06 Feb 2008)
New Revision: 9802
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
Log:
fixed an issue I introduced yesterday
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-02-06 14:34:17 UTC (rev 9801)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-02-06 15:25:41 UTC (rev 9802)
@@ -605,8 +605,8 @@
containerCache,
containerSession,
portletMD.getPortletName(),
+ portletMD.getPortletClass(),
context.getApplicationName(),
- portletMD.getPortletClass(),
Collections.unmodifiableMap(initParameters),
false,
context.getBundleManager(portletMD)
16 years, 4 months
JBoss Portal SVN: r9801 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-06 09:34:17 -0500 (Wed, 06 Feb 2008)
New Revision: 9801
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
Log:
update server info in PortletContext
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java 2008-02-06 14:33:26 UTC (rev 9800)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java 2008-02-06 14:34:17 UTC (rev 9801)
@@ -59,7 +59,7 @@
public String getServerInfo()
{
- return "JBossPortal/" + 1 + "." + 0;
+ return "JBossPortletContainer/" + 2 + "." + 0;
}
public PortletRequestDispatcher getRequestDispatcher(String path)
16 years, 4 months
JBoss Portal SVN: r9800 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-06 09:33:26 -0500 (Wed, 06 Feb 2008)
New Revision: 9800
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
Log:
implement PortletContext container runtime options support
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java 2008-02-06 14:28:44 UTC (rev 9799)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletConfigImpl.java 2008-02-06 14:33:26 UTC (rev 9800)
@@ -85,16 +85,27 @@
}
//
- Map<String, String[]> containerRuntimeOptions;
- if (portletInfo.getOptions().size() > 0)
+ ParameterMap tmp = null;
+ for (ContainerOptionInfo option : portletInfo.getOptions().values())
{
- ParameterMap tmp = new ParameterMap(ParameterMap.AccessMode.get(true, false));
- for (ContainerOptionInfo option : portletInfo.getOptions().values())
+ String name = option.getName();
+ if (PortletContextImpl.SUPPORTED_OPTIONS.contains(name))
{
- String name = option.getName();
+ if (tmp == null)
+ {
+ tmp = new ParameterMap(ParameterMap.AccessMode.get(true, false));
+ }
+
+ //
String[] values = option.getValues().toArray(new String[option.getValues().size()]);
tmp.setValues(name, values);
}
+ }
+
+ //
+ Map<String, String[]> containerRuntimeOptions;
+ if (tmp != null)
+ {
containerRuntimeOptions = Collections.unmodifiableMap(tmp);
}
else
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java 2008-02-06 14:28:44 UTC (rev 9799)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java 2008-02-06 14:33:26 UTC (rev 9800)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.api;
-import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
@@ -51,7 +50,7 @@
private ContainerPortletApplicationInfo info;
/** . */
- private final Set<String> supportedOptions = Tools.toSet("javax.portlet.actionScopedRequestAttributes","javax.portlet.escapeXml");
+ public static final Set<String> SUPPORTED_OPTIONS = Collections.unmodifiableSet(Tools.toSet("javax.portlet.actionScopedRequestAttributes","javax.portlet.escapeXml"));
public PortletContextImpl(ServletContext servletContext)
{
@@ -195,6 +194,6 @@
public Enumeration<String> getContainerRuntimeOptions()
{
- return Collections.enumeration(supportedOptions);
+ return Collections.enumeration(SUPPORTED_OPTIONS);
}
}
16 years, 4 months
JBoss Portal SVN: r9799 - modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-02-06 09:28:44 -0500 (Wed, 06 Feb 2008)
New Revision: 9799
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
Log:
implement PortletContext container runtime options support
Modified: modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java 2008-02-06 14:10:01 UTC (rev 9798)
+++ modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletContextImpl.java 2008-02-06 14:28:44 UTC (rev 9799)
@@ -23,6 +23,7 @@
package org.jboss.portal.portlet.impl.jsr168.api;
import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.impl.info.ContainerPortletApplicationInfo;
import javax.portlet.PortletContext;
@@ -34,6 +35,7 @@
import java.net.URL;
import java.util.Enumeration;
import java.util.Set;
+import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -48,6 +50,9 @@
/** . */
private ContainerPortletApplicationInfo info;
+ /** . */
+ private final Set<String> supportedOptions = Tools.toSet("javax.portlet.actionScopedRequestAttributes","javax.portlet.escapeXml");
+
public PortletContextImpl(ServletContext servletContext)
{
this.servletContext = servletContext;
@@ -190,6 +195,6 @@
public Enumeration<String> getContainerRuntimeOptions()
{
- throw new NotYetImplemented();
+ return Collections.enumeration(supportedOptions);
}
}
16 years, 4 months