Author: woonsan
Date: Wed Dec 23 16:36:20 2009
New Revision: 893567
URL: http://svn.apache.org/viewvc?rev=893567&view=rev
Log:
JS2-1057: Invalidation space in session when the portal path changes.
Modified:
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceNavigator.java
Modified:
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java?rev=893567&r1=893566&r2=893567&view=diff
==============================================================================
---
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java
(original)
+++
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java
Wed Dec 23 16:36:20 2009
@@ -144,13 +144,32 @@
spaces = spacesService.listSpaces();
}
request.getPortletSession().setAttribute("spaces", spaces);
- Space space =
(Space)request.getPortletSession().getAttribute("space");
+ Space space = (Space)
request.getPortletSession().getAttribute("space");
+
+ if (space != null)
+ {
+ // check if this space matches the current portal page path.
+ RequestContext rc = (RequestContext)
request.getAttribute(RequestContext.REQUEST_PORTALENV);
+ String portalPagePath = rc.getPortalURL().getPath();
+
+ if (portalPagePath == null || "".equals(portalPagePath))
+ {
+ portalPagePath = "/";
+ }
+
+ if (!portalPagePath.startsWith(space.getPath()))
+ {
+ space = null;
+ }
+ }
+
if (space == null)
{
space = spaces.get(0);
+
if (newSpace != null)
{
- for (Space sp: spaces)
+ for (Space sp : spaces)
{
if (sp.getName().equals(newSpace))
{
@@ -159,6 +178,7 @@
}
}
}
+
request.getPortletSession().setAttribute("space", space);
}
request.setAttribute("space", space);
Modified:
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceNavigator.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceNavigator.java?rev=893567&r1=893566&r2=893567&view=diff
==============================================================================
---
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceNavigator.java
(original)
+++
portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceNavigator.java
Wed Dec 23 16:36:20 2009
@@ -30,6 +30,7 @@
import org.apache.jetspeed.CommonPortletServices;
import org.apache.jetspeed.administration.PortalAdministration;
import org.apache.jetspeed.page.PageManager;
+import org.apache.jetspeed.request.RequestContext;
import org.apache.jetspeed.spaces.Space;
import org.apache.jetspeed.spaces.Spaces;
import org.apache.portals.bridges.common.GenericServletPortlet;
@@ -83,9 +84,28 @@
spaces = spacesService.listSpaces();
request.setAttribute("spaces", spaces);
request.getPortletSession().setAttribute("spaces", spaces);
- }
+ }
+
request.setAttribute("spaces", spaces);
- Space space =
(Space)request.getPortletSession().getAttribute("space");
+ Space space = (Space)request.getPortletSession().getAttribute("space");
+
+ if (space != null)
+ {
+ // check if this space matches the current portal page path.
+ RequestContext rc = (RequestContext)
request.getAttribute(RequestContext.REQUEST_PORTALENV);
+ String portalPagePath = rc.getPortalURL().getPath();
+
+ if (portalPagePath == null || "".equals(portalPagePath))
+ {
+ portalPagePath = "/";
+ }
+
+ if (!portalPagePath.startsWith(space.getPath()))
+ {
+ space = null;
+ }
+ }
+
if (space == null && spaceName != null)
{
for (Space sp: spaces)
@@ -93,18 +113,22 @@
if (sp.getName().equals(spaceName))
{
space = sp;
+ request.getPortletSession().setAttribute("space", space);
break;
}
}
}
+
if (space== null)
{
space = spaces.get(0);
+ request.getPortletSession().setAttribute("space", space);
spaceName = space.getName();
}
+
request.setAttribute("title", spaceName);
request.setAttribute("space", space);
- request.getPortletSession().setAttribute("space", space);
+
try
{
super.doView(request, response);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]