/ 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;
}