org.sakaiproject.portal.charon
Class CharonPortal

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.sakaiproject.portal.charon.CharonPortal
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class CharonPortal
extends HttpServlet

Charon is the Sakai Site based portal.

Version:
$Revision: 6474 $
Author:
University of Michigan, Sakai Software Development Team
See Also:
Serialized Form

Field Summary
protected static String ATTR_ERROR
          ThreadLocal attribute set while we are processing an error.
protected static String ATTR_SITE_PAGE
          Session attribute root for storing a site's last page visited - just append the site id.
protected static int ERROR_GALLERY
           
protected static int ERROR_SITE
          Error response modes.
protected static int ERROR_WORKSITE
           
protected static String PARAM_FORCE_LOGIN
          Parameter value to allow anonymous users of gallery mode to be sent to the gateway site as anonymous user (like the /portal URL) instead of making them log in (like worksite, site, and tool URLs).
protected static String PARAM_SAKAI_SITE
          Parameter value to indicate to look up a tool ID within a site
 
Constructor Summary
CharonPortal()
           
 
Method Summary
 void destroy()
          Shutdown the servlet.
protected  void doError(HttpServletRequest req, HttpServletResponse res, Session session, int mode)
           
protected  void doErrorDone(HttpServletRequest req, HttpServletResponse res)
           
protected  void doErrorReport(HttpServletRequest req, HttpServletResponse res)
           
protected  void doGallery(HttpServletRequest req, HttpServletResponse res, Session session, String siteId, String pageId, String toolContextPath)
           
protected  void doGalleryTabs(HttpServletRequest req, HttpServletResponse res, Session session, String siteId)
           
protected  void doGet(HttpServletRequest req, HttpServletResponse res)
          Respond to navigation / access requests.
protected  void doHelp(HttpServletRequest req, HttpServletResponse res, Session session, String toolContextPath, String toolPathInfo)
           
protected  void doLogin(HttpServletRequest req, HttpServletResponse res, Session session, String returnPath, boolean skipContainer)
           
protected  void doLogout(HttpServletRequest req, HttpServletResponse res, Session session, String returnPath)
          Process a logout
protected  void doNavLogin(HttpServletRequest req, HttpServletResponse res, Session session, String siteId)
           
protected  void doNavLoginGallery(HttpServletRequest req, HttpServletResponse res, Session session, String siteId)
           
protected  void doPage(HttpServletRequest req, HttpServletResponse res, Session session, String pageId, String toolContextPath)
           
protected  void doPost(HttpServletRequest req, HttpServletResponse res)
          Respond to data posting requests.
protected  void doPresence(HttpServletRequest req, HttpServletResponse res, Session session, String siteId, String toolContextPath, String toolPathInfo)
           
protected  void doSite(HttpServletRequest req, HttpServletResponse res, Session session, String siteId, String pageId, String toolContextPath)
           
protected  void doSiteTabs(HttpServletRequest req, HttpServletResponse res, Session session, String siteId)
           
protected  void doThrowableError(HttpServletRequest req, HttpServletResponse res, Throwable t)
           
protected  void doTitle(HttpServletRequest req, HttpServletResponse res, Session session, String placementId, String toolContextPath, String toolPathInfo)
           
protected  void doTool(HttpServletRequest req, HttpServletResponse res, Session session, String placementId, String toolContextPath, String toolPathInfo)
           
protected  void doWorksite(HttpServletRequest req, HttpServletResponse res, Session session, String siteId, String pageId, String toolContextPath)
           
protected  void endResponse(PrintWriter out)
           
protected  void forwardTool(ActiveTool tool, HttpServletRequest req, HttpServletResponse res, Placement p, String skin, String toolContextPath, String toolPathInfo)
          Forward to the tool - but first setup JavaScript/CSS etc that the tool will render
protected  String getPlacement(HttpServletRequest req, HttpServletResponse res, Session session, String placementId, boolean doPage)
           
protected  String getScriptPath()
           
 String getServletInfo()
          Access the Servlet's information display.
protected  void includeBottom(PrintWriter out)
           
protected  void includeGalleryLogin(PrintWriter out, HttpServletRequest req, Session session, String siteId)
           
protected  void includeGalleryNav(PrintWriter out, HttpServletRequest req, Session session, String siteId)
           
protected  void includeLogin(PrintWriter out, HttpServletRequest req, Session session)
           
protected  void includeLogo(PrintWriter out, HttpServletRequest req, Session session, String siteId)
           
protected  void includePage(PrintWriter out, HttpServletRequest req, SitePage page, String toolContextPath, String wrapperClass)
           
protected  void includePageNav(PrintWriter out, HttpServletRequest req, Session session, Site site, SitePage page, String toolContextPath, String portalPrefix)
           
protected  void includeSiteNav(PrintWriter out, HttpServletRequest req, Session session, String siteId)
           
protected  void includeTabs(PrintWriter out, HttpServletRequest req, Session session, String siteId, String prefix, boolean addLogout)
           
protected  void includeTitle(ActiveTool tool, HttpServletRequest req, HttpServletResponse res, ToolConfiguration placement, String skin, String toolContextPath, String toolPathInfo)
          Output the content of the title frame for a tool.
protected  void includeTool(PrintWriter out, HttpServletRequest req, ToolConfiguration placement)
           
protected  void includeWorksite(PrintWriter out, HttpServletRequest req, Session session, Site site, SitePage page, String toolContextPath, String portalPrefix)
           
protected  int indexOf(String value, List siteList)
          Find the site in the list that has this id - return the position.
 void init(ServletConfig config)
          Initialize the servlet.
protected  void postLogin(HttpServletRequest req, HttpServletResponse res, Session session, String loginPath)
          TODO: I'm not sure why this has to be different from doLogin...
protected  void setupForward(HttpServletRequest req, HttpServletResponse res, Placement p, String skin)
           
protected  void showSession(PrintWriter out, boolean html)
          Output some session information
protected  PrintWriter startResponse(HttpServletResponse res, String title, String skin)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_SITE_PAGE

protected static final String ATTR_SITE_PAGE
Session attribute root for storing a site's last page visited - just append the site id.

See Also:
Constant Field Values

PARAM_FORCE_LOGIN

protected static final String PARAM_FORCE_LOGIN
Parameter value to allow anonymous users of gallery mode to be sent to the gateway site as anonymous user (like the /portal URL) instead of making them log in (like worksite, site, and tool URLs).

See Also:
Constant Field Values

PARAM_SAKAI_SITE

protected static final String PARAM_SAKAI_SITE
Parameter value to indicate to look up a tool ID within a site

See Also:
Constant Field Values

ATTR_ERROR

protected static final String ATTR_ERROR
ThreadLocal attribute set while we are processing an error.

See Also:
Constant Field Values

ERROR_SITE

protected static final int ERROR_SITE
Error response modes.

See Also:
Constant Field Values

ERROR_GALLERY

protected static final int ERROR_GALLERY
See Also:
Constant Field Values

ERROR_WORKSITE

protected static final int ERROR_WORKSITE
See Also:
Constant Field Values
Constructor Detail

CharonPortal

public CharonPortal()
Method Detail

destroy

public void destroy()
Shutdown the servlet.


doError

protected void doError(HttpServletRequest req,
                       HttpServletResponse res,
                       Session session,
                       int mode)
                throws ToolException,
                       IOException
Throws:
ToolException
IOException

doThrowableError

protected void doThrowableError(HttpServletRequest req,
                                HttpServletResponse res,
                                Throwable t)

doGallery

protected void doGallery(HttpServletRequest req,
                         HttpServletResponse res,
                         Session session,
                         String siteId,
                         String pageId,
                         String toolContextPath)
                  throws ToolException,
                         IOException
Throws:
ToolException
IOException

doGalleryTabs

protected void doGalleryTabs(HttpServletRequest req,
                             HttpServletResponse res,
                             Session session,
                             String siteId)
                      throws IOException
Throws:
IOException

doGet

protected void doGet(HttpServletRequest req,
                     HttpServletResponse res)
              throws ServletException,
                     IOException
Respond to navigation / access requests.

Parameters:
req - The servlet request.
res - The servlet response.
Throws:
ServletException.
IOException.
ServletException
IOException

doTitle

protected void doTitle(HttpServletRequest req,
                       HttpServletResponse res,
                       Session session,
                       String placementId,
                       String toolContextPath,
                       String toolPathInfo)
                throws ToolException,
                       IOException
Throws:
ToolException
IOException

includeTitle

protected void includeTitle(ActiveTool tool,
                            HttpServletRequest req,
                            HttpServletResponse res,
                            ToolConfiguration placement,
                            String skin,
                            String toolContextPath,
                            String toolPathInfo)
                     throws IOException
Output the content of the title frame for a tool.

Throws:
IOException

doLogin

protected void doLogin(HttpServletRequest req,
                       HttpServletResponse res,
                       Session session,
                       String returnPath,
                       boolean skipContainer)
                throws ToolException
Throws:
ToolException

doLogout

protected void doLogout(HttpServletRequest req,
                        HttpServletResponse res,
                        Session session,
                        String returnPath)
                 throws ToolException
Process a logout

Parameters:
req - Request object
res - Response object
session - Current session
returnPath - if not null, the path to use for the end-user browser redirect after the logout is complete. Leave null to use the configured logged out URL.
Throws:
IOException
ToolException

doNavLogin

protected void doNavLogin(HttpServletRequest req,
                          HttpServletResponse res,
                          Session session,
                          String siteId)
                   throws IOException
Throws:
IOException

doNavLoginGallery

protected void doNavLoginGallery(HttpServletRequest req,
                                 HttpServletResponse res,
                                 Session session,
                                 String siteId)
                          throws IOException
Throws:
IOException

doPage

protected void doPage(HttpServletRequest req,
                      HttpServletResponse res,
                      Session session,
                      String pageId,
                      String toolContextPath)
               throws ToolException,
                      IOException
Throws:
ToolException
IOException

doPost

protected void doPost(HttpServletRequest req,
                      HttpServletResponse res)
               throws ServletException,
                      IOException
Respond to data posting requests.

Parameters:
req - The servlet request.
res - The servlet response.
Throws:
ServletException.
IOException.
ServletException
IOException

doPresence

protected void doPresence(HttpServletRequest req,
                          HttpServletResponse res,
                          Session session,
                          String siteId,
                          String toolContextPath,
                          String toolPathInfo)
                   throws ToolException,
                          IOException
Throws:
ToolException
IOException

doHelp

protected void doHelp(HttpServletRequest req,
                      HttpServletResponse res,
                      Session session,
                      String toolContextPath,
                      String toolPathInfo)
               throws ToolException,
                      IOException
Throws:
ToolException
IOException

doErrorReport

protected void doErrorReport(HttpServletRequest req,
                             HttpServletResponse res)
                      throws ToolException,
                             IOException
Throws:
ToolException
IOException

doErrorDone

protected void doErrorDone(HttpServletRequest req,
                           HttpServletResponse res)
                    throws ToolException,
                           IOException
Throws:
ToolException
IOException

doSite

protected void doSite(HttpServletRequest req,
                      HttpServletResponse res,
                      Session session,
                      String siteId,
                      String pageId,
                      String toolContextPath)
               throws ToolException,
                      IOException
Throws:
ToolException
IOException

getPlacement

protected String getPlacement(HttpServletRequest req,
                              HttpServletResponse res,
                              Session session,
                              String placementId,
                              boolean doPage)
                       throws ToolException
Throws:
ToolException

doSiteTabs

protected void doSiteTabs(HttpServletRequest req,
                          HttpServletResponse res,
                          Session session,
                          String siteId)
                   throws IOException
Throws:
IOException

doTool

protected void doTool(HttpServletRequest req,
                      HttpServletResponse res,
                      Session session,
                      String placementId,
                      String toolContextPath,
                      String toolPathInfo)
               throws ToolException,
                      IOException
Throws:
ToolException
IOException

setupForward

protected void setupForward(HttpServletRequest req,
                            HttpServletResponse res,
                            Placement p,
                            String skin)
                     throws ToolException
Throws:
ToolException

forwardTool

protected void forwardTool(ActiveTool tool,
                           HttpServletRequest req,
                           HttpServletResponse res,
                           Placement p,
                           String skin,
                           String toolContextPath,
                           String toolPathInfo)
                    throws ToolException
Forward to the tool - but first setup JavaScript/CSS etc that the tool will render

Throws:
ToolException

doWorksite

protected void doWorksite(HttpServletRequest req,
                          HttpServletResponse res,
                          Session session,
                          String siteId,
                          String pageId,
                          String toolContextPath)
                   throws ToolException,
                          IOException
Throws:
ToolException
IOException

endResponse

protected void endResponse(PrintWriter out)

getScriptPath

protected String getScriptPath()

getServletInfo

public String getServletInfo()
Access the Servlet's information display.

Returns:
servlet information.

includeBottom

protected void includeBottom(PrintWriter out)

includeGalleryLogin

protected void includeGalleryLogin(PrintWriter out,
                                   HttpServletRequest req,
                                   Session session,
                                   String siteId)
                            throws IOException
Throws:
IOException

includeGalleryNav

protected void includeGalleryNav(PrintWriter out,
                                 HttpServletRequest req,
                                 Session session,
                                 String siteId)

includeLogo

protected void includeLogo(PrintWriter out,
                           HttpServletRequest req,
                           Session session,
                           String siteId)
                    throws IOException
Throws:
IOException

includeLogin

protected void includeLogin(PrintWriter out,
                            HttpServletRequest req,
                            Session session)

includePage

protected void includePage(PrintWriter out,
                           HttpServletRequest req,
                           SitePage page,
                           String toolContextPath,
                           String wrapperClass)
                    throws IOException
Throws:
IOException

includePageNav

protected void includePageNav(PrintWriter out,
                              HttpServletRequest req,
                              Session session,
                              Site site,
                              SitePage page,
                              String toolContextPath,
                              String portalPrefix)
                       throws IOException
Throws:
IOException

includeSiteNav

protected void includeSiteNav(PrintWriter out,
                              HttpServletRequest req,
                              Session session,
                              String siteId)

includeTabs

protected void includeTabs(PrintWriter out,
                           HttpServletRequest req,
                           Session session,
                           String siteId,
                           String prefix,
                           boolean addLogout)
                    throws IOException
Throws:
IOException

includeTool

protected void includeTool(PrintWriter out,
                           HttpServletRequest req,
                           ToolConfiguration placement)
                    throws IOException
Throws:
IOException

includeWorksite

protected void includeWorksite(PrintWriter out,
                               HttpServletRequest req,
                               Session session,
                               Site site,
                               SitePage page,
                               String toolContextPath,
                               String portalPrefix)
                        throws IOException
Throws:
IOException

init

public void init(ServletConfig config)
          throws ServletException
Initialize the servlet.

Parameters:
config - The servlet config.
Throws:
ServletException

postLogin

protected void postLogin(HttpServletRequest req,
                         HttpServletResponse res,
                         Session session,
                         String loginPath)
                  throws ToolException
TODO: I'm not sure why this has to be different from doLogin...

Parameters:
req -
res -
session -
Throws:
IOException
ToolException

showSession

protected void showSession(PrintWriter out,
                           boolean html)
Output some session information

Parameters:
out - The print writer
html - If true, output in HTML, else in text.

startResponse

protected PrintWriter startResponse(HttpServletResponse res,
                                    String title,
                                    String skin)
                             throws IOException
Throws:
IOException

indexOf

protected int indexOf(String value,
                      List siteList)
Find the site in the list that has this id - return the position.

Parameters:
value - The site id to find.
siteList - The list of Site objects.
Returns:
The index position in siteList of the site with site id = value, or -1 if not found.