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 cd...@apache.org on 2007/09/20 14:05:59 UTC
svn commit: r577707 - in
/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags:
./ el/
Author: cdoremus
Date: Thu Sep 20 05:05:58 2007
New Revision: 577707
URL: http://svn.apache.org/viewvc?rev=577707&view=rev
Log:
Applied taglib_091407.patch from PLUTO-433. DefineObjects was manually merged due to changes brought in from previous trunk merge. Thanks, Torsten.
Modified:
portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java
portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java?rev=577707&r1=577706&r2=577707&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ActionURLTag.java Thu Sep 20 05:05:58 2007
@@ -35,16 +35,18 @@
* points to the current Portlet and triggers an action request with the
* supplied parameters.
*
- * @author <a href="mailto:olisp_jena@yahoo.de">Oliver Spindler</a> (since Nov 01, 2006)
* @version 2.0
*/
public class ActionURLTag extends PortletURLTag {
+
+ private static final long serialVersionUID = 286L;
/**
- * Creates an actionURL
+ * Creates an action PortletURL
* @param portletResponse PortletResponse
* @return PortletURL
*/
+ @Override
protected PortletURL createPortletUrl(PortletResponse portletResponse)
{
return portletResponse.createActionURL();
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java?rev=577707&r1=577706&r2=577707&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/BaseURLTag.java Thu Sep 20 05:05:58 2007
@@ -16,7 +16,11 @@
*/
package org.apache.pluto.tags;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
@@ -30,7 +34,6 @@
/**
* Abstract supporting class for actionURL tag, renderURL tag and resourceURL tag.
*
- * @author <a href="mailto:olisp_jena@yahoo.de">Oliver Spindler</a> (since Nov 01, 2006)
* @version 2.0
*
*/
@@ -48,7 +51,7 @@
if (var != null) {
vi = new VariableInfo[1];
vi[0] =
- new VariableInfo(var, "java.lang.String", true,
+ new VariableInfo(var, "java.lang.String", true,
VariableInfo.AT_BEGIN);
}
return vi;
@@ -56,41 +59,43 @@
}
- protected String secure;
+ //--------------------------------------------------------------------------
+
+ protected String secure = null;
protected Boolean secureBoolean;
- protected String var;
+ protected String var = null;
//TODO: not the default value (should be true)
- protected Boolean escapeXml=false;
+ protected Boolean escapeXml = false;
- protected Map<String,List<String>> parameters=new HashMap<String,List<String>> ();
+ protected Map<String,List<String>> parametersMap = new HashMap<String,List<String>> ();
+ protected Map<String, List<String>> propertiesMap = new HashMap<String,List<String>> ();
- /**
- * Process the start tag for this instance.
- * @throws JspException
- * @return int
- */
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
+ */
+ @Override
public abstract int doStartTag() throws JspException;
- /**
- * Process the end tag for this instance.
- * @throws JspException
- * @return int
- */
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.TagSupport#doEndTag()
+ */
+ @Override
public abstract int doEndTag() throws JspException;
- /**
- * Releases state of the tag handler.
- * @return void
- */
+
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.TagSupport#release()
+ */
//Called at the end of the lifecycle.
- public void release()
- {
+ @Override
+ public void release(){
super.release();
- parameters=null;
- secureBoolean=null;
+ parametersMap = null;
+ secureBoolean = null;
}
@@ -167,41 +172,93 @@
* @param value String
* @return void
*/
- public void addParameter(String key,String value)
- {
- /*if (escapeXml)
- {
- value=escapeXml(value);
- }*/
- List<String> values;
- if(parameters.containsKey(key))
- {
- values=(List<String>)parameters.get(key);//get old value list
+ protected void addParameter(String key,String value) {
+ if(key == null){
+ throw new NullPointerException();
+ }
+
+ if((value == null) || (value.length() == 0)){//remove parameter
+ if(parametersMap.containsKey(key)){
+ parametersMap.remove(key);
+ }
}
- else
- {
- values=new ArrayList<String>();// create new value list
+ else{//add value
+ List<String> valueList = null;
+
+ if(parametersMap.containsKey(key)){
+ valueList = parametersMap.get(key);//get old value list
+ }
+ else{
+ valueList = new ArrayList<String>();// create new value list
+ }
+
+ valueList.add(value);
+
+ parametersMap.put(key, valueList);
}
- values.add(value);
- parameters.put(key, values);
+ }
+
+ /**
+ * Adds a key,value pair to the property map.
+ * @param key String
+ * @param value String
+ * @return void
+ */
+ protected void addProperty(String key,String value) {
+ if(key == null){
+ throw new NullPointerException();
+ }
+
+ List<String> valueList = null;
+
+ if(propertiesMap.containsKey(key)){
+ valueList = propertiesMap.get(key);//get old value list
+ }
+ else{
+ valueList = new ArrayList<String>();// create new value list
+ }
+
+ valueList.add(value);
+
+ propertiesMap.put(key, valueList);
+
}
/**
- * Copies parameters from map to url.
+ * Copies the parameters from map to the BaseURL.
* @param url BaseURL
* @return void
*/
- protected void setUrlParameters(BaseURL url)
- {
- Set<String> keys=parameters.keySet();
- Iterator i=keys.iterator();
- while(i.hasNext())
- {
- String key=(String) i.next();
- List<String> values=parameters.get(key);
- String[] valarr=values.toArray(new String[0]);
- url.setParameter(key, valarr);
+ protected void setUrlParameters(BaseURL url) {
+ Set<String> keySet = parametersMap.keySet();
+
+
+ for(String key : keySet){
+
+ List<String> valueList = parametersMap.get(key);
+
+ String[] valueArray = valueList.toArray(new String[0]);
+
+ url.setParameter(key, valueArray);
+ }
+ }
+
+ /**
+ * Copies the properties from map to the BaseURL.
+ * @param url BaseURL
+ * @return void
+ */
+ protected void setUrlProperties(BaseURL url) {
+ Set<String> keySet = propertiesMap.keySet();
+
+ for(String key : keySet){
+
+ List<String> valueList = propertiesMap.get(key);
+
+ for(String value:valueList){
+ url.addProperty(key, value);
+ }
}
}
@@ -224,7 +281,7 @@
/**
* Checks if string is empty.
- * This method has been copied from <code>org.apache.commons.lang.StringUtils</code> class.
+ * This method is a copy from <code>org.apache.commons.lang.StringUtils</code> class.
* @param str String
* @return boolean
*/
@@ -235,7 +292,7 @@
/**
* Replaces String repl with String with in String text.
- * This method has been copied from <code>org.apache.commons.lang.StringUtils</code> class.
+ * This method is a copy from <code>org.apache.commons.lang.StringUtils</code> class.
* @param text - the String where to replace
* @param repl - the sub-String what to replace
* @param with - the sub-String what to replace repl with
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java?rev=577707&r1=577706&r2=577707&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/DefineObjectsTag.java Thu Sep 20 05:05:58 2007
@@ -1,9 +1,9 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
@@ -16,6 +16,8 @@
*/
package org.apache.pluto.tags;
+import java.util.Map;
+
import javax.portlet.ActionRequest;
import javax.portlet.EventRequest;
import javax.portlet.PortletConfig;
@@ -37,22 +39,38 @@
* A tag handler for the <CODE>defineObjects</CODE> tag. Creates the
* following variables to be used in the JSP:
* <UL>
- * <LI><CODE>{@link RenderRequest} renderRequest</CODE>, when included from within the <CODE>render</CODE> method
- * <LI><CODE>{@link ResourceRequest} resourceRequest</CODE>, when included from within the <CODE>serveResource</CODE> method
- * <LI><CODE>{@link ActionRequest} actionRequest</CODE>, when included from within the <CODE>processAction</CODE> method
- * <LI><CODE>{@link EventRequest} eventRequest</CODE>, when included from within the <CODE>processEvent</CODE> method
- * <LI><CODE>{@link RenderResponse} renderResponse</CODE>, when included from within the <CODE>render</CODE> method
- * <LI><CODE>{@link ResourceResponse} resourceResponse</CODE>, when included from within the <CODE>serveResource</CODE> method
- * <LI><CODE>{@link ActionResponse} actionResponse</CODE>, when included from within the <CODE>processAction</CODE> method
- * <LI><CODE>{@link EventResponse} eventResponse</CODE>, when included from within the <CODE>processEvent</CODE> method
+ * <LI><CODE>{@link RenderRequest} renderRequest</CODE>,
+ * when included from within the <CODE>render</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link ResourceRequest} resourceRequest</CODE>,
+ * when included from within the <CODE>serveResource</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link ActionRequest} actionRequest</CODE>,
+ * when included from within the <CODE>processAction</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link EventRequest} eventRequest</CODE>,
+ * when included from within the <CODE>processEvent</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link RenderResponse} renderResponse</CODE>,
+ * when included from within the <CODE>render</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link ResourceResponse} resourceResponse</CODE>,
+ * when included from within the <CODE>serveResource</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link ActionResponse} actionResponse</CODE>,
+ * when included from within the <CODE>processAction</CODE> method, <code>null</code> otherwise
+ * <LI><CODE>{@link EventResponse} eventResponse</CODE>,
+ * when included from within the <CODE>processEvent</CODE> method, <code>null</code> otherwise
* <LI><CODE>{@link PortletConfig} portletConfig</CODE>
- * <LI><CODE>{@link PortletSession} portletSession</CODE>
- * <LI><CODE>{@link PortletPreferences} portletPreferences</CODE>
+ * <LI><CODE>{@link PortletSession} portletSession</CODE>, providing access to the portletSession,
+ * does not create a new session, only returns an existing session
+ * <LI><CODE>{@link Map<String, String[]>} portletSessionScope</CODE>, providing access to the
+ * portletSession attributes as a Map.
+ * <LI><CODE>{@link PortletPreferences} portletPreferences</CODE>, providing access to
+ * the portlet preferences
+ * <LI> <CODE>{@link Map<String, String[]>} portletPreferencesValues</CODE>, providing access to the
+ * portlet preferences as a Map
* </UL>
*
* @version 2.0
*/
public class DefineObjectsTag extends TagSupport {
+
+ private static final long serialVersionUID = 286L;
/**
* Helper method.
@@ -78,12 +96,12 @@
* Helper method.
* <p>
* Sets render and request attribute with the names described in the
- * JSR 286 - PLT 25.1 (defineObjects Tag).
+ * JSR 286 - PLT 26.1 (defineObjects Tag).
* @param request PortletRequest
* @param response PortletResponse
* @return void
*/
- private void setReqRes(PortletRequest request,PortletResponse response )
+ private void setRequestAndResponseAttribute(PortletRequest request,PortletResponse response )
{
//check where request and response where included from
if(request instanceof RenderRequest)
@@ -124,12 +142,20 @@
PortletConfig portletConfig = (PortletConfig) pageContext.getRequest()
.getAttribute(Constants.PORTLET_CONFIG);
- PortletSession portletSession=request.getPortletSession();
+ PortletSession portletSession=request.getPortletSession(false);
+ Map<String, Object> portletSessionScope = null;
+ if(portletSession != null){
+ portletSessionScope = (Map<String, Object>)portletSession.getMap();
+ }
PortletPreferences portletPreferences = request.getPreferences();
+ Map<String, String[]> portletPreferencesValues = null;
+ if(portletPreferences != null){
+ portletPreferencesValues = portletPreferences.getMap();
+ }
// set attributes render and request
- setReqRes(request,response);
+ setRequestAndResponseAttribute(request,response);
// set attribute portletConfig
setAttribute(portletConfig,"portletConfig");
@@ -137,8 +163,14 @@
// set attribute portletSession
setAttribute(portletSession,"portletSession");
+ //set attribute portletSession
+ setAttribute(portletSessionScope,"portletSessionScope");
+
+ // set attribute portletPreferences
+ setAttribute(portletPreferences,"portletPreferences");
+
// set attribute portletPreferences
- setAttribute(portletPreferences,"portletPreferences");
+ setAttribute(portletPreferencesValues,"portletPreferencesValues");
return SKIP_BODY;
}
@@ -183,14 +215,23 @@
"javax.portlet.PortletConfig",
true,
VariableInfo.AT_BEGIN),
- new VariableInfo("portletPreferences",
+ new VariableInfo("portletSession",
+ "javax.portlet.PortletSession",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletSessionScope",
+ "java.util.Map",
+ true,
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletPreferences",
"javax.portlet.PortletPreferences",
true,
- VariableInfo.AT_BEGIN),
- new VariableInfo("portletSession",
- "javax.portlet.PortletSession",
- true,
- VariableInfo.AT_BEGIN)
+ VariableInfo.AT_BEGIN),
+ new VariableInfo("portletPreferencesValues",
+ "java.util.Map",
+ true,
+ VariableInfo.AT_BEGIN),
+
};
return info;
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java?rev=577707&r1=577706&r2=577707&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/NamespaceTag.java Thu Sep 20 05:05:58 2007
@@ -30,6 +30,8 @@
* for the current portlet <BR>This tag has no attributes
*/
public class NamespaceTag extends TagSupport {
+
+ private static final long serialVersionUID = 286L;
/* (non-Javadoc)
* @see javax.servlet.jsp.tagext.Tag#doStartTag()
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java?rev=577707&r1=577706&r2=577707&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ParamTag.java Thu Sep 20 05:05:58 2007
@@ -32,14 +32,16 @@
* @version 2.0
*/
public class ParamTag extends TagSupport {
+
+ private static final long serialVersionUID = 286L;
private String name;
private String value;
- /**
- * Processes the <CODE>param</CODE> tag.
- * @return <CODE>SKIP_BODY</CODE>
+ /* (non-Javadoc)
+ * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
*/
+ @Override
public int doStartTag() throws JspException {
BaseURLTag urlTag = (BaseURLTag)
findAncestorWithClass(this, BaseURLTag.class);
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java?rev=577707&r1=577706&r2=577707&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/PortletURLTag.java Thu Sep 20 05:05:58 2007
@@ -20,7 +20,6 @@
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.Map;
@@ -50,15 +49,15 @@
* TagExtraInfo class for PortletURLTag.
*/
public static class TEI extends BaseURLTag.TEI {
- public final static Hashtable definedWindowStates = getDefinedWindowStates();
- public final static Hashtable portletModes = getDefinedPortletModes();
+ public final static Hashtable<String,Object> definedWindowStates = getDefinedWindowStates();
+ public final static Hashtable<String,Object> portletModes = getDefinedPortletModes();
/**
* Provides a list of all static PortletMode available in the
* specifications by using introspection
* @return Hashtable
*/
- private static Hashtable getDefinedPortletModes() {
+ private static Hashtable<String,Object> getDefinedPortletModes() {
Hashtable<String,Object> portletModes = new Hashtable<String,Object>();
Field[] f = PortletMode.class.getDeclaredFields();
@@ -82,7 +81,7 @@
* specifications by using introspection
* @return Hashtable
*/
- private static Hashtable getDefinedWindowStates() {
+ private static Hashtable<String,Object> getDefinedWindowStates() {
Hashtable<String,Object> definedWindowStates = new Hashtable<String,Object>();
Field[] f = WindowState.class.getDeclaredFields();
@@ -103,37 +102,38 @@
}
- protected String portletMode;
- protected String windowState;
- protected Boolean copyCurrentRenderParameters=false;
- protected PortletURL url;
+ //------------------------------------------------------------------------------------------------------------------
+ protected String portletMode = null;
+ protected String windowState = null;
+ protected Boolean copyCurrentRenderParameters = false;
+ protected PortletURL url = null;
- /**
- * Process the start tag for this instance.
- * @throws JspException
- * @return EVAL_BODY_INCLUDE
- */
+
+ /* (non-Javadoc)
+ * @see org.apache.pluto.tags.BaseURLTag#doStartTag()
+ */
+ @Override
public int doStartTag() throws JspException {
//parameters= new HashMap<String,List<String>> ();
- if(copyCurrentRenderParameters)
- {
+ if(copyCurrentRenderParameters){
doCopyCurrentRenderParameters();
}
if (var != null) {
pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
}
- PortletResponse portletResponse = (PortletResponse) pageContext.getRequest()
- .getAttribute(Constants.PORTLET_RESPONSE);
+
+ PortletResponse portletResponse =
+ (PortletResponse) pageContext.getRequest().getAttribute(Constants.PORTLET_RESPONSE);
if (portletResponse != null) {
setUrl(createPortletUrl(portletResponse));
- if (portletMode != null) {
+ if (portletMode != null) {//set portlet mode
try {
PortletMode mode = (PortletMode)
TEI.portletModes.get(portletMode.toUpperCase());
@@ -141,29 +141,34 @@
if (mode == null) {
mode = new PortletMode(portletMode);// support for custom portlet modes PLUTO-258
}
+
url.setPortletMode(mode);
- } catch (PortletModeException e) {
- throw new JspException(e);
+
+ } catch (PortletModeException e) {
+ throw new JspException(e);
}
}
- if (windowState != null) {
- try {
+ if (windowState != null) {//set window state
+ try {
WindowState state = (WindowState)
TEI.definedWindowStates.get(windowState.toUpperCase());
+
if (state == null) {
state = new WindowState(windowState);//support for custom window states PLUTO-258
}
+
url.setWindowState(state);
- } catch (WindowStateException e) {
+
+ } catch (WindowStateException e) {
throw new JspException(e);
}
}
- if (secure != null) {
- try {
+ if (secure != null) {//set secure boolean
+ try {
url.setSecure(getSecureBoolean());
- } catch (PortletSecurityException e) {
+ } catch (PortletSecurityException e) {
throw new JspException(e);
}
}
@@ -172,26 +177,25 @@
}
- /**
- * Process the end tag for this instance.
- * @throws JspException
- * @return EVAL_PAGE
- */
+ /* (non-Javadoc)
+ * @see org.apache.pluto.tags.BaseURLTag#doEndTag()
+ */
+ @Override
public int doEndTag() throws JspException{
- setUrlParameters(url);
+ setUrlParameters(url);
+ setUrlProperties(url);
-
- HttpServletResponse response=(HttpServletResponse) pageContext.getResponse();
+ HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
// properly encoding urls to allow non-cookie enabled sessions - PLUTO-252
- String urlString=response.encodeURL(url.toString());
+ String urlString = response.encodeURL(url.toString());
if(escapeXml){
- urlString=doEscapeXml(urlString);
+ urlString = doEscapeXml(urlString);
}
if (var == null) {
- try {
+ try {
JspWriter writer = pageContext.getOut();
writer.print(urlString);
} catch (IOException ioe) {
@@ -204,7 +208,8 @@
PageContext.PAGE_SCOPE);
}
- parameters.clear();//cleanup
+ propertiesMap.clear();
+ parametersMap.clear();//cleanup
return EVAL_PAGE;
}
@@ -290,26 +295,26 @@
* Copies the current render parameters to the parameter map.
* @return void
*/
- protected void doCopyCurrentRenderParameters()
- {
- PortletRequest request = (PortletRequest) pageContext.getRequest()
- .getAttribute(Constants.PORTLET_REQUEST);
- if(request!=null)
- {
- Map<String,String[]> renderParamsMap=request.getParameterMap();
- Set<String> keys=renderParamsMap.keySet();
- Iterator i=keys.iterator();
- while(i.hasNext())
- {
- String key=(String) i.next();
- String[] values=renderParamsMap.get(key);
- List<String> valuesList=new ArrayList<String>();
- int index=0;
- while(index<values.length){
- valuesList.add(values[index]);
- index++;
- }
- parameters.put(key,valuesList);
+ protected void doCopyCurrentRenderParameters(){
+ PortletRequest request =
+ (PortletRequest) pageContext.getRequest().getAttribute(Constants.PORTLET_REQUEST);
+
+ if(request != null){
+ Map<String,String[]> renderParamsMap = request.getPrivateParameterMap();
+
+ Set<String> keySet = renderParamsMap.keySet();
+
+ for(String key : keySet){
+
+ String[] values = renderParamsMap.get(key);
+
+ List<String> valueList = new ArrayList<String>();
+
+ for(int index = 0; index < values.length; ++index){
+ valueList.add(values[index]);
+ }
+
+ parametersMap.put(key,valueList);
}
}
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java?rev=577707&r1=577706&r2=577707&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/RenderURLTag.java Thu Sep 20 05:05:58 2007
@@ -29,13 +29,15 @@
* @version 2.0
*/
public class RenderURLTag extends PortletURLTag {
-
+
+ private static final long serialVersionUID = 286L;
/**
- * Creates a renderURL
+ * Creates a render PortletURL
* @param portletResponse PortletResponse
* @return PortletURL
*/
+ @Override
protected PortletURL createPortletUrl(PortletResponse portletResponse)
{
return portletResponse.createRenderURL();
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java?rev=577707&r1=577706&r2=577707&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/ResourceURLTag.java Thu Sep 20 05:05:58 2007
@@ -18,12 +18,10 @@
import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import javax.portlet.BaseURL;
import javax.portlet.PortletResponse;
import javax.portlet.PortletSecurityException;
+import javax.portlet.ResourceURL;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;
@@ -40,67 +38,105 @@
*/
public class ResourceURLTag extends BaseURLTag {
+
+ private static final long serialVersionUID = 286L;
- protected BaseURL url;
+ private ResourceURL url = null;
- /**
- * Process the start tag for this instance.
- * @throws JspException
- * @return EVAL_BODY_INCLUDE
- */
+ private String id = null;
+ private String cachability = null;
+
+
+
+ /* (non-Javadoc)
+ * @see org.apache.pluto.tags.BaseURLTag#doStartTag()
+ */
+ @Override
public int doStartTag() throws JspException {
- parameters= new HashMap<String,List<String>> ();
+
if (var != null) {
pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
}
+
PortletResponse portletResponse = (PortletResponse) pageContext.getRequest()
.getAttribute(Constants.PORTLET_RESPONSE);
if (portletResponse != null) {
- setUrl(portletResponse.createResourceURL());
+
+ url = portletResponse.createResourceURL();
+
if (secure != null) {
+
try {
+
url.setSecure(getSecureBoolean());
+
} catch (PortletSecurityException e) {
+
throw new JspException(e);
+
}
}
}
return EVAL_BODY_INCLUDE;
}
- /**
- * Process the end tag for this instance.
- * @throws JspException
- * @return EVAL_PAGE
- */
+
+ /* (non-Javadoc)
+ * @see org.apache.pluto.tags.BaseURLTag#doEndTag()
+ */
+ @Override
public int doEndTag() throws JspException{
setUrlParameters(url);
+ setUrlProperties(url);
+
+ if(id != null){
+ url.setResourceID(id);
+ }
+
+ if(cachability != null){
+ try{
+ url.setCacheability(cachability);
+ }
+ catch(IllegalArgumentException e){
+ throw new JspException(e);
+ }
+ catch(IllegalStateException e){
+ throw new JspException(e);
+ }
+ }
- HttpServletResponse response=(HttpServletResponse) pageContext.getResponse();
+ HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
- String urlString=response.encodeURL(url.toString());
+ String urlString = response.encodeURL(url.toString());
- if(escapeXml)
- {
- urlString=doEscapeXml(urlString);
+ if(escapeXml){
+
+ urlString = doEscapeXml(urlString);
}
if (var == null) {
try {
+
JspWriter writer = pageContext.getOut();
writer.print(urlString);
+
} catch (IOException ioe) {
+
throw new JspException(
"resourceURL Tag Exception: cannot write to the output writer.");
}
+
} else {
+
pageContext.setAttribute(var, urlString,
PageContext.PAGE_SCOPE);
+
}
- parameters.clear();//cleanup
+ propertiesMap.clear();
+ parametersMap.clear();//cleanup
return EVAL_PAGE;
}
@@ -109,7 +145,7 @@
* Gets the url property.
* @return BaseURL
*/
- public BaseURL getUrl() {
+ public ResourceURL getUrl() {
return url;
}
@@ -118,7 +154,38 @@
* @param url BaseUrl - The url to set.
* @return void
*/
- public void setUrl(BaseURL url) {
+ public void setUrl(ResourceURL url) {
this.url = url;
}
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+
+ /**
+ * @return the cachability
+ */
+ public String getCachability() {
+ return cachability;
+ }
+
+
+ /**
+ * @param cachability the cachability to set
+ */
+ public void setCachability(String cachability) {
+ this.cachability = cachability;
+ }
}
Modified: portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java?rev=577707&r1=577706&r2=577707&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java (original)
+++ portals/pluto/branches/1.1-286-trunk-merge/pluto-taglib/src/main/java/org/apache/pluto/tags/el/ParamTag.java Thu Sep 20 05:05:58 2007
@@ -20,6 +20,8 @@
public class ParamTag extends org.apache.pluto.tags.ParamTag {
+
+ private static final long serialVersionUID=286L;
public String getValue() throws JspException {
return ExpressionEvaluatorProxy.getProxy().evaluate(super.getValue(), pageContext);