You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by dd...@apache.org on 2005/11/04 21:11:16 UTC
svn commit: r330876 - in /portals/pluto/trunk: ./
maven-pluto-plugin/src/main/java/org/apache/pluto/maven/
pluto-container/src/main/java/org/apache/pluto/tags/
pluto-container/src/resources/tld/ pluto-site/src/site/apt/ pluto-taglib/
pluto-taglib/src/ ...
Author: ddewolf
Date: Fri Nov 4 12:11:05 2005
New Revision: 330876
URL: http://svn.apache.org/viewcvs?rev=330876&view=rev
Log:
Creating TagLib Subproject; Getting Ready to Support EL; Small Documentation tweeks
Added:
portals/pluto/trunk/pluto-taglib/
portals/pluto/trunk/pluto-taglib/pom.xml
portals/pluto/trunk/pluto-taglib/src/
portals/pluto/trunk/pluto-taglib/src/main/
portals/pluto/trunk/pluto-taglib/src/main/java/
portals/pluto/trunk/pluto-taglib/src/main/java/org/
portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/
portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/
portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/
portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java
portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/BasicURLTag.java
portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/Constants.java
portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java
portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java
portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java
portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java
portals/pluto/trunk/pluto-taglib/src/resources/
portals/pluto/trunk/pluto-taglib/src/resources/tld/
portals/pluto/trunk/pluto-taglib/src/resources/tld/portlet.tld
Removed:
portals/pluto/trunk/pluto-container/src/main/java/org/apache/pluto/tags/
portals/pluto/trunk/pluto-container/src/resources/tld/
Modified:
portals/pluto/trunk/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractInstallationMojo.java
portals/pluto/trunk/pluto-site/src/site/apt/resources.apt
portals/pluto/trunk/pluto-util/pom.xml
portals/pluto/trunk/pom.xml
Modified: portals/pluto/trunk/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractInstallationMojo.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractInstallationMojo.java?rev=330876&r1=330875&r2=330876&view=diff
==============================================================================
--- portals/pluto/trunk/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractInstallationMojo.java (original)
+++ portals/pluto/trunk/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/AbstractInstallationMojo.java Fri Nov 4 12:11:05 2005
@@ -61,10 +61,11 @@
protected List getSharedDependencies() {
List list = new ArrayList();
- list.add("pluto-container");
+ list.add("portlet-api");
list.add("pluto-descriptor-api");
list.add("pluto-descriptor-impl");
- list.add("portlet-api");
+ list.add("pluto-container");
+ list.add("pluto-taglib");
list.add("castor");
return list;
}
Modified: portals/pluto/trunk/pluto-site/src/site/apt/resources.apt
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-site/src/site/apt/resources.apt?rev=330876&r1=330875&r2=330876&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-site/src/site/apt/resources.apt (original)
+++ portals/pluto/trunk/pluto-site/src/site/apt/resources.apt Fri Nov 4 12:11:05 2005
@@ -6,6 +6,7 @@
24 Sept 2005
------
+
The Java Portlet Specification
* {{{http://jcp.org/en/jsr/detail?id=168}JSR-168 Portlet Specification Home Page}}
@@ -14,7 +15,11 @@
* Date
-Articles, Whitepapers, and Other Helpful Information
+Additional Pluto Documentation
+
+ * {{{http://wiki.apache.org/portals/Pluto}Official Pluto Wiki}}
+
+Articles, Whitepapers, and Presentations
* {{{http://www.developer.com/java/web/article.php/3547186}Introduction to the Portlet Specification}}
Added: portals/pluto/trunk/pluto-taglib/pom.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-taglib/pom.xml?rev=330876&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-taglib/pom.xml (added)
+++ portals/pluto/trunk/pluto-taglib/pom.xml Fri Nov 4 12:11:05 2005
@@ -0,0 +1,49 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>pluto-taglib</artifactId>
+ <packaging>jar</packaging>
+ <name>Pluto Portlet Tag Library</name>
+ <description>
+ Pluto's Java Portlet Specification Tag Library implementation
+ </description>
+ <parent>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>pluto</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>portlet-api</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>servletapi</groupId>
+ <artifactId>servletapi</artifactId>
+ <version>2.3</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <resources>
+ <resource>
+ <targetPath>META-INF</targetPath>
+ <directory>src/resources/tld</directory>
+ <includes name="**/*.tld"/>
+ </resource>
+ </resources>
+ <plugins>
+
+ <!-- Assembly Plugin - Create Distributions -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptor>src/assemble/bin.xml</descriptor>
+ <finalName>pluto-taglib-${pom.currentVersion}</finalName>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java?rev=330876&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java (added)
+++ portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java Fri Nov 4 12:11:05 2005
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+
+ */
+
+/*
+ * Created on Feb 21, 2003
+ *
+ * To change this generated comment go to
+ * Window>Preferences>Java>Code Generation>Code Template
+ */
+package org.apache.pluto.tags;
+
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+import javax.portlet.WindowStateException;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+
+/**
+ * Supporting class for the <CODE>actionURL</CODE> tag. Creates a url that
+ * points to the current Portlet and triggers an action request with the
+ * supplied parameters.
+ */
+public class ActionURLTag extends BasicURLTag {
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.Tag#doStartTag()
+ */
+ public int doStartTag() throws JspException {
+ if (var != null) {
+ pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
+ }
+ RenderResponse renderResponse = (RenderResponse) pageContext.getRequest()
+ .getAttribute("javax.portlet.response");
+
+ if (renderResponse != null) {
+ setUrl(renderResponse.createActionURL());
+ if (portletMode != null) {
+ try {
+ url.setPortletMode(
+ (PortletMode) TEI.portletModes.get(
+ portletMode.toUpperCase()));
+ } catch (PortletModeException e) {
+ throw new JspException(e);
+ }
+ }
+ if (windowState != null) {
+ try {
+ url.setWindowState(
+ (WindowState) TEI.definedWindowStates.get(
+ windowState.toUpperCase()));
+ } catch (WindowStateException e) {
+ throw new JspException(e);
+ }
+ }
+ if (secure != null) {
+ try {
+ url.setSecure(getSecureBoolean());
+ } catch (PortletSecurityException e) {
+ throw new JspException(e);
+ }
+ }
+ }
+ return EVAL_PAGE;
+ }
+}
+
Added: portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/BasicURLTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/BasicURLTag.java?rev=330876&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/BasicURLTag.java (added)
+++ portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/BasicURLTag.java Fri Nov 4 12:11:05 2005
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+
+ */
+
+package org.apache.pluto.tags;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+
+import javax.portlet.PortletMode;
+import javax.portlet.PortletURL;
+import javax.portlet.WindowState;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.TagData;
+import javax.servlet.jsp.tagext.TagExtraInfo;
+import javax.servlet.jsp.tagext.TagSupport;
+import javax.servlet.jsp.tagext.VariableInfo;
+
+/**
+ * Supporting class for the <CODE>actionURL</CODE> and <CODE>renderURL</CODE>
+ * tag. Creates a url that points to the current Portlet and triggers an action
+ * request with the supplied parameters.
+ */
+public abstract class BasicURLTag extends TagSupport {
+
+ public static class TEI extends TagExtraInfo {
+ public final static Hashtable definedWindowStates = getDefinedWindowStates();
+ public final static Hashtable portletModes = getDefinedPortletModes();
+
+ /**
+ * Provides a list of all static PortletMode available in the
+ * specifications by using introspection
+ * @return Hashtable
+ */
+ private static Hashtable getDefinedPortletModes() {
+ Hashtable portletModes = new Hashtable();
+ Field[] f = PortletMode.class.getDeclaredFields();
+
+ for (int i = 0; i < f.length; i++) {
+ if (f[i].getType().isAssignableFrom(
+ javax.portlet.PortletMode.class)) {
+ try {
+ portletModes.put(
+ f[i].get(f[i]).toString().toUpperCase(),
+ f[i].get(f[i]));
+ } catch (IllegalAccessException e) {
+ }
+ }
+ }
+
+ return portletModes;
+ }
+
+ /**
+ * Provides a list of all static WindowsStates available in the
+ * specifications by using introspection
+ * @return Hashtable
+ */
+ private static Hashtable getDefinedWindowStates() {
+ Hashtable definedWindowStates = new Hashtable();
+ Field[] f = WindowState.class.getDeclaredFields();
+
+ for (int i = 0; i < f.length; i++) {
+ if (f[i].getType().isAssignableFrom(
+ javax.portlet.WindowState.class)) {
+ try {
+ definedWindowStates.put(
+ f[i].get(f[i]).toString().toUpperCase(),
+ f[i].get(f[i]));
+ } catch (IllegalAccessException e) {
+
+ }
+ }
+ }
+ return definedWindowStates;
+ }
+
+ public VariableInfo[] getVariableInfo(TagData tagData) {
+ VariableInfo vi[] = null;
+ String var = tagData.getAttributeString("var");
+ if (var != null) {
+ vi = new VariableInfo[1];
+ vi[0] =
+ new VariableInfo(var, "java.lang.String", true,
+ VariableInfo.AT_BEGIN);
+ }
+ return vi;
+ }
+
+ }
+
+ protected String portletMode;
+ protected String secure;
+ protected Boolean secureBoolean;
+ protected String windowState;
+ protected PortletURL url;
+ protected String var;
+
+ /**
+ * Processes the <CODE>actionURL</CODE> or <CODE>renderURL</CODE> tag.
+ * @return int
+ */
+ public abstract int doStartTag() throws JspException;
+
+ /**
+ * @return int
+ */
+ public int doEndTag() throws JspException {
+ if (var == null) {
+ try {
+ JspWriter writer = pageContext.getOut();
+ writer.print(url);
+ writer.flush();
+ } catch (IOException ioe) {
+ throw new JspException(
+ "actionURL/renderURL Tag Exception: cannot write to the output writer.");
+ }
+ } else {
+ pageContext.setAttribute(var, url.toString(),
+ PageContext.PAGE_SCOPE);
+ }
+ return EVAL_PAGE;
+ }
+
+ /**
+ * Returns the portletMode.
+ * @return String
+ */
+ public String getPortletMode() {
+ return portletMode;
+ }
+
+ /**
+ * @return secure as String
+ */
+ public String getSecure() {
+ return secure;
+ }
+
+ /**
+ * @return secure as Boolean
+ */
+ public boolean getSecureBoolean() {
+ return this.secureBoolean.booleanValue();
+ }
+
+ /**
+ * Returns the windowState.
+ * @return String
+ */
+ public String getWindowState() {
+ return windowState;
+ }
+
+ /**
+ * @return PortletURL
+ */
+ public PortletURL getUrl() {
+ return url;
+ }
+
+ /**
+ * Returns the var.
+ * @return String
+ */
+ public String getVar() {
+ return var;
+ }
+
+ /**
+ * Sets the portletMode.
+ * @param portletMode The portletMode to set
+ */
+ public void setPortletMode(String portletMode) {
+ this.portletMode = portletMode;
+ }
+
+ /**
+ * Sets secure to boolean value of the string
+ * @param secure
+ */
+ public void setSecure(String secure) {
+ this.secure = secure;
+ this.secureBoolean = new Boolean(secure);
+ }
+
+ /**
+ * Sets the windowState.
+ * @param windowState The windowState to set
+ */
+ public void setWindowState(String windowState) {
+ this.windowState = windowState;
+ }
+
+ /**
+ * Sets the url.
+ * @param url The url to set
+ */
+ public void setUrl(PortletURL url) {
+ this.url = url;
+ }
+
+ /**
+ * Sets the var.
+ * @param var The var to set
+ */
+ public void setVar(String var) {
+ this.var = var;
+ }
+}
Added: portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/Constants.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/Constants.java?rev=330876&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/Constants.java (added)
+++ portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/Constants.java Fri Nov 4 12:11:05 2005
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.pluto.tags;
+
+/**
+ * Constant values as defined by the specification
+ * typically to a request.
+ * @version 1.0
+ */
+public class Constants {
+
+ /**
+ * The key used to bind the <code>PortletRequest</code> to the underlying
+ * <code>HttpServletRequest</code>.
+ */
+ public final static String PORTLET_REQUEST = "javax.portlet.request";
+
+ /**
+ * The key used to bind the <code>PortletResponse</code> to the underlying
+ * <code>HttpServletRequest</code>.
+ */
+ public final static String PORTLET_RESPONSE = "javax.portlet.response";
+
+ /**
+ * The key used to bind the <code>PortletConfig</code> to the underlying
+ * PortletConfig.
+ */
+ public final static String PORTLET_CONFIG = "javax.portlet.config";
+
+}
Added: portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java?rev=330876&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java (added)
+++ portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java Fri Nov 4 12:11:05 2005
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+
+ */
+
+package org.apache.pluto.tags;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletRequest;
+import javax.portlet.RenderResponse;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.TagData;
+import javax.servlet.jsp.tagext.TagExtraInfo;
+import javax.servlet.jsp.tagext.TagSupport;
+import javax.servlet.jsp.tagext.VariableInfo;
+
+/**
+ * Supporting class for the <CODE>defineObjects</CODE> tag. Creates the
+ * following variables to be used in the JSP: <UL> <LI><CODE>renderRequest</CODE>
+ * <LI><CODE>renderResponse</CODE> <LI><CODE>portletConfig</CODE> </UL>
+ * @see javax.portlet.PortletRequest
+ * @see javax.portlet.RenderResponse
+ * @see javax.portlet.PortletConfig
+ */
+public class DefineObjectsTag extends TagSupport {
+
+ /**
+ * Processes the <CODE>defineObjects</CODE> tag.
+ * @return <CODE>SKIP_BODY</CODE>
+ */
+ public int doStartTag() throws JspException {
+ PortletRequest renderRequest = (PortletRequest) pageContext.getRequest()
+ .getAttribute(Constants.PORTLET_REQUEST);
+ RenderResponse renderResponse = (RenderResponse) pageContext.getRequest()
+ .getAttribute(Constants.PORTLET_RESPONSE);
+ PortletConfig portletConfig = (PortletConfig) pageContext.getRequest()
+ .getAttribute(Constants.PORTLET_CONFIG);
+
+ if (pageContext.getAttribute("renderRequest") == null) //Set attributes only once
+ {
+ pageContext.setAttribute("renderRequest",
+ renderRequest,
+ PageContext.PAGE_SCOPE);
+ }
+
+ if (pageContext.getAttribute("renderResponse") == null) {
+ pageContext.setAttribute("renderResponse",
+ renderResponse,
+ PageContext.PAGE_SCOPE);
+ }
+
+ if (pageContext.getAttribute("portletConfig") == null) {
+ pageContext.setAttribute("portletConfig",
+ portletConfig,
+ PageContext.PAGE_SCOPE);
+ }
+
+ return SKIP_BODY;
+ }
+
+ public static class TEI extends TagExtraInfo {
+
+ public VariableInfo[] getVariableInfo(TagData tagData) {
+ VariableInfo[] info = new VariableInfo[]{
+ new VariableInfo("renderRequest",
+ "javax.portlet.PortletRequest",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("renderResponse",
+ "javax.portlet.RenderResponse",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletConfig",
+ "javax.portlet.PortletConfig",
+ true,
+ VariableInfo.AT_BEGIN)
+ };
+
+ return info;
+ }
+ }
+}
Added: portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java?rev=330876&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java (added)
+++ portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java Fri Nov 4 12:11:05 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+
+ */
+
+package org.apache.pluto.tags;
+
+import javax.portlet.RenderResponse;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.TagSupport;
+import java.io.IOException;
+
+/**
+ * This tag produces a unique value for the current portlet.
+ * <p/>
+ * <p/>
+ * Supporting class for the <CODE>namespace</CODE> tag. writes a unique value
+ * for the current portlet <BR>This tag has no attributes
+ */
+public class NamespaceTag extends TagSupport {
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.Tag#doStartTag()
+ */
+ public int doStartTag() throws JspException {
+ RenderResponse renderResponse = (RenderResponse) pageContext.getRequest()
+ .getAttribute("javax.portlet.response");
+ String namespace = renderResponse.getNamespace();
+ JspWriter writer = pageContext.getOut();
+ try {
+ writer.print(namespace);
+ } catch (IOException ioe) {
+ throw new JspException(
+ "Unable to write namespace", ioe
+ );
+ }
+ return SKIP_BODY;
+ }
+}
Added: portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java?rev=330876&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java (added)
+++ portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java Fri Nov 4 12:11:05 2005
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+
+ */
+
+package org.apache.pluto.tags;
+
+import javax.portlet.PortletURL;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.TagSupport;
+
+
+/**
+ * Supporting class for the <CODE>param</CODE> tag. Defines a parameter that
+ * can be added to a <CODE>actionURL</CODE> or a <CODE>renderURL</CODE>
+ * <BR>The following attributes are mandatory:
+ * <UL><LI><CODE>name</CODE>
+ * <LI><CODE>value</CODE></UL>
+ */
+public class ParamTag extends TagSupport {
+
+ private String name;
+ private String value;
+
+ /**
+ * Processes the <CODE>param</CODE> tag.
+ * @return <CODE>SKIP_BODY</CODE>
+ */
+ public int doStartTag() throws JspException {
+ BasicURLTag urlTag = (BasicURLTag) findAncestorWithClass(this,
+ BasicURLTag.class);
+ if (urlTag == null) {
+ throw new JspException(
+ "the 'param' Tag must have actionURL or renderURL as a parent");
+ }
+ PortletURL url = urlTag.getUrl();
+
+ if (getName() != null) {
+ url.setParameter(getName(), getValue());
+ }
+
+ return SKIP_BODY;
+ }
+
+ /**
+ * Returns the name.
+ * @return String
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the value.
+ * @return String
+ */
+ public String getValue() {
+ if (value == null) {
+ value = "";
+ }
+ return value;
+ }
+
+ /**
+ * Sets the name.
+ * @param name The name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the value.
+ * @param value The value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
Added: portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java?rev=330876&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java (added)
+++ portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java Fri Nov 4 12:11:05 2005
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+
+ */
+
+/*
+ * Created on Feb 21, 2003
+ *
+ * To change this generated comment go to
+ * Window>Preferences>Java>Code Generation>Code Template
+ */
+package org.apache.pluto.tags;
+
+import javax.portlet.PortletMode;
+import javax.portlet.PortletModeException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+import javax.portlet.WindowStateException;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+
+/**
+ * Supporting class for the <CODE>renderURL</CODE> tag. Creates a url that
+ * points to the current Portlet and triggers an render request * with the
+ * supplied parameters. *
+ */
+public class RenderURLTag extends BasicURLTag {
+
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.Tag#doStartTag()
+ */
+ public int doStartTag() throws JspException {
+ if (var != null) {
+ pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
+ }
+ RenderResponse renderResponse = (RenderResponse) pageContext.getRequest()
+ .getAttribute("javax.portlet.response");
+
+ if (renderResponse != null) {
+ setUrl(renderResponse.createRenderURL());
+ if (portletMode != null) {
+ try {
+ url.setPortletMode(
+ (PortletMode) TEI.portletModes.get(
+ portletMode.toUpperCase()));
+ } catch (PortletModeException e) {
+ throw new JspException(e);
+ }
+ }
+ if (windowState != null) {
+ try {
+ url.setWindowState(
+ (WindowState) TEI.definedWindowStates.get(
+ windowState.toUpperCase()));
+ } catch (WindowStateException e) {
+ throw new JspException(e);
+ }
+ }
+ if (secure != null) {
+ try {
+ url.setSecure(getSecureBoolean());
+ } catch (PortletSecurityException e) {
+ throw new JspException(e);
+ }
+ }
+ }
+ return EVAL_PAGE;
+ }
+}
+
Added: portals/pluto/trunk/pluto-taglib/src/resources/tld/portlet.tld
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-taglib/src/resources/tld/portlet.tld?rev=330876&view=auto
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/resources/tld/portlet.tld (added)
+++ portals/pluto/trunk/pluto-taglib/src/resources/tld/portlet.tld Fri Nov 4 12:11:05 2005
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
+ "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
+<!--
+Copyright 2004 The Apache Software Foundation
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied.
+
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<taglib>
+ <tlibversion>1.0</tlibversion>
+ <jspversion>1.1</jspversion>
+ <shortname>portlet</shortname>
+ <uri>http://java.sun.com/portlet</uri>
+ <tag>
+ <name>defineObjects</name>
+ <tagclass>org.apache.pluto.tags.DefineObjectsTag</tagclass>
+ <teiclass>org.apache.pluto.tags.DefineObjectsTag$TEI</teiclass>
+ <bodycontent>empty</bodycontent>
+ </tag>
+ <tag>
+ <name>param</name>
+ <tagclass>org.apache.pluto.tags.ParamTag</tagclass>
+ <bodycontent>empty</bodycontent>
+ <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>actionURL</name>
+ <tagclass>org.apache.pluto.tags.ActionURLTag</tagclass>
+ <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
+ <bodycontent>JSP</bodycontent>
+ <attribute>
+ <name>windowState</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>portletMode</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>secure</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+ <tag>
+ <name>renderURL</name>
+ <tagclass>org.apache.pluto.tags.RenderURLTag</tagclass>
+ <teiclass>org.apache.pluto.tags.BasicURLTag$TEI</teiclass>
+ <bodycontent>JSP</bodycontent>
+ <attribute>
+ <name>windowState</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>portletMode</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>secure</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <required>false</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+ <tag>
+ <name>namespace</name>
+ <tagclass>org.apache.pluto.tags.NamespaceTag</tagclass>
+ <bodycontent>empty</bodycontent>
+ </tag>
+</taglib>
\ No newline at end of file
Modified: portals/pluto/trunk/pluto-util/pom.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pluto-util/pom.xml?rev=330876&r1=330875&r2=330876&view=diff
==============================================================================
--- portals/pluto/trunk/pluto-util/pom.xml (original)
+++ portals/pluto/trunk/pluto-util/pom.xml Fri Nov 4 12:11:05 2005
@@ -40,6 +40,12 @@
<scope>compile</scope>
</dependency>
<dependency>
+ <groupId>org.apache.pluto</groupId>
+ <artifactId>pluto-taglib</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
<groupId>castor</groupId>
<artifactId>castor</artifactId>
<version>0.9.6</version>
Modified: portals/pluto/trunk/pom.xml
URL: http://svn.apache.org/viewcvs/portals/pluto/trunk/pom.xml?rev=330876&r1=330875&r2=330876&view=diff
==============================================================================
--- portals/pluto/trunk/pom.xml (original)
+++ portals/pluto/trunk/pom.xml Fri Nov 4 12:11:05 2005
@@ -184,6 +184,7 @@
<module>pluto-descriptor-impl</module>
<module>pluto-deploy</module>
<module>pluto-container</module>
+ <module>pluto-taglib</module>
<module>pluto-util</module>
<module>pluto-portal-driver</module>
<module>pluto-portal</module>