Skip to main content link. Accesskey S
  • Anonymous
  • Log on
  • Help
  • IBM logo
  • WebSphere Portal Family wiki
  • All Wikis
  • Home
  • Community Articles
  • Product Documentation
  • Learning Center


Search

Advanced Search

Categories

Tag Cloud

  • 6.0
  • 6.1
  • 6.1.0.1
  • 6.1.5
  • 7.0
  • 7.0.0.2
  • 8.0
  • actions
  • administrator
  • authoring
  • Banking template
  • best practices
  • blogs
  • builder
  • building a site
  • caching
  • catalog
  • Clickstream Engine
  • clusters
  • ConfigEngine tasks
  • content
  • customizing
  • databases
  • demo
  • deployment
  • deployment scenario
  • developer
  • developing
  • device class
  • elements
  • examples
  • Express
  • feature set
  • fix pack 2
  • Government to Business template
  • info center
  • information center
  • installation
  • installing
  • LDAP
  • Learning
  • libraries
  • LikeMinds Recommendation Engines
  • logging
  • mentors
  • message catalog
  • messages
  • migration
  • mobile
  • mobile devices
  • mobile experience
  • mobile experience 8.0
  • mobile theme
  • mobile webkit
  • MPA
  • multiplatform
  • pages
  • performance
  • personalization
  • planning
  • portal
  • Portal 6.1
  • Portal 8 theme
  • portlets
  • product doc
  • product documentation
  • projects
  • properties
  • Redbooks
  • Redbooks Wiki
  • remember me cookie
  • resources
  • REST
  • Retail Vendor template
  • rules
  • samples
  • search
  • security
  • sifters
  • sites
  • solutions catalog
  • syndication
  • test infrastructure
  • theme
  • theme optimization
  • topologies
  • troubleshooting
  • tutorials on personalization
  • video
  • wcm
  • web content
  • webkit
  • WebSphere Portal
  • WebSphere Portlet Factory
  • wikis
  • workflows
  • worksheet
  • XML configuration interface
  • z/os
  • zos
InformationInformation
You are currently viewing machine translated content. IBM translation might be available. Click IBM Translated Product Documentation to see what is available.X


Home > Lotus Web Content Management > How to cache the Web Content Management API Workspace
Rate this article 1 starRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

How to cache the Web Content Management API Workspace  

expanded Abstract
collapsed Abstract
No abstract provided.
 When obtaining the Web Content Management API Workspace for the ‘System’ or users other than the current user, you should cache the ‘Workspace’ in the session to improve performance. Creating a workspace for a user is slow because Web Content Management needs to pre-calculate the user’s permissions. Caching the Workspace speeds up the rest of the API operations.
    • NOTE: This is a known issue when doing this with Web Content Management 6.0.0.0 and 6.0.0.1. For 6.0.0.0, apply PK35144 and PK36105 whereas for 6.0.0.1, apply PK35618

Example:

/ Returns the System Workspace */
Workspace getSystemWorkspace(HttpServletRequest request, HttpServletResponse response) throws IOException
{
String workspaceSessionKey = "System_" + Workspace.WCM_WORKSPACE_KEY;
Workspace theWorkspace = (Workspace)request.getSession().getAttribute(workspaceSessionKey);
if (theWorkspace == null)
{
theWorkspace wasn't in the session, create a new one and put it in the session
try
{
Get workspace for system user
theWorkspace = WCM_API.getRepository().getSystemWorkspace();

Store the workspace in the session to speed up next access
request.getSession().setAttribute(workspaceSessionKey, theWorkspace);
}
catch (ServiceNotAvailableException e)
{
response.getWriter().println("Error creating workspace, " + e.toString());
}
catch (OperationFailedException e)
{
response.getWriter().println("Error creating workspace, " + e.toString());
}
}
return theWorkspace;
}

 

/ Returns the Anonymous Workspace */
Workspace getAnonymousWorkspace(HttpServletRequest request, HttpServletResponse response) throws IOException
{
String workspaceSessionKey = "Anonymous_" + Workspace.WCM_WORKSPACE_KEY;
Workspace theWorkspace = (Workspace)request.getSession().getAttribute(workspaceSessionKey);
if (theWorkspace == null)
{
theWorkspace wasn't in the session, create a new one and put it in the session
try
{
Get workspace for Anonymous user
theWorkspace = WCM_API.getRepository().getAnonymousWorkspace();

Store the workspace in the session to speed up next access
request.getSession().setAttribute(workspaceSessionKey, theWorkspace);
}
catch (ServiceNotAvailableException e)
{
response.getWriter().println("Error creating workspace, " + e.toString());
}
catch (OperationFailedException e)
{
response.getWriter().println("Error creating workspace, " + e.toString());
}
}
return theWorkspace;
}

 


/ Returns the current workspace for the specified user */
Workspace getUsersWorkspace(HttpServletRequest request, HttpServletResponse response, Principal currentUser) throws IOException
{
String workspaceSessionKey = currentUser.getName() + Workspace.WCM_WORKSPACE_KEY;
Workspace theWorkspace = (Workspace)request.getSession().getAttribute(workspace SessionKey);
if (theWorkspace == null)
{
theWorkspace wasn't in the session, create a new one and put it in the session
try
{
Get workspace for current user
theWorkspace = WCM_API.getRepository().getWorkspace(currentUser);

Store the workspace in the session to speed up next access
request.getSession().setAttribute(workspaceSessionKey, theWorkspace);
}
catch (ServiceNotAvailableException e)
{
response.getWriter().println("Error creating workspace, " + e.toString());
}
catch (OperationFailedException e)
{
response.getWriter().println("Error creating workspace, " + e.toString());
}
}
return theWorkspace;
}


expanded Article information
collapsed Article information
Category:
Lotus Web Content Management, Samples and Examples for Web Content Manager,
Tags:
API, development, 6.0, performance

This Version: Version 1 November 25, 2008 1:15:43 AM by Melissa Howarth  

expanded Attachments (0)
collapsed Attachments (0)

 


expanded Versions (2)
collapsed Versions (2)
Version Comparison     
Version Date Changed by               Summary of changes
This version (1) Nov 25, 2008 1:15:43 AM Melissa Howarth  
1 Nov 25, 2008 1:15:43 AM Melissa Howarth  
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedSubscribe to RSSHelpAbout
  • All Lotus and WebSphere Portal wikis
  • IBM developerWorks
  • IBM Software support
  • IBM Social Business User Experience Blog
  • IBMSocialBizUX on Twitter
  • IBMSocialBizUX on Facebook
  • Lotus product forums
  • IBM Social Business UX blog
  • IBM Collaboration Solutions
  • Recently added feedRecently added
  • Recently edited feedRecently edited
  • Recently added comments feedRecently Added Comments
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Contact IBM
  • IBM Terms of use
  • Wiki terms of use