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 2006/12/06 04:22:45 UTC
svn commit: r482873 - in /portals/pluto/trunk: pluto-portal-driver-impl/
pluto-taglib/src/main/java/org/apache/pluto/tags/
Author: ddewolf
Date: Tue Dec 5 19:22:41 2006
New Revision: 482873
URL: http://svn.apache.org/viewvc?view=rev&rev=482873
Log:
PLUTO-258 urls now support cusotm modes and states
Modified:
portals/pluto/trunk/pluto-portal-driver-impl/pluto-portal-driver-impl.iml
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/RenderURLTag.java
Modified: portals/pluto/trunk/pluto-portal-driver-impl/pluto-portal-driver-impl.iml
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-portal-driver-impl/pluto-portal-driver-impl.iml?view=diff&rev=482873&r1=482872&r2=482873
==============================================================================
--- portals/pluto/trunk/pluto-portal-driver-impl/pluto-portal-driver-impl.iml (original)
+++ portals/pluto/trunk/pluto-portal-driver-impl/pluto-portal-driver-impl.iml Tue Dec 5 19:22:41 2006
@@ -208,16 +208,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar:///Users/ddewolf/.m2/repository/junit/junit/4.0/junit-4.0.jar!/" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- </library>
- </orderEntry>
- <orderEntry type="module-library">
- <library>
- <CLASSES>
- <root url="jar:///Users/ddewolf/.m2/repository/org/easymock/easymock/2.2/easymock-2.2.jar!/" />
+ <root url="jar:///Users/ddewolf/.m2/repository/junit/junit/3.8/junit-3.8.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
Modified: portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java?view=diff&rev=482873&r1=482872&r2=482873
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java (original)
+++ portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java Tue Dec 5 19:22:41 2006
@@ -25,14 +25,8 @@
*/
package org.apache.pluto.tags;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletModeException;
-import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
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
@@ -41,45 +35,11 @@
*/
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);
- }
+ protected PortletURL createPortletURL() {
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;
+ return renderResponse.createActionURL();
}
+
}
Modified: portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/BasicURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/BasicURLTag.java?view=diff&rev=482873&r1=482872&r2=482873
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/BasicURLTag.java (original)
+++ portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/BasicURLTag.java Tue Dec 5 19:22:41 2006
@@ -15,13 +15,12 @@
*/
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.PortletModeException;
+import javax.portlet.PortletSecurityException;
import javax.portlet.PortletURL;
import javax.portlet.WindowState;
+import javax.portlet.WindowStateException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
@@ -29,6 +28,9 @@
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.tagext.VariableInfo;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.Hashtable;
/**
* Supporting class for the <CODE>actionURL</CODE> and <CODE>renderURL</CODE>
@@ -44,6 +46,7 @@
/**
* Provides a list of all static PortletMode available in the
* specifications by using introspection
+ *
* @return Hashtable
*/
private static Hashtable getDefinedPortletModes() {
@@ -68,6 +71,7 @@
/**
* Provides a list of all static WindowsStates available in the
* specifications by using introspection
+ *
* @return Hashtable
*/
private static Hashtable getDefinedWindowStates() {
@@ -95,8 +99,8 @@
if (var != null) {
vi = new VariableInfo[1];
vi[0] =
- new VariableInfo(var, "java.lang.String", true,
- VariableInfo.AT_BEGIN);
+ new VariableInfo(var, "java.lang.String", true,
+ VariableInfo.AT_BEGIN);
}
return vi;
}
@@ -112,9 +116,56 @@
/**
* Processes the <CODE>actionURL</CODE> or <CODE>renderURL</CODE> tag.
+ *
* @return int
*/
- public abstract int doStartTag() throws JspException;
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.Tag#doStartTag()
+ */
+ public int doStartTag() throws JspException {
+ if (var != null) {
+ pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
+ }
+
+ url = createPortletURL();
+
+ if (portletMode != null) {
+ try {
+ PortletMode mode = (PortletMode)
+ TEI.portletModes.get(portletMode.toUpperCase());
+ if (mode == null) {
+ mode = new PortletMode(portletMode);
+ }
+ url.setPortletMode(mode);
+ } catch (PortletModeException e) {
+ throw new JspException(e);
+ }
+ }
+ if (windowState != null) {
+ try {
+ WindowState state = (WindowState)
+ TEI.definedWindowStates.get(windowState.toUpperCase());
+ if (state == null) {
+ state = new WindowState(windowState);
+ }
+ url.setWindowState(state);
+ } catch (WindowStateException e) {
+ throw new JspException(e);
+ }
+ }
+ if (secure != null) {
+ try {
+ url.setSecure(getSecureBoolean());
+ } catch (PortletSecurityException e) {
+ throw new JspException(e);
+ }
+ }
+
+ return EVAL_PAGE;
+ }
+
+ protected abstract PortletURL createPortletURL();
/**
* @return int
@@ -130,13 +181,14 @@
}
} else {
pageContext.setAttribute(var, url.toString(),
- PageContext.PAGE_SCOPE);
+ PageContext.PAGE_SCOPE);
}
return EVAL_PAGE;
}
/**
* Returns the portletMode.
+ *
* @return String
*/
public String getPortletMode() {
@@ -159,6 +211,7 @@
/**
* Returns the windowState.
+ *
* @return String
*/
public String getWindowState() {
@@ -174,6 +227,7 @@
/**
* Returns the var.
+ *
* @return String
*/
public String getVar() {
@@ -182,6 +236,7 @@
/**
* Sets the portletMode.
+ *
* @param portletMode The portletMode to set
*/
public void setPortletMode(String portletMode) {
@@ -190,6 +245,7 @@
/**
* Sets secure to boolean value of the string
+ *
* @param secure
*/
public void setSecure(String secure) {
@@ -199,6 +255,7 @@
/**
* Sets the windowState.
+ *
* @param windowState The windowState to set
*/
public void setWindowState(String windowState) {
@@ -206,15 +263,8 @@
}
/**
- * 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) {
Modified: portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java?view=diff&rev=482873&r1=482872&r2=482873
==============================================================================
--- portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java (original)
+++ portals/pluto/trunk/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java Tue Dec 5 19:22:41 2006
@@ -21,6 +21,7 @@
import javax.portlet.RenderResponse;
import javax.portlet.WindowState;
import javax.portlet.WindowStateException;
+import javax.portlet.PortletURL;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
@@ -32,45 +33,10 @@
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);
- }
+ protected PortletURL createPortletURL() {
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;
+ return renderResponse.createRenderURL();
}
}