You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by sm...@apache.org on 2007/12/21 01:14:24 UTC
svn commit: r606067 -
/portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/DesktopPortletContainerImpl.java
Author: smilek
Date: Thu Dec 20 16:14:22 2007
New Revision: 606067
URL: http://svn.apache.org/viewvc?rev=606067&view=rev
Log:
fix for JS2-827 http://issues.apache.org/jira/browse/JS2-827 - do not annotate form actions when form contains <input type=field/> element/s, and arrange for action request to be submitted so that it results in a true 302 redirect (same as /portal)
Modified:
portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/DesktopPortletContainerImpl.java
Modified: portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/DesktopPortletContainerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/DesktopPortletContainerImpl.java?rev=606067&r1=606066&r2=606067&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/DesktopPortletContainerImpl.java (original)
+++ portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/container/DesktopPortletContainerImpl.java Thu Dec 20 16:14:22 2007
@@ -85,6 +85,20 @@
HttpServletResponse servletResponse,
InternalActionResponse _actionResponse) throws IOException
{
+ String encoding = servletRequest.getParameter( JetspeedDesktop.DESKTOP_ENCODER_REQUEST_PARAMETER );
+ boolean requestHasDesktopEncoding = false;
+ boolean requestIsDesktopAjax = false;
+ if ( encoding != null && encoding.equals( JetspeedDesktop.DESKTOP_ENCODER_REQUEST_PARAMETER_VALUE ) )
+ { // used in cases where action request cannot be made via ajax (e.g. form has <input type=file/> element)
+ requestHasDesktopEncoding = true;
+ requestIsDesktopAjax = true;
+ String ajaxOverride = servletRequest.getParameter( JetspeedDesktop.DESKTOP_AJAX_REQUEST_PARAMETER );
+ if ( ajaxOverride != null && ajaxOverride.equals( "false" ) )
+ {
+ requestIsDesktopAjax = false;
+ }
+ }
+
if (location == null && _actionResponse != null)
{
DynamicInformationProvider provider = InformationProviderAccess
@@ -131,9 +145,15 @@
{
redirectURL.setSecure(); // TBD
}
+
+ if ( requestHasDesktopEncoding && ! requestIsDesktopAjax )
+ { // add parameter to tell DesktopEncodingPortalURL that it should not add extra desktop parameters (e.g. entity and portlet)
+ renderParameter.put( JetspeedDesktop.DESKTOP_REQUEST_NOT_AJAX_PARAMETER, Boolean.TRUE );
+ }
+
redirectURL.clearParameters();
redirectURL.setParameters(renderParameter);
-
+
location = servletResponse
.encodeRedirectURL(redirectURL.toString());
}
@@ -145,14 +165,13 @@
.getResponse();
}
- String encoding = servletRequest.getParameter( JetspeedDesktop.DESKTOP_ENCODER_REQUEST_PARAMETER );
- if ( encoding != null && encoding.equals( JetspeedDesktop.DESKTOP_ENCODER_REQUEST_PARAMETER_VALUE ) )
- {
+ if ( requestIsDesktopAjax )
+ { // no real redirect will occur; instead, return the redirect URL in the response body
location = location.replaceAll( this.desktopActionPipelinePath, this.desktopRenderPipelinePath );
redirectResponse.getWriter().print( location );
}
else
- {
+ { // do real redirect
location = location.replaceAll( this.desktopActionPipelinePath, this.desktopPipelinePath );
location = location.replaceAll( this.desktopRenderPipelinePath, this.desktopPipelinePath);
redirectResponse.sendRedirect(location);
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org