Author: phuong_vu
Date: 2011-11-30 03:41:18 -0500 (Wed, 30 Nov 2011)
New Revision: 8163
Added:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/RequestNavigationData.java
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
GTNPORTAL-2303 Navigation controller cannot use path as query parameter
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-11-30
08:05:26 UTC (rev 8162)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-11-30
08:41:18 UTC (rev 8163)
@@ -35,9 +35,6 @@
import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.mop.user.UserPortalContext;
-import org.exoplatform.web.url.navigation.NodeURL;
-import org.exoplatform.web.url.navigation.NavigationResource;
-import org.exoplatform.web.url.URLFactoryService;
import org.exoplatform.portal.url.PortalURLContext;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
@@ -50,15 +47,17 @@
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.web.application.URLBuilder;
import org.exoplatform.web.url.PortalURL;
+import org.exoplatform.web.url.ResourceType;
import org.exoplatform.web.url.URLFactory;
-import org.exoplatform.web.url.ResourceType;
+import org.exoplatform.web.url.URLFactoryService;
+import org.exoplatform.web.url.navigation.NavigationResource;
+import org.exoplatform.web.url.navigation.NodeURL;
import org.exoplatform.webui.application.WebuiApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.url.ComponentURL;
import org.gatein.common.http.QueryStringParser;
import org.w3c.dom.Element;
-
import java.io.IOException;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
@@ -71,7 +70,6 @@
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
-
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@@ -697,4 +695,11 @@
return Util.getPortalRequestContext().getLocale();
}
};
+
+ public RequestNavigationData getNavigationData()
+ {
+ return new
RequestNavigationData(controllerContext.getParameter(RequestNavigationData.REQUEST_SITE_TYPE),
+ controllerContext.getParameter(RequestNavigationData.REQUEST_SITE_NAME),
+ controllerContext.getParameter(RequestNavigationData.REQUEST_PATH));
+ }
}
Added:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/RequestNavigationData.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/RequestNavigationData.java
(rev 0)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/RequestNavigationData.java 2011-11-30
08:41:18 UTC (rev 8163)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.portal.application;
+
+import org.exoplatform.web.controller.QualifiedName;
+
+/**
+* @author <a href="hoang281283(a)gmail.com">Minh Hoang TO</a>
+* @date 11/4/11
+*/
+public class RequestNavigationData
+{
+ public final static QualifiedName REQUEST_PATH = QualifiedName.create("gtn",
"path");
+
+ public final static QualifiedName REQUEST_SITE_TYPE =
QualifiedName.create("gtn", "sitetype");
+
+ public final static QualifiedName REQUEST_SITE_NAME =
QualifiedName.create("gtn", "sitename");
+
+ protected final String siteType;
+
+ protected final String siteName;
+
+ protected final String path;
+
+ public RequestNavigationData(String siteType, String siteName, String path)
+ {
+ this.siteType = siteType != null? siteType : "";
+ this.siteName = siteName != null? siteName : "";
+ this.path = path != null? path : "";
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if(obj == null || !(obj instanceof RequestNavigationData))
+ {
+ return false;
+ }
+ else
+ {
+ RequestNavigationData data = (RequestNavigationData)obj;
+ return siteType.equals(data.siteType) && siteName.equals(data.siteName)
&& path.equals(data.path);
+ }
+ }
+}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-11-30
08:05:26 UTC (rev 8162)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-11-30
08:41:18 UTC (rev 8163)
@@ -86,7 +86,7 @@
targetNode = userPortal.resolvePath(navigation, null, nodePath);
if (targetNode != null)
{
- uiPortalApp.setLastRequestURI(null);
+ uiPortalApp.setLastRequestNavData(null);
pcontext.requestAuthenticationLogin();
return;
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2011-11-30
08:05:26 UTC (rev 8162)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2011-11-30
08:41:18 UTC (rev 8163)
@@ -22,6 +22,7 @@
import org.exoplatform.commons.utils.Safe;
import org.exoplatform.portal.Constants;
import org.exoplatform.portal.application.PortalRequestContext;
+import org.exoplatform.portal.application.RequestNavigationData;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfig;
import org.exoplatform.portal.config.model.Container;
@@ -103,8 +104,6 @@
private int modeState = NORMAL_MODE;
- private String lastRequestURI;
-
private Orientation orientation_ = Orientation.LT;
final static public String UI_WORKING_WS_ID = "UIWorkingWorkspace";
@@ -125,8 +124,10 @@
private boolean isAjaxInLastRequest;
- private String lastNonAjaxRequestUri;
+ private RequestNavigationData lastNonAjaxRequestNavData;
+ private RequestNavigationData lastRequestNavData;
+
private String lastPortal;
/**
@@ -300,9 +301,9 @@
return modeState;
}
- public void setLastRequestURI(String uri)
+ public void setLastRequestNavData(RequestNavigationData navData)
{
- this.lastRequestURI = uri;
+ this.lastRequestNavData = navData;
}
/**
@@ -536,7 +537,9 @@
public void processAction(WebuiRequestContext context) throws Exception
{
PortalRequestContext pcontext = (PortalRequestContext)context;
- String requestURI = pcontext.getRequestURI();
+ //String requestURI = pcontext.getRequestURI();
+ RequestNavigationData requestNavData = pcontext.getNavigationData();
+
boolean isAjax = pcontext.useAjax();
if (!isAjax)
@@ -544,21 +547,21 @@
if (isAjaxInLastRequest)
{
isAjaxInLastRequest = false;
- if (requestURI.equals(lastNonAjaxRequestUri) &&
!requestURI.equals(lastRequestURI))
+ if (requestNavData.equals(lastNonAjaxRequestNavData) &&
!requestNavData.equals(lastRequestNavData))
{
NodeURL nodeURL =
pcontext.createURL(NodeURL.TYPE).setNode(getCurrentSite().getSelectedUserNode());
pcontext.sendRedirect(nodeURL.toString());
return;
}
}
- lastNonAjaxRequestUri = requestURI;
+ lastNonAjaxRequestNavData = requestNavData;
}
isAjaxInLastRequest = isAjax;
- if (!requestURI.equals(lastRequestURI))
+ if (!requestNavData.equals(lastRequestNavData))
{
- lastRequestURI = requestURI;
+ lastRequestNavData = requestNavData;
StringBuilder js = new
StringBuilder("eXo.env.server.portalBaseURL=\"");
js.append(pcontext.getRequestURI()).append("\";\n");
@@ -577,7 +580,7 @@
if (!isAjax)
{
- lastNonAjaxRequestUri = requestURI;
+ lastNonAjaxRequestNavData = requestNavData;
}
if (pcontext.isResponseComplete())