org.sakaiproject.tool.access
Class AccessServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.sakaiproject.vm.ComponentServlet
              extended byorg.sakaiproject.vm.VmServlet
                  extended byorg.sakaiproject.cheftool.VmServlet
                      extended byorg.sakaiproject.tool.access.AccessServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig
Direct Known Subclasses:
WebServlet

public class AccessServlet
extends VmServlet

Access is a servlet that provides a portal to entity access by URL for Sakai.
The servlet takes the requests and dispatches to the appropriate EntityProducer for the response.
Any error handling is done here.
If the user has not yet logged in and need to for permission, the login process is handled here, too.

Author:
Sakai Software Development Team
See Also:
Serialized Form

Nested Class Summary
 class AccessServlet.AccessServletInfo
           
 class AccessServlet.AccessServletInit
          init thread - so we don't wait in the actual init() call
 
Field Summary
protected static String COPYRIGHT_ACCEPT
          Path used when the user has accepted the copyright agreement .
protected static String COPYRIGHT_ACCEPT_REF
          Ref accepted, request parameter for COPYRIGHT_ACCEPT request.
protected static String COPYRIGHT_ACCEPT_URL
          Return URL, request parameter for COPYRIGHT_ACCEPT request.
protected static String COPYRIGHT_ACCEPTED_REFS_ATTR
          Session attribute holding copyright-accepted references (a collection of Strings).
protected static String COPYRIGHT_PATH
          copyright path -- MUST have same value as ResourcesAction.COPYRIGHT_PATH
protected static String COPYRIGHT_REQUIRE
          Path used when forcing the user to accept the copyright agreement .
protected static String FORM_VALUE_DELIMETER
          delimiter for form multiple values
protected  boolean m_ready
          set to true when init'ed.
protected static ResourceLoader rb
          Resource bundle using current language locale
protected static int STREAM_BUFFER_SIZE
          The chunk size used when streaming (100k).
protected static boolean STREAM_CONTENT
          stream content requests if true, read all into memory and send if false.
 
Fields inherited from class org.sakaiproject.cheftool.VmServlet
m_validator
 
Fields inherited from class org.sakaiproject.vm.ComponentServlet
ATTR_PARAMS
 
Constructor Summary
AccessServlet()
           
 
Method Summary
 void dispatch(HttpServletRequest req, HttpServletResponse res)
          handle get and post communication from the user
 void doGet(HttpServletRequest req, HttpServletResponse res)
          respond to an HTTP GET request
protected  void doLogin(HttpServletRequest req, HttpServletResponse res, String path)
          Make a redirect to the login url.
 void doPost(HttpServletRequest req, HttpServletResponse res)
          respond to an HTTP POST request; only to handle the login process
 void init(ServletConfig config)
          initialize the AccessServlet servlet
protected  AccessServlet.AccessServletInfo newInfo(HttpServletRequest req)
          create the info
protected  String preProcessPath(String path, HttpServletRequest req)
          Make any changes needed to the path before final "ref" processing.
protected  void respondCopyrightAlertDemo(HttpServletRequest req, HttpServletResponse res)
          Make the Sample Copyright Alert response.
protected  void sendError(HttpServletResponse res, int code)
           
 void startInit()
          Start the initialization process
 
Methods inherited from class org.sakaiproject.cheftool.VmServlet
setVmStdRef
 
Methods inherited from class org.sakaiproject.vm.VmServlet
getActionURL, getVmReference, includeVm, setVmReference
 
Methods inherited from class org.sakaiproject.vm.ComponentServlet
sendParentRedirect, service, setNoCacheHeaders
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rb

protected static ResourceLoader rb
Resource bundle using current language locale


STREAM_CONTENT

protected static final boolean STREAM_CONTENT
stream content requests if true, read all into memory and send if false.

See Also:
Constant Field Values

STREAM_BUFFER_SIZE

protected static final int STREAM_BUFFER_SIZE
The chunk size used when streaming (100k).

See Also:
Constant Field Values

FORM_VALUE_DELIMETER

protected static final String FORM_VALUE_DELIMETER
delimiter for form multiple values

See Also:
Constant Field Values

m_ready

protected boolean m_ready
set to true when init'ed.


COPYRIGHT_PATH

protected static final String COPYRIGHT_PATH
copyright path -- MUST have same value as ResourcesAction.COPYRIGHT_PATH

See Also:
Constant Field Values

COPYRIGHT_REQUIRE

protected static final String COPYRIGHT_REQUIRE
Path used when forcing the user to accept the copyright agreement .

See Also:
Constant Field Values

COPYRIGHT_ACCEPT

protected static final String COPYRIGHT_ACCEPT
Path used when the user has accepted the copyright agreement .

See Also:
Constant Field Values

COPYRIGHT_ACCEPT_REF

protected static final String COPYRIGHT_ACCEPT_REF
Ref accepted, request parameter for COPYRIGHT_ACCEPT request.

See Also:
Constant Field Values

COPYRIGHT_ACCEPT_URL

protected static final String COPYRIGHT_ACCEPT_URL
Return URL, request parameter for COPYRIGHT_ACCEPT request.

See Also:
Constant Field Values

COPYRIGHT_ACCEPTED_REFS_ATTR

protected static final String COPYRIGHT_ACCEPTED_REFS_ATTR
Session attribute holding copyright-accepted references (a collection of Strings).

See Also:
Constant Field Values
Constructor Detail

AccessServlet

public AccessServlet()
Method Detail

init

public void init(ServletConfig config)
          throws ServletException
initialize the AccessServlet servlet

Parameters:
config - the servlet config parameter
Throws:
ServletException - in case of difficulties

startInit

public void startInit()
Start the initialization process


doGet

public void doGet(HttpServletRequest req,
                  HttpServletResponse res)
           throws ServletException,
                  IOException
respond to an HTTP GET request

Parameters:
req - HttpServletRequest object with the client request
res - HttpServletResponse object back to the client
Throws:
ServletException - in case of difficulties
IOException - in case of difficulties

doPost

public void doPost(HttpServletRequest req,
                   HttpServletResponse res)
            throws ServletException,
                   IOException
respond to an HTTP POST request; only to handle the login process

Parameters:
req - HttpServletRequest object with the client request
res - HttpServletResponse object back to the client
Throws:
ServletException - in case of difficulties
IOException - in case of difficulties

dispatch

public void dispatch(HttpServletRequest req,
                     HttpServletResponse res)
              throws ServletException
handle get and post communication from the user

Parameters:
req - HttpServletRequest object with the client request
res - HttpServletResponse object back to the client
Throws:
ServletException

preProcessPath

protected String preProcessPath(String path,
                                HttpServletRequest req)
Make any changes needed to the path before final "ref" processing.

Parameters:
path - The path from the request.
Returns:
The path to use to make the Reference for further processing.

respondCopyrightAlertDemo

protected void respondCopyrightAlertDemo(HttpServletRequest req,
                                         HttpServletResponse res)
                                  throws ServletException
Make the Sample Copyright Alert response.

Parameters:
req - HttpServletRequest object with the client request.
res - HttpServletResponse object back to the client.
Throws:
ServletException

doLogin

protected void doLogin(HttpServletRequest req,
                       HttpServletResponse res,
                       String path)
                throws ToolException
Make a redirect to the login url.

Parameters:
req - HttpServletRequest object with the client request.
res - HttpServletResponse object back to the client.
path - The current request path, set ONLY if we want this to be where to redirect the user after successfull login
Throws:
ToolException

newInfo

protected AccessServlet.AccessServletInfo newInfo(HttpServletRequest req)
create the info


sendError

protected void sendError(HttpServletResponse res,
                         int code)