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 rw...@apache.org on 2006/03/25 10:03:59 UTC
svn commit: r388733 - in /portals/jetspeed-2/trunk:
components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/
components/portal/src/java/org/apache/jetspeed/profiler/impl/
jetspeed-api/src/java/org/apache/jetspeed/portalsite/ src/webapp/WEB-...
Author: rwatler
Date: Sat Mar 25 01:03:58 2006
New Revision: 388733
URL: http://svn.apache.org/viewcvs?rev=388733&view=rev
Log:
JS2-516: add a useHistory flag to Portal Site componentry to allow suppression of folder/page history use; provide option in pipelines.xml to configure ProfilerValveImpl accordingly
Modified:
portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteRequestContextImpl.java
portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java
portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portalsite/PortalSiteSessionContext.java
portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml
Modified: portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteRequestContextImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteRequestContextImpl.java?rev=388733&r1=388732&r2=388733&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteRequestContextImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteRequestContextImpl.java Sat Mar 25 01:03:58 2006
@@ -62,6 +62,12 @@
private boolean requestFallback;
/**
+ * useHistory - flag indicating whether to use visited page
+ * history to select default page per site folder
+ */
+ private boolean useHistory;
+
+ /**
* page - cached request profiled page proxy
*/
private Page requestPage;
@@ -117,12 +123,43 @@
*
* @param sessionContext session context
* @param requestProfileLocators request profile locators
+ * @param requestFallback flag specifying whether to fallback to root folder
+ * if locators do not select a page or access is forbidden
+ * @param useHistory flag indicating whether to use visited page
+ * history to select default page per site folder
*/
- public PortalSiteRequestContextImpl(PortalSiteSessionContextImpl sessionContext, Map requestProfileLocators, boolean requestFallback)
+ public PortalSiteRequestContextImpl(PortalSiteSessionContextImpl sessionContext, Map requestProfileLocators,
+ boolean requestFallback, boolean useHistory)
{
this.sessionContext = sessionContext;
this.requestProfileLocators = requestProfileLocators;
this.requestFallback = requestFallback;
+ this.useHistory = useHistory;
+ }
+
+ /**
+ * PortalSiteRequestContextImpl - constructor
+ *
+ * @param sessionContext session context
+ * @param requestProfileLocators request profile locators
+ * @param requestFallback flag specifying whether to fallback to root folder
+ * if locators do not select a page or access is forbidden
+ */
+ public PortalSiteRequestContextImpl(PortalSiteSessionContextImpl sessionContext, Map requestProfileLocators,
+ boolean requestFallback)
+ {
+ this(sessionContext, requestProfileLocators, requestFallback, true);
+ }
+
+ /**
+ * PortalSiteRequestContextImpl - constructor
+ *
+ * @param sessionContext session context
+ * @param requestProfileLocators request profile locators
+ */
+ public PortalSiteRequestContextImpl(PortalSiteSessionContextImpl sessionContext, Map requestProfileLocators)
+ {
+ this(sessionContext, requestProfileLocators, true, true);
}
/**
@@ -172,7 +209,7 @@
// cached in this context
if (requestPage == null)
{
- requestPage = sessionContext.selectRequestPage(requestProfileLocators, requestFallback);
+ requestPage = sessionContext.selectRequestPage(requestProfileLocators, requestFallback, useHistory);
}
return requestPage;
}
Modified: portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java?rev=388733&r1=388732&r2=388733&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java Sat Mar 25 01:03:58 2006
@@ -133,18 +133,18 @@
}
/**
- * newRequestContext - create a new request context instance with fallback
+ * newRequestContext - create a new request context instance with fallback and history
*
* @param requestProfileLocators request profile locators
* @return new request context instance
*/
public PortalSiteRequestContext newRequestContext(Map requestProfileLocators)
{
- return newRequestContext(requestProfileLocators, true);
+ return new PortalSiteRequestContextImpl(this, requestProfileLocators, true, true);
}
/**
- * newRequestContext - create a new request context instance
+ * newRequestContext - create a new request context instance with history
*
* @param requestProfileLocators request profile locators
* @param requestFallback flag specifying whether to fallback to root folder
@@ -153,8 +153,22 @@
*/
public PortalSiteRequestContext newRequestContext(Map requestProfileLocators, boolean requestFallback)
{
- // TODO - potentially cache N request contexts and reuse
- return new PortalSiteRequestContextImpl(this, requestProfileLocators, requestFallback);
+ return new PortalSiteRequestContextImpl(this, requestProfileLocators, requestFallback, true);
+ }
+
+ /**
+ * newRequestContext - create a new request context instance
+ *
+ * @param requestProfileLocators request profile locators
+ * @param requestFallback flag specifying whether to fallback to root folder
+ * if locators do not select a page or access is forbidden
+ * @param useHistory flag indicating whether to use visited page
+ * history to select default page per site folder
+ * @return new request context instance
+ */
+ public PortalSiteRequestContext newRequestContext(Map requestProfileLocators, boolean requestFallback, boolean useHistory)
+ {
+ return new PortalSiteRequestContextImpl(this, requestProfileLocators, requestFallback, useHistory);
}
/**
@@ -163,11 +177,13 @@
* @param requestProfileLocators map of profile locators for request
* @param requestFallback flag specifying whether to fallback to root folder
* if locators do not select a page or access is forbidden
+ * @param useHistory flag indicating whether to use visited page
+ * history to select default page per site folder
* @return selected page proxy for request
* @throws NodeNotFoundException if not found
* @throws SecurityException if view access not granted
*/
- public Page selectRequestPage(Map requestProfileLocators, boolean requestFallback) throws NodeNotFoundException
+ public Page selectRequestPage(Map requestProfileLocators, boolean requestFallback, boolean useHistory) throws NodeNotFoundException
{
// validate and update session profile locators if modified
if (updateSessionProfileLocators(requestProfileLocators))
@@ -201,7 +217,7 @@
// attempt to access requested path
try
{
- return selectRequestPage(requestPath);
+ return selectRequestPage(requestPath, useHistory);
}
catch (NodeNotFoundException nnfe)
{
@@ -380,11 +396,13 @@
* associated with this context
*
* @param requestPath request path
+ * @param useHistory flag indicating whether to use visited page
+ * history to select default page per site folder
* @return selected page proxy for request
* @throws NodeNotFoundException if not found
* @throws SecurityException if view access not granted
*/
- private Page selectRequestPage(String requestPath) throws NodeNotFoundException
+ private Page selectRequestPage(String requestPath, boolean useHistory) throws NodeNotFoundException
{
// save access exceptions
SecurityException accessException = null;
@@ -511,19 +529,24 @@
}
if ((requestFolder != null) && (requestFolderPages != null) && !requestFolderPages.isEmpty())
{
+ Page requestPage = null;
+
// attempt to lookup last visited page by folder proxy
// path, (proxies are hashed by their path), contains
// test must be performed since identical paths may
// occur in multiple site views
- Page requestPage = (Page)folderPageHistory.get(requestFolder);
- if ((requestPage != null) && requestFolderPages.contains(requestPage))
+ if (useHistory)
{
- // log selected request page
- if (log.isDebugEnabled())
+ requestPage = (Page)folderPageHistory.get(requestFolder);
+ if ((requestPage != null) && requestFolderPages.contains(requestPage))
{
- log.debug("Selected folder historical page: path=" + view.getManagedPage(requestPage).getPath());
+ // log selected request page
+ if (log.isDebugEnabled())
+ {
+ log.debug("Selected folder historical page: path=" + view.getManagedPage(requestPage).getPath());
+ }
+ return requestPage;
}
- return requestPage;
}
// get default page for folder proxy if more than one
Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java?rev=388733&r1=388732&r2=388733&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java Sat Mar 25 01:03:58 2006
@@ -97,24 +97,54 @@
private boolean requestFallback;
/**
+ * useHistory - flag indicating whether to use visited page
+ * history to select default page per site folder
+ */
+ private boolean useHistory;
+
+ /**
* ProfilerValveImpl - constructor
*
* @param profiler profiler component reference
* @param portalSite portal site component reference
* @param pageManager page manager component reference
* @param requestFallback flag to enable root folder fallback
+ * @param useHistory flag to enable selection of last visited folder page
*/
- public ProfilerValveImpl( Profiler profiler, PortalSite portalSite, PageManager pageManager, boolean requestFallback )
+ public ProfilerValveImpl( Profiler profiler, PortalSite portalSite, PageManager pageManager,
+ boolean requestFallback, boolean useHistory)
{
this.profiler = profiler;
this.portalSite = portalSite;
this.pageManager = pageManager;
this.requestFallback = requestFallback;
+ this.useHistory = useHistory;
+ }
+
+ /**
+ * ProfilerValveImpl - constructor
+ *
+ * @param profiler profiler component reference
+ * @param portalSite portal site component reference
+ * @param pageManager page manager component reference
+ * @param requestFallback flag to enable root folder fallback
+ */
+ public ProfilerValveImpl(Profiler profiler, PortalSite portalSite, PageManager pageManager,
+ boolean requestFallback)
+ {
+ this(profiler, portalSite, pageManager, requestFallback, true);
}
- public ProfilerValveImpl( Profiler profiler, PortalSite portalSite, PageManager pageManager)
+ /**
+ * ProfilerValveImpl - constructor
+ *
+ * @param profiler profiler component reference
+ * @param portalSite portal site component reference
+ * @param pageManager page manager component reference
+ */
+ public ProfilerValveImpl(Profiler profiler, PortalSite portalSite, PageManager pageManager)
{
- this(profiler, portalSite, pageManager, true);
+ this(profiler, portalSite, pageManager, true, true);
}
/*
@@ -190,15 +220,16 @@
}
// construct and save a new portalsite request context
- // using session context, locators map, and fallback; the
- // request context uses the locators to initialize or resets
- // the session context if locators have changed for this
- // request; the request context also acts as a short term
- // request cache for the selected page and built menus;
- // however, creating the request context here does not
- // select the page or build menus: that is done when the
- // request context is accessed subsequently
- PortalSiteRequestContext requestContext = sessionContext.newRequestContext(locators, requestFallback);
+ // using session context, locators map, fallback, and
+ // folder page histories; the request context uses the
+ // locators to initialize or resets the session context if
+ // locators have changed for this request; the request
+ // context also acts as a short term request cache for the
+ // selected page and built menus; however, creating the
+ // request context here does not select the page or build
+ // menus: that is done when the request context is
+ // accessed subsequently
+ PortalSiteRequestContext requestContext = sessionContext.newRequestContext(locators, requestFallback, useHistory);
request.setAttribute(PORTAL_SITE_REQUEST_CONTEXT_ATTR_KEY, requestContext);
// additionally save request context under legacy key
Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portalsite/PortalSiteSessionContext.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portalsite/PortalSiteSessionContext.java?rev=388733&r1=388732&r2=388733&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portalsite/PortalSiteSessionContext.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portalsite/PortalSiteSessionContext.java Sat Mar 25 01:03:58 2006
@@ -29,7 +29,7 @@
public interface PortalSiteSessionContext extends Serializable
{
/**
- * newRequestContext - create a new request context instance with fallback
+ * newRequestContext - create a new request context instance with fallback and history
*
* @param requestProfileLocators request profile locators
* @return new request context instance
@@ -37,7 +37,7 @@
PortalSiteRequestContext newRequestContext(Map requestProfileLocators);
/**
- * newRequestContext - create a new request context instance
+ * newRequestContext - create a new request context instance with history
*
* @param requestProfileLocators request profile locators
* @param requestFallback flag specifying whether to fallback to root folder
@@ -45,6 +45,18 @@
* @return new request context instance
*/
PortalSiteRequestContext newRequestContext(Map requestProfileLocators, boolean requestFallback);
+
+ /**
+ * newRequestContext - create a new request context instance
+ *
+ * @param requestProfileLocators request profile locators
+ * @param requestFallback flag specifying whether to fallback to root folder
+ * if locators do not select a page or access is forbidden
+ * @param useHistory flag indicating whether to use visited page
+ * history to select default page per site folder
+ * @return new request context instance
+ */
+ PortalSiteRequestContext newRequestContext(Map requestProfileLocators, boolean requestFallback, boolean useHistory);
/**
* getPageManager - return PageManager component instance
Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml?rev=388733&r1=388732&r2=388733&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml Sat Mar 25 01:03:58 2006
@@ -92,6 +92,13 @@
for access errors or missing pages
-->
<constructor-arg index="3"><value>true</value></constructor-arg>
+ <!--
+ use last visited page histories to select default page
+ for folder navigational urls; if set to false, the
+ default page specified in PSML, (or the first page in
+ the folder), is always selected
+ -->
+ <constructor-arg index="4"><value>true</value></constructor-arg>
</bean>
<bean id="containerValve"
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org