You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by jo...@apache.org on 2011/06/26 10:30:02 UTC

svn commit: r1139729 [1/3] - in /struts/struts2/trunk: ./ apps/portlet/ apps/portlet/src/main/webapp/WEB-INF/ archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/ archetypes/struts2-archetype-dbportlet/src/main/resources/arche...

Author: jogep
Date: Sun Jun 26 08:30:00 2011
New Revision: 1139729

URL: http://svn.apache.org/viewvc?rev=1139729&view=rev
Log:
Rollback changes for WW-3620 because lost of SVN History.

Added:
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/components/
      - copied from r1138699, struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/components/
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/components/PortletUrlRendererTest.java
      - copied unchanged from r1138699, struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/components/PortletUrlRendererTest.java
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/servlet/
      - copied from r1138699, struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/servlet/
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/servlet/PortletServletRequestTest.java
      - copied unchanged from r1138699, struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/servlet/PortletServletRequestTest.java
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/views/freemarker/
      - copied from r1138699, struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/views/freemarker/
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/views/freemarker/PortletFreemarkerResultTest.java
      - copied unchanged from r1138699, struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/views/freemarker/PortletFreemarkerResultTest.java
Removed:
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletConstants.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr286Dispatcher.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResultHelper.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResultHelperJSR168.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResultHelperJSR286.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletResponseJSR286.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelperJSR286.java
Modified:
    struts/struts2/trunk/apps/portlet/pom.xml
    struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/portlet.xml
    struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/web.xml
    struts/struts2/trunk/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/pom.xml
    struts/struts2/trunk/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml
    struts/struts2/trunk/archetypes/struts2-archetype-portlet/src/main/resources/archetype-resources/pom.xml
    struts/struts2/trunk/archetypes/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml
    struts/struts2/trunk/plugins/portlet/pom.xml
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/components/PortletUrlRenderer.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletActionConstants.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletRequestMap.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletSessionMap.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/DispatcherServlet.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletAwareInterceptor.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletContextAware.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletPreferencesAware.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletPrincipalProxy.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletRequestAware.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletResponseAware.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptor.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/ServletPortletPreferences.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResult.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletHttpSession.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletConfig.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletRequest.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletRequestDispatcher.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletResponse.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java
    struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/views/freemarker/PortletFreemarkerResult.java
    struts/struts2/trunk/plugins/portlet/src/main/resources/struts-plugin.xml
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/PortletApplicationMapTest.java
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/PortletRequestMapTest.java
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/PortletSessionMapTest.java
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/context/PortletActionContextTest.java
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletAwareInterceptorTest.java
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptorTest.java
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/result/PortletResultTest.java
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/portlet/util/PortletUrlHelperTest.java
    struts/struts2/trunk/plugins/portlet/src/test/java/org/apache/struts2/views/jsp/PortletUrlTagTest.java
    struts/struts2/trunk/pom.xml

Modified: struts/struts2/trunk/apps/portlet/pom.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/pom.xml?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/apps/portlet/pom.xml (original)
+++ struts/struts2/trunk/apps/portlet/pom.xml Sun Jun 26 08:30:00 2011
@@ -93,8 +93,8 @@
 
     <dependencies>
         <dependency>
-            <groupId>javax.portlet</groupId>
-             <artifactId>portlet-api</artifactId>
+            <groupId>portlet-api</groupId>
+            <artifactId>portlet-api</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>

Modified: struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/portlet.xml?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/portlet.xml (original)
+++ struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/portlet.xml Sun Jun 26 08:30:00 2011
@@ -73,7 +73,7 @@
         <portlet-name>StrutsPortlet2</portlet-name>
         <display-name xml:lang="EN">Struts Test Portlet2</display-name>
     
-        <portlet-class>org.apache.struts2.portlet.dispatcher.Jsr286Dispatcher</portlet-class>
+        <portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
 
         <!-- The view mode namespace. Maps to a namespace in the Struts 2 config file. -->
         <init-param>

Modified: struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/web.xml?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/web.xml (original)
+++ struts/struts2/trunk/apps/portlet/src/main/webapp/WEB-INF/web.xml Sun Jun 26 08:30:00 2011
@@ -8,8 +8,11 @@
 			/WEB-INF/applicationContext*.xml
 		</param-value>
 	</context-param>
-    <listener>
-        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-    </listener>
 
+	<!-- Uncomment to use the dispatcher servlet -->
+	<!--<servlet id="Struts2PortletDispatcherServlet">
+		<servlet-name>Struts2PortletDispatcherServlet</servlet-name>
+		<servlet-class>org.apache.struts2.portlet.dispatcher.DispatcherServlet</servlet-class>
+	</servlet>-->
+	
 </web-app>

Modified: struts/struts2/trunk/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/pom.xml?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/pom.xml (original)
+++ struts/struts2/trunk/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/pom.xml Sun Jun 26 08:30:00 2011
@@ -59,7 +59,7 @@
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-jdbc</artifactId>
-            <version>3.0.5.RELEASE</version>
+            <version>2.5.6</version>
         </dependency>
 
         <!-- Database driver (change for your specific database) -->
@@ -85,9 +85,9 @@
 		</dependency>
 
         <dependency>
-            <groupId>javax.portlet</groupId>
+            <groupId>portlet-api</groupId>
             <artifactId>portlet-api</artifactId>
-            <version>2.0</version>
+            <version>1.0</version>
             <scope>provided</scope>
         </dependency>
 
@@ -117,9 +117,9 @@
                 </configuration>
                 <dependencies>
                     <dependency>
-                        <groupId>javax.portlet</groupId>
+                        <groupId>portlet-api</groupId>
                         <artifactId>portlet-api</artifactId>
-                        <version>2.0</version>
+                        <version>1.0</version>
                     </dependency>
                 </dependencies>
     		</plugin>

Modified: struts/struts2/trunk/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml (original)
+++ struts/struts2/trunk/archetypes/struts2-archetype-dbportlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml Sun Jun 26 08:30:00 2011
@@ -6,7 +6,7 @@ xsi:schemaLocation="http://java.sun.com/
     <portlet-name>StrutsDBPortlet</portlet-name>
     <display-name xml:lang="EN">Struts Database Portlet</display-name>
     
-    <portlet-class>org.apache.struts2.portlet.dispatcher.Jsr286Dispatcher</portlet-class>
+    <portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
 
     <init-param>
         <name>actionPackages</name>

Modified: struts/struts2/trunk/archetypes/struts2-archetype-portlet/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/archetypes/struts2-archetype-portlet/src/main/resources/archetype-resources/pom.xml?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/archetypes/struts2-archetype-portlet/src/main/resources/archetype-resources/pom.xml (original)
+++ struts/struts2/trunk/archetypes/struts2-archetype-portlet/src/main/resources/archetype-resources/pom.xml Sun Jun 26 08:30:00 2011
@@ -37,7 +37,7 @@
         <dependency>
             <groupId>javax.portlet</groupId>
             <artifactId>portlet-api</artifactId>
-            <version>2.0</version>
+            <version>1.0</version>
             <scope>provided</scope>
         </dependency>
 

Modified: struts/struts2/trunk/archetypes/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/archetypes/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/archetypes/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml (original)
+++ struts/struts2/trunk/archetypes/struts2-archetype-portlet/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/portlet.xml Sun Jun 26 08:30:00 2011
@@ -12,7 +12,7 @@
         <portlet-name>HelloPortlet</portlet-name>
         <display-name xml:lang="EN">${artifactId}</display-name>
     
-        <portlet-class>org.apache.struts2.portlet.dispatcher.Jsr286Dispatcher</portlet-class>
+        <portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
 
 		<!-- The namespace for the actions configured for view mode -->
 		<init-param>

Modified: struts/struts2/trunk/plugins/portlet/pom.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/pom.xml?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/pom.xml (original)
+++ struts/struts2/trunk/plugins/portlet/pom.xml Sun Jun 26 08:30:00 2011
@@ -78,7 +78,7 @@
 
         <!-- Portlet -->
         <dependency>
-            <groupId>javax.portlet</groupId>
+            <groupId>portlet-api</groupId>
             <artifactId>portlet-api</artifactId>
             <scope>provided</scope>
         </dependency>
@@ -121,19 +121,20 @@
         <!-- Mocks for unit testing (by Spring) -->
         <dependency>
             <groupId>org.springframework</groupId>
-            <artifactId>spring-mock</artifactId>
-            <version>2.0.7</version>
+            <artifactId>spring-test</artifactId>
+            <version>2.5.6</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
-            <artifactId>spring-portlet</artifactId>
-            <version>2.0.8</version>
+            <artifactId>spring-webmvc-portlet</artifactId>
+            <version>2.5.6</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-core</artifactId>
+            <version>2.5.6</version>
             <scope>test</scope>
         </dependency>
         <dependency>

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/components/PortletUrlRenderer.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/components/PortletUrlRenderer.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/components/PortletUrlRenderer.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/components/PortletUrlRenderer.java Sun Jun 26 08:30:00 2011
@@ -18,93 +18,92 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2.components;
 
-import java.io.IOException;
-import java.io.Writer;
+package org.apache.struts2.components;
 
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.inject.Inject;
 import org.apache.commons.lang.StringUtils;
 import org.apache.struts2.StrutsException;
 import org.apache.struts2.dispatcher.mapper.ActionMapper;
 import org.apache.struts2.portlet.context.PortletActionContext;
 import org.apache.struts2.portlet.util.PortletUrlHelper;
-import org.apache.struts2.portlet.util.PortletUrlHelperJSR286;
 
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.logging.Logger;
-import com.opensymphony.xwork2.util.logging.LoggerFactory;
+import java.io.IOException;
+import java.io.Writer;
 
 /**
  * Implementation of the {@link UrlRenderer} interface that renders URLs for portlet environments.
- *
+ * 
  * @see UrlRenderer
  *
  */
 public class PortletUrlRenderer implements UrlRenderer {
+	
+	/**
+	 * The servlet renderer used when not executing in a portlet context.
+	 */
+	private UrlRenderer servletRenderer = null;
+	
+	public PortletUrlRenderer() {
+		this.servletRenderer = new ServletUrlRenderer();
+	}
 
-    private static final Logger LOG = LoggerFactory.getLogger(PortletUrlRenderer.class);
-
-    /**
-     * The servlet renderer used when not executing in a portlet context.
-     */
-    private UrlRenderer servletRenderer = null;
-    private PortletUrlHelper portletUrlHelper = null;
-
-    public PortletUrlRenderer() {
-        this.servletRenderer = new ServletUrlRenderer();
-
-        if (PortletActionContext.isJSR268Supported()) {
-            this.portletUrlHelper = new PortletUrlHelperJSR286();
-        } else {
-            this.portletUrlHelper = new PortletUrlHelper();
-        }
-    }
-
-    @Inject
-    public void setActionMapper( ActionMapper actionMapper) {
-        servletRenderer.setActionMapper(actionMapper);
-    }
-
+	@Inject
+	public void setActionMapper(ActionMapper actionMapper) {
+		servletRenderer.setActionMapper(actionMapper);
+	}
+	
 	/**
 	 * {@inheritDoc}
 	 */
 	public void renderUrl(Writer writer, UrlProvider urlComponent) {
-        String scheme = urlComponent.getHttpServletRequest().getScheme();
-
-        if (urlComponent.getScheme() != null) {
-            scheme = urlComponent.getScheme();
-        }
-
-        String result;
-        if (onlyActionSpecified(urlComponent)) {
-                result = portletUrlHelper.buildUrl(urlComponent.getAction(), urlComponent.getNamespace(), urlComponent.getMethod(), urlComponent.getParameters(), urlComponent.getPortletUrlType(), urlComponent.getPortletMode(), urlComponent.getWindowState());
-        } else if(onlyValueSpecified(urlComponent)){
-                result = portletUrlHelper.buildResourceUrl(urlComponent.getValue(), urlComponent.getParameters());
-        }
-        else {
-        	result = createDefaultUrl(urlComponent);
-        }
-        final String anchor = urlComponent.getAnchor();
-        if ( anchor != null && anchor.length() > 0 ) {
-            result += '#' + anchor;
-        }
-
-        String var = urlComponent.getVar();
-
-        if (var != null) {
-            urlComponent.putInContext(result);
-
-            // add to the request and page scopes as well
-            urlComponent.getHttpServletRequest().setAttribute(var, result);
-        } else {
-            try {
-                writer.write(result);
-            } catch (IOException e) {
-                throw new StrutsException("IOError: " + e.getMessage(), e);
-            }
-        }
+		if(PortletActionContext.getPortletContext() == null || "none".equalsIgnoreCase(urlComponent.getPortletUrlType())) {
+			servletRenderer.renderUrl(writer, urlComponent);
+		}
+		else {
+			String action = null;
+			if(urlComponent.getAction() != null) {
+				action = urlComponent.findString(urlComponent.getAction());
+			}
+			String scheme = urlComponent.getHttpServletRequest().getScheme();
+
+			if (urlComponent.getScheme() != null) {
+				scheme = urlComponent.getScheme();
+			}
+
+			String result;
+			urlComponent.setNamespace(urlComponent.determineNamespace(urlComponent.getNamespace(), urlComponent.getStack(), urlComponent.getHttpServletRequest()));
+			if (onlyActionSpecified(urlComponent)) {
+				result = PortletUrlHelper.buildUrl(action, urlComponent.getNamespace(), urlComponent.getMethod(), urlComponent.getParameters(), urlComponent.getPortletUrlType(),
+                        urlComponent.getPortletMode(), urlComponent.getWindowState());
+			} else if(onlyValueSpecified(urlComponent)){
+				result = PortletUrlHelper.buildResourceUrl(urlComponent.getValue(), urlComponent.getParameters());
+			}
+			else {
+				result = createDefaultUrl(urlComponent);
+			}
+            String anchor = urlComponent.getAnchor();
+			if (StringUtils.isNotEmpty(anchor)) {
+				result += '#' + urlComponent.findString(anchor);
+			}
+
+			String var = urlComponent.getVar();
+
+			if (var != null) {
+				urlComponent.putInContext(result);
+
+				// add to the request and page scopes as well
+				urlComponent.getHttpServletRequest().setAttribute(var, result);
+			} else {
+				try {
+					writer.write(result);
+				} catch (IOException e) {
+					throw new StrutsException("IOError: " + e.getMessage(), e);
+				}
+			}
+		}
 	}
 
 	private String createDefaultUrl(UrlProvider urlComponent) {
@@ -112,66 +111,65 @@ public class PortletUrlRenderer implemen
 		ActionInvocation ai = (ActionInvocation)urlComponent.getStack().getContext().get(
 				ActionContext.ACTION_INVOCATION);
 		String action = ai.getProxy().getActionName();
-		result = portletUrlHelper.buildUrl(action, urlComponent.getNamespace(), urlComponent.getMethod(), urlComponent.getParameters(),
+		result = PortletUrlHelper.buildUrl(action, urlComponent.getNamespace(), urlComponent.getMethod(), urlComponent.getParameters(),
                 urlComponent.getPortletUrlType(), urlComponent.getPortletMode(), urlComponent.getWindowState());
 		return result;
 	}
 
-    private boolean onlyValueSpecified(UrlProvider urlComponent) {
-        return urlComponent.getValue() != null && urlComponent.getAction() == null;
-    }
-
-    private boolean onlyActionSpecified(UrlProvider urlComponent) {
-        return urlComponent.getValue() == null && urlComponent.getAction() != null;
-    }
+	private boolean onlyValueSpecified(UrlProvider urlComponent) {
+		return urlComponent.getValue() != null && urlComponent.getAction() == null;
+	}
+
+	private boolean onlyActionSpecified(UrlProvider urlComponent) {
+		return urlComponent.getValue() == null && urlComponent.getAction() != null;
+	}
 
 	/**
 	 * {@inheritDoc}
 	 */
 	public void renderFormUrl(Form formComponent) {
-        if(PortletActionContext.getPortletContext() == null) {
-            servletRenderer.renderFormUrl(formComponent);
-        }
-        else {
-            String namespace = formComponent.determineNamespace(formComponent.namespace, formComponent.getStack(),
-                    formComponent.request);
-            String action = null;
-            if (formComponent.action != null) {
-                action = formComponent.findString(formComponent.action);
-            }
-            else {
-                ActionInvocation ai = (ActionInvocation) formComponent.getStack().getContext().get(ActionContext.ACTION_INVOCATION);
-                action = ai.getProxy().getActionName();
-            }
-
-            String type = "action";
-            if (StringUtils.isNotEmpty(formComponent.method)) {
-                if ("GET".equalsIgnoreCase(formComponent.method.trim())) {
-                    type = "render";
-                }
-            }
-            if (action != null) {
-                String result = portletUrlHelper.buildUrl(action, namespace, null,
-                        formComponent.getParameters(), type, formComponent.portletMode, formComponent.windowState);
-                formComponent.addParameter("action", result);
-
-
-                // name/id: cut out anything between / and . should be the id and
-                // name
-                String id = formComponent.getId();
-                if (id == null) {
-                    int slash = action.lastIndexOf('/');
-                    int dot = action.indexOf('.', slash);
-                    if (dot != -1) {
-                        id = action.substring(slash + 1, dot);
-                    } else {
-                        id = action.substring(slash + 1);
-                    }
-                    formComponent.addParameter("id", formComponent.escape(id));
-                }
-            }
-        }
-
+		if(PortletActionContext.getPortletContext() == null) {
+			servletRenderer.renderFormUrl(formComponent);
+		}
+		else {
+			String namespace = formComponent.determineNamespace(formComponent.namespace, formComponent.getStack(),
+					formComponent.request);
+			String action = null;
+			if (formComponent.action != null) {
+				action = formComponent.findString(formComponent.action);
+			}
+			else {
+				ActionInvocation ai = (ActionInvocation) formComponent.getStack().getContext().get(ActionContext.ACTION_INVOCATION);
+				action = ai.getProxy().getActionName();
+			}
+			String type = "action";
+			if (StringUtils.isNotEmpty(formComponent.method)) {
+				if ("GET".equalsIgnoreCase(formComponent.method.trim())) {
+					type = "render";
+				}
+			}
+			if (action != null) {
+				String result = PortletUrlHelper.buildUrl(action, namespace, null,
+						formComponent.getParameters(), type, formComponent.portletMode, formComponent.windowState);
+				formComponent.addParameter("action", result);
+
+
+				// name/id: cut out anything between / and . should be the id and
+				// name
+				String id = formComponent.getId();
+				if (id == null) {
+					int slash = action.lastIndexOf('/');
+					int dot = action.indexOf('.', slash);
+					if (dot != -1) {
+						id = action.substring(slash + 1, dot);
+					} else {
+						id = action.substring(slash + 1);
+					}
+					formComponent.addParameter("id", formComponent.escape(id));
+				}
+			}
+		}
+		
 	}
 
 	public void beforeRenderUrl(UrlProvider urlComponent) {
@@ -180,4 +178,9 @@ public class PortletUrlRenderer implemen
 		}
 	}
 
+	public void setServletRenderer(UrlRenderer nonPortletRenderer) {
+		this.servletRenderer = nonPortletRenderer;
+		
+	}
+
 }

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletActionConstants.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletActionConstants.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletActionConstants.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletActionConstants.java Sun Jun 26 08:30:00 2011
@@ -57,10 +57,10 @@ public interface PortletActionConstants 
     Integer RENDER_PHASE = new Integer(1);
 
     /**
-     * Constant used for the action phase (
+     * Constant used for the event phase (
      * {@link javax.portlet.Portlet#processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)})
      */
-    Integer ACTION_PHASE = new Integer(2);
+    Integer EVENT_PHASE = new Integer(2);
 
     /**
      * Key used for looking up and storing the
@@ -107,22 +107,22 @@ public interface PortletActionConstants 
      * {@link org.apache.struts2.portlet.context.PortletActionContext}.
      */
     String DEFAULT_ACTION_FOR_MODE = "struts.portlet.defaultActionForMode";
-
+    
     /**
-     * Key for request attribute indicating if the action has been reset.
+     * Key for request attribute indicating if the action has been reset. 
      */
     String ACTION_RESET = "struts.portlet.actionReset";
-
+    
     /**
      * Key for session attribute indicating the location of the render direct action.
      */
     String RENDER_DIRECT_LOCATION = "struts.portlet.renderDirectLocation";
-
+    
     /**
      * Key for the dispatch instruction for the {@link DispatcherServlet}
      */
 	String DISPATCH_TO = "struts.portlet.dispatchTo";
-
+	
 	/**
 	 * Session key where the value stack from the event phase is stored.
 	 */
@@ -132,7 +132,7 @@ public interface PortletActionConstants 
 	 * Default name of dispatcher servlet in web.xml
 	 */
 	String DEFAULT_DISPATCHER_SERVLET_NAME = "Struts2PortletDispatcherServlet";
-
+	
 	/**
 	 * Key for the action mapping in the context
     */

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletApplicationMap.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet;
 
 import java.io.Serializable;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletRequestMap.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletRequestMap.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletRequestMap.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletRequestMap.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet;
 
 import java.util.AbstractMap;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletSessionMap.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletSessionMap.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletSessionMap.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/PortletSessionMap.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet;
 
 import java.util.AbstractMap;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/context/PortletActionContext.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.context;
 
 import java.util.Map;
@@ -33,18 +34,17 @@ import javax.portlet.RenderResponse;
 
 import org.apache.struts2.StrutsStatics;
 import org.apache.struts2.dispatcher.mapper.ActionMapping;
+import org.apache.struts2.portlet.PortletActionConstants;
 
 import com.opensymphony.xwork2.ActionContext;
 
-import static org.apache.struts2.portlet.PortletConstants.*;
-
 
 /**
  * PortletActionContext. ActionContext thread local for the portlet environment.
  *
  * @version $Revision$ $Date$
  */
-public class PortletActionContext {
+public class PortletActionContext implements PortletActionConstants {
 
     /**
      * Get the PortletConfig of the portlet that is executing.
@@ -90,7 +90,7 @@ public class PortletActionContext {
      * @throws IllegalStateException If the method is invoked in the wrong phase.
      */
     public static ActionRequest getActionRequest() {
-        if (!isAction()) {
+        if (!isEvent()) {
             throw new IllegalStateException(
                     "ActionRequest cannot be obtained in render phase");
         }
@@ -104,7 +104,7 @@ public class PortletActionContext {
      * @throws IllegalStateException If the method is invoked in the wrong phase.
      */
     public static ActionResponse getActionResponse() {
-        if (!isAction()) {
+        if (!isEvent()) {
             throw new IllegalStateException(
                     "ActionResponse cannot be obtained in render phase");
         }
@@ -129,6 +129,14 @@ public class PortletActionContext {
     public static PortletRequest getRequest() {
         return (PortletRequest) getContext().get(REQUEST);
     }
+    
+    /**
+     * Convenience setter for the portlet request.
+     * @param request
+     */
+    public static void setRequest(PortletRequest request) {
+    	getContext().put(REQUEST, request);
+    }
 
     /**
      * Get the current PortletResponse
@@ -138,12 +146,20 @@ public class PortletActionContext {
     public static PortletResponse getResponse() {
         return (PortletResponse) getContext().get(RESPONSE);
     }
+    
+    /**
+     * Convenience setter for the portlet response.
+     * @param response
+     */
+    public static void setResponse(PortletResponse response) {
+    	getContext().put(RESPONSE, response);
+    }
 
     /**
      * Get the phase that the portlet is executing in.
      *
      * @return {@link PortletActionConstants#RENDER_PHASE} in render phase, and
-     * {@link PortletActionConstants#ACTION_PHASE} in the event phase.
+     * {@link PortletActionConstants#EVENT_PHASE} in the event phase.
      */
     public static Integer getPhase() {
         return (Integer) getContext().get(PHASE);
@@ -153,21 +169,14 @@ public class PortletActionContext {
      * @return <code>true</code> if the Portlet is executing in render phase.
      */
     public static boolean isRender() {
-        return RENDER_PHASE.equals(getPhase());
+        return PortletActionConstants.RENDER_PHASE.equals(getPhase());
     }
 
     /**
      * @return <code>true</code> if the Portlet is executing in the event phase.
      */
-    public static boolean isAction() {
-        return ACTION_PHASE.equals(getPhase());
-    }
-
-    /**
-     * @return <code>true</code> if the Portlet is executing in the resource phase.
-     */
-    public static boolean isResource() {
-        return SERVE_RESOURCE_PHASE.equals(getPhase());
+    public static boolean isEvent() {
+        return PortletActionConstants.EVENT_PHASE.equals(getPhase());
     }
 
     /**
@@ -211,18 +220,22 @@ public class PortletActionContext {
     public static PortletContext getPortletContext() {
     	return (PortletContext)getContext().get(StrutsStatics.STRUTS_PORTLET_CONTEXT);
     }
-
-	public static boolean isEvent() {
-		return EVENT_PHASE.equals(getPhase());
-	}
-
+    
+    /**
+     * Convenience setter for the portlet context.
+     * @param context
+     */
+    public static void setPortletContext(PortletContext context) {
+    	getContext().put(StrutsStatics.STRUTS_PORTLET_CONTEXT, context);
+    }
+    
     /**
-     * Whether JSR286 features are supported.
+     * Gets the action mapping for this context
      *
-     * @return <code>true</code> if {@link javax.portlet.PortletContext#getMajorVersion()} returns a value greater than 1
+     * @return The action mapping
      */
-    public static boolean isJSR268Supported() {
-        return getPortletContext().getMajorVersion() > 1;
+    public static ActionMapping getActionMapping() {
+        return (ActionMapping) getContext().get(ACTION_MAPPING);
     }
 
 }

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.dispatcher;
 
 import com.opensymphony.xwork2.Action;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/DispatcherServlet.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/DispatcherServlet.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/DispatcherServlet.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/DispatcherServlet.java Sun Jun 26 08:30:00 2011
@@ -18,18 +18,18 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.dispatcher;
 
-import java.io.IOException;
+import org.apache.commons.lang.StringUtils;
+import org.apache.struts2.dispatcher.StrutsRequestWrapper;
+import org.apache.struts2.portlet.PortletActionConstants;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.struts2.dispatcher.StrutsRequestWrapper;
-import org.apache.struts2.portlet.PortletActionConstants;
+import java.io.IOException;
 
 public class DispatcherServlet extends HttpServlet implements PortletActionConstants {
 

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java Sun Jun 26 08:30:00 2011
@@ -21,21 +21,8 @@
 
 package org.apache.struts2.portlet.dispatcher;
 
-import static org.apache.struts2.portlet.PortletConstants.ACTION_PARAM;
-import static org.apache.struts2.portlet.PortletConstants.ACTION_PHASE;
-import static org.apache.struts2.portlet.PortletConstants.ACTION_RESET;
-import static org.apache.struts2.portlet.PortletConstants.DEFAULT_ACTION_FOR_MODE;
-import static org.apache.struts2.portlet.PortletConstants.DEFAULT_ACTION_NAME;
-import static org.apache.struts2.portlet.PortletConstants.MODE_NAMESPACE_MAP;
-import static org.apache.struts2.portlet.PortletConstants.MODE_PARAM;
-import static org.apache.struts2.portlet.PortletConstants.PHASE;
-import static org.apache.struts2.portlet.PortletConstants.PORTLET_CONFIG;
-import static org.apache.struts2.portlet.PortletConstants.PORTLET_NAMESPACE;
-import static org.apache.struts2.portlet.PortletConstants.RENDER_PHASE;
-import static org.apache.struts2.portlet.PortletConstants.REQUEST;
-import static org.apache.struts2.portlet.PortletConstants.RESPONSE;
-
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Locale;
@@ -56,7 +43,6 @@ import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.commons.lang.StringUtils;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsException;
 import org.apache.struts2.StrutsStatics;
@@ -76,6 +62,7 @@ import org.apache.struts2.portlet.servle
 import org.apache.struts2.portlet.servlet.PortletServletRequest;
 import org.apache.struts2.portlet.servlet.PortletServletResponse;
 import org.apache.struts2.util.AttributeMap;
+import org.apache.commons.lang.StringUtils;
 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionProxy;
@@ -177,7 +164,8 @@ import com.opensymphony.xwork2.util.logg
  * <!-- END SNIPPET: example -->
  * </pre>
  */
-public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics {
+public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
+        PortletActionConstants {
 
     private static final Logger LOG = LoggerFactory.getLogger(Jsr168Dispatcher.class);
 
@@ -187,12 +175,12 @@ public class Jsr168Dispatcher extends Ge
 
     private Map<PortletMode,ActionMapping> actionMap = new HashMap<PortletMode,ActionMapping>(3);
 
-    String portletNamespace = null;
+    private String portletNamespace = null;
 
     private Dispatcher dispatcherUtils;
-
+    
     private ActionMapper actionMapper;
-
+    
     private Container container;
 
     /**
@@ -201,17 +189,17 @@ public class Jsr168Dispatcher extends Ge
     public void init(PortletConfig cfg) throws PortletException {
         super.init(cfg);
         if (LOG.isDebugEnabled()) LOG.debug("Initializing portlet " + getPortletName());
-
+        
         Map<String,String> params = new HashMap<String,String>();
         for (Enumeration e = cfg.getInitParameterNames(); e.hasMoreElements(); ) {
             String name = (String) e.nextElement();
             String value = cfg.getInitParameter(name);
             params.put(name, value);
         }
-
+        
         dispatcherUtils = new Dispatcher(new PortletServletContext(cfg.getPortletContext()), params);
         dispatcherUtils.init();
-
+        
         // For testability
         if (factory == null) {
             factory = dispatcherUtils.getConfigurationManager().getConfiguration().getContainer().getInstance(ActionProxyFactory.class);
@@ -245,7 +233,7 @@ public class Jsr168Dispatcher extends Ge
         if ("true".equalsIgnoreCase(container.getInstance(String.class, StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD))) {
             FileManager.setReloadingConfigs(true);
         }
-
+        
         actionMapper = container.getInstance(ActionMapper.class);
     }
 
@@ -309,7 +297,7 @@ public class Jsr168Dispatcher extends Ge
         try {
             serviceAction(request, response, getRequestMap(request), getParameterMap(request),
                     getSessionMap(request), getApplicationMap(),
-                    portletNamespace, ACTION_PHASE);
+                    portletNamespace, EVENT_PHASE);
             if (LOG.isDebugEnabled()) LOG.debug("Leaving processAction");
         } finally {
             ActionContext.setContext(null);
@@ -344,10 +332,10 @@ public class Jsr168Dispatcher extends Ge
     /**
      *  Reset the action context.
      */
-    void resetActionContext() {
+    private void resetActionContext() {
         ActionContext.setContext(null);
     }
-
+    
     /**
      * Merges all application and portlet attributes into a single
      * <tt>HashMap</tt> to represent the entire <tt>Action</tt> context.
@@ -369,7 +357,7 @@ public class Jsr168Dispatcher extends Ge
 
         // TODO Must put http request/response objects into map for use with
     	container.inject(servletRequest);
-
+    	
         // ServletActionContext
         HashMap<String, Object> extraContext = new HashMap<String, Object>();
         // The dummy servlet objects. Eases reuse of existing interceptors that uses the servlet objects.
@@ -437,8 +425,8 @@ public class Jsr168Dispatcher extends Ge
         try {
             ServletContext servletContext = new PortletServletContext(getPortletContext());
             HttpServletRequest servletRequest = new PortletServletRequest(request, getPortletContext());
-            HttpServletResponse servletResponse = createPortletServletResponse(response);
-            if(ACTION_PHASE.equals(phase)) {
+            HttpServletResponse servletResponse = new PortletServletResponse(response);
+            if(EVENT_PHASE.equals(phase)) {
             	servletRequest = dispatcherUtils.wrapRequest(servletRequest, servletContext);
         		if(servletRequest instanceof MultiPartRequestWrapper) {
         			// Multipart request. Request parameters are encoded in the multipart data,
@@ -454,8 +442,9 @@ public class Jsr168Dispatcher extends Ge
                     sessionMap, applicationMap, request, response, servletRequest, servletResponse,
                     servletContext, getPortletConfig(), phase);
             extraContext.put(PortletActionConstants.ACTION_MAPPING, mapping);
-            LOG.debug("Creating action proxy for name = " + actionName
-                    + ", namespace = " + namespace);
+            if (LOG.isDebugEnabled()) {
+        	LOG.debug("Creating action proxy for name = " + actionName + ", namespace = " + namespace);
+            }
             ActionProxy proxy = factory.createActionProxy(namespace,
                     actionName, mapping.getMethod(), extraContext);
             request.setAttribute("struts.valueStack", proxy.getInvocation()
@@ -473,7 +462,7 @@ public class Jsr168Dispatcher extends Ge
         }
     }
 
-    /**
+	/**
      * Returns a Map of all application attributes. Copies all attributes from
      * the {@link PortletActionContext}into an {@link ApplicationMap}.
      *
@@ -489,14 +478,12 @@ public class Jsr168Dispatcher extends Ge
      * <code>view</code>, and edit mode is mapped to the namespace
      * <code>edit</code>
      *
-     * @param portletRequest the PortletRequest object.
-     * @param servletRequest the ServletRequest to use
-     *
+     * @param request the PortletRequest object.
      * @return the namespace of the action.
      */
     protected ActionMapping getActionMapping(final PortletRequest portletRequest, final HttpServletRequest servletRequest) {
         ActionMapping mapping = null;
-        String actionPath = getDefaultActionPath(portletRequest);
+        String actionPath = null;
         if (resetAction(portletRequest)) {
             mapping = (ActionMapping) actionMap.get(portletRequest.getPortletMode());
         } else {
@@ -505,14 +492,14 @@ public class Jsr168Dispatcher extends Ge
                 mapping = (ActionMapping) actionMap.get(portletRequest
                         .getPortletMode());
             } else {
-
+                
                 // Use the usual action mapper, but it is expecting an action extension
                 // on the uri, so we add the default one, which should be ok as the
                 // portlet is a portlet first, a servlet second
                 mapping = actionMapper.getMapping(servletRequest, dispatcherUtils.getConfigurationManager());
             }
         }
-
+        
         if (mapping == null) {
             throw new StrutsException("Unable to locate action mapping for request, probably due to " +
                     "an invalid action path: "+actionPath);
@@ -520,10 +507,6 @@ public class Jsr168Dispatcher extends Ge
         return mapping;
     }
 
-    protected String getDefaultActionPath( PortletRequest portletRequest ) {
-        return null;
-    }
-
     /**
      * Get the namespace part of the action path.
      * @param actionPath Full path to action
@@ -627,7 +610,9 @@ public class Jsr168Dispatcher extends Ge
 
     public void destroy() {
         if (dispatcherUtils == null) {
-            LOG.warn("something is seriously wrong, DispatcherUtil is not initialized (null) ");
+            if (LOG.isWarnEnabled()) {
+        	LOG.warn("something is seriously wrong, DispatcherUtil is not initialized (null) ");
+            }
         } else {
             dispatcherUtils.cleanup();
         }
@@ -639,16 +624,5 @@ public class Jsr168Dispatcher extends Ge
     public void setActionMapper(ActionMapper actionMapper) {
         this.actionMapper = actionMapper;
     }
-
-    /**
-     * Method to create a PortletServletResponse matching the used Portlet API, to be overridden for JSR286 Dispatcher.
-     *
-     * @param response The Response used for building the wrapper.
-     *
-     * @return The wrapper response for Servlet bound usage.
-     */
-    protected PortletServletResponse createPortletServletResponse( PortletResponse response ) {
-        return new PortletServletResponse(response);
-    }
-
+    
 }

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletAwareInterceptor.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletAwareInterceptor.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletAwareInterceptor.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletAwareInterceptor.java Sun Jun 26 08:30:00 2011
@@ -18,8 +18,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.interceptor;
 
+import javax.portlet.PortletConfig;
 import javax.portlet.PortletContext;
 import javax.portlet.PortletRequest;
 import javax.portlet.PortletResponse;
@@ -68,12 +70,18 @@ public class PortletAwareInterceptor ext
             PortletContext portletContext = (PortletContext) context.get(STRUTS_PORTLET_CONTEXT);
             ((PortletContextAware) action).setPortletContext(portletContext);
         }
+        if (action instanceof PortletConfigAware) {
+        	PortletConfig portletConfig = (PortletConfig)context.get(PORTLET_CONFIG);
+        	((PortletConfigAware) action).setPortletConfig(portletConfig);
+        }
         if (action instanceof PortletPreferencesAware) {
         	PortletRequest request = (PortletRequest) context.get(REQUEST);
             
             // Check if running in a servlet environment
             if (request == null) {
-                LOG.warn("This portlet preferences implementation should only be used during development");
+                if (LOG.isWarnEnabled()) {
+                    LOG.warn("This portlet preferences implementation should only be used during development");
+                }
                 ((PortletPreferencesAware)action).setPortletPreferences(new ServletPortletPreferences(ActionContext.getContext().getSession()));
             } else {
             	((PortletPreferencesAware)action).setPortletPreferences(request.getPreferences());

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletContextAware.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletContextAware.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletContextAware.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletContextAware.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.interceptor;
 
 import javax.portlet.PortletContext;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletPreferencesAware.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletPreferencesAware.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletPreferencesAware.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletPreferencesAware.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.interceptor;
 
 import javax.portlet.PortletPreferences;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletPrincipalProxy.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletPrincipalProxy.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletPrincipalProxy.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletPrincipalProxy.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.interceptor;
 
 import org.apache.struts2.interceptor.PrincipalProxy;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletRequestAware.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletRequestAware.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletRequestAware.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletRequestAware.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.interceptor;
 
 import javax.portlet.PortletRequest;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletResponseAware.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletResponseAware.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletResponseAware.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletResponseAware.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.interceptor;
 
 import javax.portlet.PortletResponse;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptor.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptor.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptor.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/PortletStateInterceptor.java Sun Jun 26 08:30:00 2011
@@ -18,23 +18,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2.portlet.interceptor;
-
-import static org.apache.struts2.portlet.PortletConstants.ACTION_PHASE;
-import static org.apache.struts2.portlet.PortletConstants.EVENT_ACTION;
-import static org.apache.struts2.portlet.PortletConstants.PHASE;
-import static org.apache.struts2.portlet.PortletConstants.RENDER_PHASE;
-import static org.apache.struts2.portlet.PortletConstants.REQUEST;
-import static org.apache.struts2.portlet.PortletConstants.RESPONSE;
-import static org.apache.struts2.portlet.PortletConstants.STACK_FROM_EVENT_PHASE;
-
-import java.util.Map;
 
-import javax.portlet.ActionResponse;
-import javax.portlet.RenderRequest;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.struts2.portlet.dispatcher.DirectRenderFromEventAction;
+package org.apache.struts2.portlet.interceptor;
 
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
@@ -42,8 +27,15 @@ import com.opensymphony.xwork2.util.Comp
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.logging.Logger;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
+import org.apache.commons.lang.StringUtils;
+import org.apache.struts2.portlet.PortletActionConstants;
+import org.apache.struts2.portlet.dispatcher.DirectRenderFromEventAction;
+
+import javax.portlet.ActionResponse;
+import javax.portlet.RenderRequest;
+import java.util.Map;
 
-public class PortletStateInterceptor extends AbstractInterceptor {
+public class PortletStateInterceptor extends AbstractInterceptor implements PortletActionConstants {
 
 	private final static Logger LOG = LoggerFactory.getLogger(PortletStateInterceptor.class);
 
@@ -55,7 +47,7 @@ public class PortletStateInterceptor ext
 		if (RENDER_PHASE.equals(phase)) {
 			restoreStack(invocation);
 			return invocation.invoke();
-		} else if (ACTION_PHASE.equals(phase)) {
+		} else if (EVENT_PHASE.equals(phase)) {
 			try {
 				return invocation.invoke();
 			} finally {
@@ -86,7 +78,7 @@ public class PortletStateInterceptor ext
 					CompoundRoot oldRoot = oldStack.getRoot();
 					ValueStack currentStack = invocation.getStack();
 					CompoundRoot root = currentStack.getRoot();
-					root.addAll(oldRoot);
+					root.addAll(0, oldRoot);
 					if (LOG.isDebugEnabled()) LOG.debug("Restored stack");
 				}
 			}

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/ServletPortletPreferences.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/ServletPortletPreferences.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/ServletPortletPreferences.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/interceptor/ServletPortletPreferences.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.interceptor;
 
 import java.io.IOException;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletActionRedirectResult.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.result;
 
 import java.util.Arrays;
@@ -35,15 +36,19 @@ import org.apache.struts2.portlet.Portle
 import org.apache.struts2.views.util.UrlHelper;
 
 import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.util.reflection.ReflectionExceptionHandler;
+import com.opensymphony.xwork2.util.reflection.ReflectionException;
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
 import com.opensymphony.xwork2.config.entities.ResultConfig;
 import com.opensymphony.xwork2.inject.Inject;
 
 /**
- * 
+ *
  * Portlet modification of the {@link ServletActionRedirectResult}.
- * 
+ *
  * <!-- START SNIPPET: description -->
- * 
+ *
  * This result uses the {@link ActionMapper} provided by the
  * {@link ActionMapperFactory} to instruct the render phase to invoke the
  * specified action and (optional) namespace. This is better than the
@@ -53,63 +58,63 @@ import com.opensymphony.xwork2.inject.In
  * and your application will still work. It is strongly recommended that if you
  * are redirecting to another action, you use this result rather than the
  * standard redirect result.
- * 
+ *
  * See examples below for an example of how request parameters could be passed
  * in.
- * 
+ *
  * <!-- END SNIPPET: description -->
- * 
+ *
  * <b>This result type takes the following parameters:</b>
- * 
+ *
  * <!-- START SNIPPET: params -->
- * 
+ *
  * <ul>
- * 
+ *
  * <li><b>actionName (default)</b> - the name of the action that will be
  * redirect to</li>
- * 
+ *
  * <li><b>namespace</b> - used to determine which namespace the action is in
  * that we're redirecting to . If namespace is null, this defaults to the
  * current namespace</li>
- * 
+ *
  * </ul>
- * 
+ *
  * <!-- END SNIPPET: params -->
- * 
+ *
  * <b>Example:</b>
- * 
+ *
  * <pre>
  * &lt;!-- START SNIPPET: example --&gt;
  *  &lt;package name=&quot;public&quot; extends=&quot;struts-default&quot;&gt;
  *      &lt;action name=&quot;login&quot; class=&quot;...&quot;&gt;
  *          &lt;!-- Redirect to another namespace --&gt;
- *          &lt;result type=&quot;redirect-action&quot;&gt;
+ *          &lt;result type=&quot;redirectAction&quot;&gt;
  *              &lt;param name=&quot;actionName&quot;&gt;dashboard&lt;/param&gt;
  *              &lt;param name=&quot;namespace&quot;&gt;/secure&lt;/param&gt;
  *          &lt;/result&gt;
  *      &lt;/action&gt;
  *  &lt;/package&gt;
- * 
+ *
  *  &lt;package name=&quot;secure&quot; extends=&quot;struts-default&quot; namespace=&quot;/secure&quot;&gt;
  *      &lt;-- Redirect to an action in the same namespace --&gt;
  *      &lt;action name=&quot;dashboard&quot; class=&quot;...&quot;&gt;
  *          &lt;result&gt;dashboard.jsp&lt;/result&gt;
- *          &lt;result name=&quot;error&quot; type=&quot;redirect-action&quot;&gt;error&lt;/result&gt;
+ *          &lt;result name=&quot;error&quot; type=&quot;redirectAction&quot;&gt;error&lt;/result&gt;
  *      &lt;/action&gt;
- * 
+ *
  *      &lt;action name=&quot;error&quot; class=&quot;...&quot;&gt;
  *          &lt;result&gt;error.jsp&lt;/result&gt;
  *      &lt;/action&gt;
  *  &lt;/package&gt;
- * 
+ *
  *  &lt;package name=&quot;passingRequestParameters&quot; extends=&quot;struts-default&quot; namespace=&quot;/passingRequestParameters&quot;&gt;
  *     &lt;-- Pass parameters (reportType, width and height) --&gt;
  *     &lt;!--
- *     The redirect-action url generated will be :
+ *     The redirectAction url generated will be :
  *     /genReport/generateReport.action?reportType=pie&amp;width=100&amp;height=100
  *     --&gt;
  *     &lt;action name=&quot;gatherReportInfo&quot; class=&quot;...&quot;&gt;
- *        &lt;result name=&quot;showReportResult&quot; type=&quot;redirect-action&quot;&gt;
+ *        &lt;result name=&quot;showReportResult&quot; type=&quot;redirectAction&quot;&gt;
  *           &lt;param name=&quot;actionName&quot;&gt;generateReport&lt;/param&gt;
  *           &lt;param name=&quot;namespace&quot;&gt;/genReport&lt;/param&gt;
  *           &lt;param name=&quot;reportType&quot;&gt;pie&lt;/param&gt;
@@ -118,18 +123,20 @@ import com.opensymphony.xwork2.inject.In
  *        &lt;/result&gt;
  *     &lt;/action&gt;
  *  &lt;/package&gt;
- * 
- * 
+ *
+ *
  *  &lt;!-- END SNIPPET: example --&gt;
  * </pre>
- * 
+ *
  * @see ActionMapper
  */
-public class PortletActionRedirectResult extends PortletResult {
+public class PortletActionRedirectResult extends PortletResult implements ReflectionExceptionHandler {
 
 	private static final long serialVersionUID = -7627388936683562557L;
 
-	/** The default parameter */
+    private static final Logger LOG = LoggerFactory.getLogger(PortletActionRedirectResult.class);
+
+    /** The default parameter */
 	public static final String DEFAULT_PARAM = "actionName";
 
 	protected String actionName;
@@ -174,7 +181,6 @@ public class PortletActionRedirectResult
 	 */
 	public void execute(ActionInvocation invocation) throws Exception {
 		actionName = conditionalParse(actionName, invocation);
-		String portletNamespace = (String)invocation.getInvocationContext().get(PortletActionConstants.PORTLET_NAMESPACE);
 		if (portletMode != null) {
 			Map<PortletMode, String> namespaceMap = (Map<PortletMode, String>) invocation.getInvocationContext().get(
 					PortletActionConstants.MODE_NAMESPACE_MAP);
@@ -205,7 +211,7 @@ public class PortletActionRedirectResult
 		}
 
 		StringBuilder tmpLocation = new StringBuilder(actionMapper.getUriFromActionMapping(new ActionMapping(actionName,
-				(portletNamespace == null ? namespace : portletNamespace + namespace), method, null)));
+                namespace, method, null)));
 		UrlHelper.buildParametersString(requestParameters, tmpLocation, "&");
 
 		setLocation(tmpLocation.toString());
@@ -215,7 +221,7 @@ public class PortletActionRedirectResult
 
 	/**
 	 * Sets the action name
-	 * 
+	 *
 	 * @param actionName
 	 *            The name
 	 */
@@ -225,7 +231,7 @@ public class PortletActionRedirectResult
 
 	/**
 	 * Sets the namespace
-	 * 
+	 *
 	 * @param namespace
 	 *            The namespace
 	 */
@@ -235,7 +241,7 @@ public class PortletActionRedirectResult
 
 	/**
 	 * Sets the method
-	 * 
+	 *
 	 * @param method
 	 *            The method
 	 */
@@ -245,7 +251,7 @@ public class PortletActionRedirectResult
 
 	/**
 	 * Adds a request parameter to be added to the redirect url
-	 * 
+	 *
 	 * @param key
 	 *            The parameter name
 	 * @param value
@@ -256,4 +262,8 @@ public class PortletActionRedirectResult
 		return this;
 	}
 
+    public void handle(ReflectionException ex) {
+        // Only log as debug as they are probably parameters to be appended to the url
+        if (LOG.isDebugEnabled()) LOG.debug(ex.getMessage(), ex);
+    }
 }

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResult.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResult.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResult.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResult.java Sun Jun 26 08:30:00 2011
@@ -18,45 +18,44 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.result;
 
-import java.io.IOException;
-import java.util.Map;
-import java.util.StringTokenizer;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
+import org.apache.commons.lang.StringUtils;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.dispatcher.StrutsResultSupport;
+import org.apache.struts2.portlet.PortletActionConstants;
+import org.apache.struts2.portlet.context.PortletActionContext;
 
+import javax.portlet.ActionResponse;
 import javax.portlet.PortletContext;
 import javax.portlet.PortletException;
 import javax.portlet.PortletMode;
-import javax.portlet.PortletRequest;
 import javax.portlet.PortletRequestDispatcher;
-import javax.portlet.PortletResponse;
+import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.struts2.ServletActionContext;
-import org.apache.struts2.dispatcher.StrutsResultSupport;
-import org.apache.struts2.portlet.PortletActionConstants;
-import org.apache.struts2.portlet.context.PortletActionContext;
-
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.logging.Logger;
-import com.opensymphony.xwork2.util.logging.LoggerFactory;
+import java.io.IOException;
+import java.util.Map;
+import java.util.StringTokenizer;
 
 /**
  * Result type that includes a JSP to render.
- *
+ * 
  */
 public class PortletResult extends StrutsResultSupport implements PortletActionConstants {
 
 	private static final long serialVersionUID = 434251393926178567L;
 
 	private boolean useDispatcherServlet;
-
+	
 	private String dispatcherServletName = DEFAULT_DISPATCHER_SERVLET_NAME;
 
 	/**
@@ -67,41 +66,29 @@ public class PortletResult extends Strut
 	private String contentType = "text/html";
 
 	private String title;
-
+	
 	protected PortletMode portletMode;
 
-    PortletResultHelper resultHelper;
-
 	public PortletResult() {
 		super();
-        determineResultHelper();
 	}
 
 	public PortletResult(String location) {
 		super(location);
-        determineResultHelper();
 	}
 
-    private void determineResultHelper() {
-        if (PortletActionContext.isJSR268Supported()) {
-            this.resultHelper = new PortletResultHelperJSR286();
-        } else {
-            this.resultHelper = new PortletResultHelperJSR168();
-        }
-    }
-
 	/**
 	 * Execute the result. Obtains the
 	 * {@link javax.portlet.PortletRequestDispatcher}from the
 	 * {@link PortletActionContext}and includes the JSP.
-	 *
+	 * 
 	 * @see com.opensymphony.xwork2.Result#execute(com.opensymphony.xwork2.ActionInvocation)
 	 */
 	public void doExecute(String finalLocation, ActionInvocation actionInvocation) throws Exception {
 
-		if (PortletActionContext.isRender() || PortletActionContext.isResource()) {
-			executeMimeResult(finalLocation);
-		} else if (PortletActionContext.isAction() || PortletActionContext.isEvent()) {
+		if (PortletActionContext.isRender()) {
+			executeRenderResult(finalLocation);
+		} else if (PortletActionContext.isEvent()) {
 			executeActionResult(finalLocation, actionInvocation);
 		} else {
 			executeRegularServletResult(finalLocation, actionInvocation);
@@ -110,7 +97,7 @@ public class PortletResult extends Strut
 
 	/**
 	 * Executes the regular servlet result.
-	 *
+	 * 
 	 * @param finalLocation
 	 * @param actionInvocation
 	 */
@@ -132,91 +119,95 @@ public class PortletResult extends Strut
 
 	/**
 	 * Executes the action result.
-	 *
+	 * 
 	 * @param finalLocation
 	 * @param invocation
 	 */
 	protected void executeActionResult(String finalLocation, ActionInvocation invocation) throws Exception {
-        String phase = (PortletActionContext.isEvent()) ? "Event" : "Action";
-		if (LOG.isDebugEnabled()) LOG.debug("Executing result in "+phase+" phase");
+		if (LOG.isDebugEnabled()) LOG.debug("Executing result in Event phase");
+		ActionResponse res = PortletActionContext.getActionResponse();
 		Map sessionMap = invocation.getInvocationContext().getSession();
 		if (LOG.isDebugEnabled()) LOG.debug("Setting event render parameter: " + finalLocation);
 		if (finalLocation.indexOf('?') != -1) {
-			convertQueryParamsToRenderParams(finalLocation.substring(finalLocation.indexOf('?') + 1));
+			convertQueryParamsToRenderParams(res, finalLocation.substring(finalLocation.indexOf('?') + 1));
 			finalLocation = finalLocation.substring(0, finalLocation.indexOf('?'));
 		}
-        PortletResponse response = PortletActionContext.getResponse();
 		if (finalLocation.endsWith(".action")) {
 			// View is rendered with a view action...luckily...
 			finalLocation = finalLocation.substring(0, finalLocation.lastIndexOf("."));
-			resultHelper.setRenderParameter(response, ACTION_PARAM, finalLocation);
+			res.setRenderParameter(ACTION_PARAM, finalLocation);
 		} else {
 			// View is rendered outside an action...uh oh...
-			resultHelper.setRenderParameter(response, ACTION_PARAM, "renderDirect");
+            String namespace = invocation.getProxy().getNamespace();
+            if ( namespace != null && namespace.length() > 0 && !namespace.endsWith("/")) {
+                namespace += "/";
+                
+            }
+            res.setRenderParameter(ACTION_PARAM, namespace + "renderDirect");
 			sessionMap.put(RENDER_DIRECT_LOCATION, finalLocation);
 		}
 		if(portletMode != null) {
-			resultHelper.setPortletMode(response, portletMode);
-			resultHelper.setRenderParameter(response, PortletActionConstants.MODE_PARAM, portletMode.toString());
+			res.setPortletMode(portletMode);
+			res.setRenderParameter(PortletActionConstants.MODE_PARAM, portletMode.toString());
 		}
 		else {
-			resultHelper.setRenderParameter(response, PortletActionConstants.MODE_PARAM, PortletActionContext.getRequest().getPortletMode()
+			res.setRenderParameter(PortletActionConstants.MODE_PARAM, PortletActionContext.getRequest().getPortletMode()
 					.toString());
 		}
 	}
 
 	/**
 	 * Converts the query params to render params.
-	 *
+	 * 
 	 * @param response
 	 * @param queryParams
 	 */
-	protected void convertQueryParamsToRenderParams(String queryParams) {
+	protected static void convertQueryParamsToRenderParams(ActionResponse response, String queryParams) {
 		StringTokenizer tok = new StringTokenizer(queryParams, "&");
 		while (tok.hasMoreTokens()) {
 			String token = tok.nextToken();
 			String key = token.substring(0, token.indexOf('='));
 			String value = token.substring(token.indexOf('=') + 1);
-			resultHelper.setRenderParameter(PortletActionContext.getResponse(), key, value);
+			response.setRenderParameter(key, value);
 		}
 	}
 
-    /**
-     * Executes the render result.
-     *
-     * @param finalLocation
-     * @throws PortletException
-     * @throws IOException
-     */
-    protected void executeMimeResult(final String finalLocation) throws PortletException, IOException {
-        if (LOG.isDebugEnabled()) LOG.debug("Executing mime result");
-        PortletContext ctx = PortletActionContext.getPortletContext();
-        PortletRequest req = PortletActionContext.getRequest();
-        PortletResponse res = PortletActionContext.getResponse();
-
-		if (StringUtils.isNotEmpty(title) && res instanceof RenderResponse) {
-		    ((RenderResponse)res).setTitle(title);
-		}
-        if (LOG.isDebugEnabled()) LOG.debug("Location: " + finalLocation);
-        PortletRequestDispatcher dispatcher;
-        if (useDispatcherServlet) {
-            req.setAttribute(DISPATCH_TO, finalLocation);
-            dispatcher = ctx.getNamedDispatcher(dispatcherServletName);
-            if(dispatcher == null) {
-                throw new PortletException("Could not locate dispatcher servlet \"" + dispatcherServletName + "\". Please configure it in your web.xml file");
-            }
-        } else {
-            dispatcher = ctx.getRequestDispatcher(finalLocation);
-            if (dispatcher == null) {
-                throw new PortletException("Could not locate dispatcher for '" + finalLocation + "'");
-            }
-        }
-        resultHelper.include( dispatcher, contentType, req, res );
-    }
+	/**
+	 * Executes the render result.
+	 * 
+	 * @param finalLocation
+	 * @throws PortletException
+	 * @throws IOException
+	 */
+	protected void executeRenderResult(final String finalLocation) throws PortletException, IOException {
+		if (LOG.isDebugEnabled()) LOG.debug("Executing result in Render phase");
+		PortletContext ctx = PortletActionContext.getPortletContext();
+		RenderRequest req = PortletActionContext.getRenderRequest();
+		RenderResponse res = PortletActionContext.getRenderResponse();
+		res.setContentType(contentType);
+		if (StringUtils.isNotEmpty(title)) {
+			res.setTitle(title);
+		}
+		if (LOG.isDebugEnabled()) LOG.debug("Location: " + finalLocation);
+		if (useDispatcherServlet) {
+			req.setAttribute(DISPATCH_TO, finalLocation);
+			PortletRequestDispatcher dispatcher = ctx.getNamedDispatcher(dispatcherServletName);
+			if(dispatcher == null) {
+				throw new PortletException("Could not locate dispatcher servlet \"" + dispatcherServletName + "\". Please configure it in your web.xml file");
+			}
+			dispatcher.include(req, res);
+		} else {
+			PortletRequestDispatcher dispatcher = ctx.getRequestDispatcher(finalLocation);
+			if (dispatcher == null) {
+				throw new PortletException("Could not locate dispatcher for '" + finalLocation + "'");
+			}
+			dispatcher.include(req, res);
+		}
+	}
 
 	/**
 	 * Sets the content type.
-	 *
+	 * 
 	 * @param contentType
 	 *            The content type to set.
 	 */
@@ -226,25 +217,25 @@ public class PortletResult extends Strut
 
 	/**
 	 * Sets the title.
-	 *
+	 * 
 	 * @param title
 	 *            The title to set.
 	 */
 	public void setTitle(String title) {
 		this.title = title;
 	}
-
+	
 	public void setPortletMode(String portletMode) {
 		if(portletMode != null) {
 			this.portletMode = new PortletMode(portletMode);
 		}
 	}
 
-	@Inject("struts.portlet.useDispatcherServlet")
+	@Inject("struts.portlet.useDispatcherServlet") 
 	public void setUseDispatcherServlet(String useDispatcherServlet) {
 		this.useDispatcherServlet = "true".equalsIgnoreCase(useDispatcherServlet);
 	}
-
+	
 	@Inject("struts.portlet.dispatcherServletName")
 	public void setDispatcherServletName(String dispatcherServletName) {
 		this.dispatcherServletName = dispatcherServletName;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletVelocityResult.java Sun Jun 26 08:30:00 2011
@@ -18,19 +18,15 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.struts2.portlet.result;
 
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
-import javax.portlet.ActionResponse;
-import javax.servlet.Servlet;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.JspFactory;
-import javax.servlet.jsp.PageContext;
+package org.apache.struts2.portlet.result;
 
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.ValueStack;
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.dispatcher.StrutsResultSupport;
@@ -42,12 +38,15 @@ import org.apache.velocity.Template;
 import org.apache.velocity.app.VelocityEngine;
 import org.apache.velocity.context.Context;
 
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.ValueStack;
-import com.opensymphony.xwork2.util.logging.Logger;
-import com.opensymphony.xwork2.util.logging.LoggerFactory;
+import javax.portlet.ActionResponse;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.JspFactory;
+import javax.servlet.jsp.PageContext;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
 
 /**
  * <!-- START SNIPPET: description -->
@@ -96,7 +95,7 @@ public class PortletVelocityResult exten
     private String defaultEncoding;
     private VelocityManager velocityManager;
     private JspFactory jspFactory = JspFactory.getDefaultFactory();
-    
+
     public PortletVelocityResult() {
         super();
     }
@@ -120,7 +119,7 @@ public class PortletVelocityResult exten
      */
     public void doExecute(String location, ActionInvocation invocation)
             throws Exception {
-        if (PortletActionContext.isAction()) {
+        if (PortletActionContext.isEvent()) {
             executeActionResult(location, invocation);
         } else if (PortletActionContext.isRender()) {
             executeRenderResult(location, invocation);
@@ -137,8 +136,12 @@ public class PortletVelocityResult exten
             ActionInvocation invocation) {
         ActionResponse res = PortletActionContext.getActionResponse();
         // View is rendered outside an action...uh oh...
-        res.setRenderParameter(PortletActionConstants.ACTION_PARAM,
-                "freemarkerDirect");
+        String namespace = invocation.getProxy().getNamespace();
+        if ( namespace != null && namespace.length() > 0 && !namespace.endsWith("/")) {
+            namespace += "/";
+
+        }
+        res.setRenderParameter(PortletActionConstants.ACTION_PARAM, namespace + "freemarkerDirect");
         res.setRenderParameter("location", location);
         res.setRenderParameter(PortletActionConstants.MODE_PARAM, PortletActionContext
                 .getRequest().getPortletMode().toString());

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletHttpSession.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletHttpSession.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletHttpSession.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletHttpSession.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.servlet;
 
 import java.util.ArrayList;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletConfig.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletConfig.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletConfig.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletConfig.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.servlet;
 
 import java.util.Enumeration;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletContext.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.servlet;
 
 import java.io.InputStream;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletInputStream.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.servlet;
 
 import java.io.IOException;

Modified: struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java?rev=1139729&r1=1139728&r2=1139729&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java (original)
+++ struts/struts2/trunk/plugins/portlet/src/main/java/org/apache/struts2/portlet/servlet/PortletServletOutputStream.java Sun Jun 26 08:30:00 2011
@@ -18,6 +18,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.struts2.portlet.servlet;
 
 import java.io.IOException;