Author: ndkhoiits
Date: 2011-10-19 03:31:45 -0400 (Wed, 19 Oct 2011)
New Revision: 7785
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyRequestHandler.java
Log:
GTNPORTAL-2187 Should not indicate node path in the URL if a legacy request is used
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyRequestHandler.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyRequestHandler.java 2011-10-19
07:15:03 UTC (rev 7784)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyRequestHandler.java 2011-10-19
07:31:45 UTC (rev 7785)
@@ -19,11 +19,8 @@
package org.exoplatform.portal.application;
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfig;
import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.portal.mop.user.UserNavigation;
import org.exoplatform.portal.mop.user.UserNode;
@@ -91,55 +88,32 @@
{
String requestSiteName =
context.getParameter(PortalRequestHandler.REQUEST_SITE_NAME);
String requestPath = context.getParameter(PortalRequestHandler.REQUEST_PATH);
-
- // Resolve the user node
- UserPortalConfig cfg = userPortalService.getUserPortalConfig(requestSiteName,
context.getRequest().getRemoteUser(), userPortalContext);
- if (cfg == null)
- {
- HttpServletRequest req = context.getRequest();
- DataStorage storage =
(DataStorage)PortalContainer.getComponent(DataStorage.class);
- PortalConfig persistentPortalConfig =
storage.getPortalConfig(requestSiteName);
- if (persistentPortalConfig == null)
- {
- return false;
- }
- if(req.getRemoteUser() == null)
- {
- String doLoginPath = req.getContextPath() + "/" +
"dologin" + "?initialURI=" + req.getRequestURI();
- context.getResponse().sendRedirect(doLoginPath);
- }
- else
- {
- context.getResponse().sendError(HttpServletResponse.SC_FORBIDDEN);
- }
- return true;
- }
-
-
- UserPortal userPortal = cfg.getUserPortal();
- UserNodeFilterConfig.Builder builder =
UserNodeFilterConfig.builder().withAuthMode(UserNodeFilterConfig.AUTH_READ);
- UserNode userNode = userPortal.resolvePath(builder.build(), requestPath);
+ SiteKey siteKey = SiteKey.portal(requestSiteName);
+ String uri = requestPath;
- //
- SiteKey siteKey;
- String uri;
- if (userNode != null)
+ // Resolve the user node if node path is indicated
+ if (!requestPath.equals(""))
{
- siteKey = userNode.getNavigation().getKey();
- uri = userNode.getURI();
+ UserPortalConfig cfg = userPortalService.getUserPortalConfig(requestSiteName,
context.getRequest().getRemoteUser(), userPortalContext);
+ if (cfg != null)
+ {
+ UserPortal userPortal = cfg.getUserPortal();
+ UserNodeFilterConfig.Builder builder =
UserNodeFilterConfig.builder().withAuthMode(UserNodeFilterConfig.AUTH_READ);
+ UserNode userNode = userPortal.resolvePath(builder.build(), requestPath);
+
+ if (userNode != null)
+ {
+ siteKey = userNode.getNavigation().getKey();
+ uri = userNode.getURI();
+ }
+ }
}
- else
- {
- siteKey = SiteKey.portal("classic");
- uri = "";
- }
- //
+ //
PortalURLContext urlContext = new PortalURLContext(context, siteKey);
NodeURL url = urlFactory.newURL(NodeURL.TYPE, urlContext);
- // For now we redirect on the default classic site
url.setResource(new NavigationResource(siteKey.getType(), siteKey.getName(),
uri));
url.setMimeType(MimeType.PLAIN);
Show replies by date