org.dspace.app.xmlui.utils
Class ContextUtil

java.lang.Object
  extended by org.dspace.app.xmlui.utils.ContextUtil

public class ContextUtil
extends Object

Miscellaneous UI utility methods methods for managing DSpace context. This class was "adapted" from the UIUtil.java in the DSpace webui.

Author:
Robert Tansley, Scott Phillips

Field Summary
static String DSPACE_CONTEXT
          Where the context is stored on an HTTP Request object
 
Constructor Summary
ContextUtil()
           
 
Method Summary
static void abortContext(javax.servlet.http.HttpServletRequest request)
           
static void completeContext(javax.servlet.http.HttpServletRequest request)
          Check if a context exists for this request, if so complete the context.
static boolean isContextAvailable(Map objectModel)
          Inspection method to check if a DSpace context has been created for this request.
static Context obtainContext(javax.servlet.http.HttpServletRequest request)
          Obtain a new context object.
static Context obtainContext(Map objectModel)
          Obtain a new context object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DSPACE_CONTEXT

public static final String DSPACE_CONTEXT
Where the context is stored on an HTTP Request object

See Also:
Constant Field Values
Constructor Detail

ContextUtil

public ContextUtil()
Method Detail

obtainContext

public static Context obtainContext(Map objectModel)
                             throws SQLException
Obtain a new context object. If a context object has already been created for this HTTP request, it is re-used, otherwise it is created.

Parameters:
objectModel - the cocoon Objectmodel
Returns:
a context object
Throws:
SQLException

isContextAvailable

public static boolean isContextAvailable(Map objectModel)
Inspection method to check if a DSpace context has been created for this request.

Parameters:
objectModel - The cocoon ObjectModel
Returns:
True if a context has previously been created, false otherwise.

obtainContext

public static Context obtainContext(javax.servlet.http.HttpServletRequest request)
                             throws SQLException
Obtain a new context object. If a context object has already been created for this HTTP request, it is re-used, otherwise it is created.

Parameters:
request - the cocoon or servlet request object
Returns:
a context object
Throws:
SQLException

completeContext

public static void completeContext(javax.servlet.http.HttpServletRequest request)
                            throws javax.servlet.ServletException
Check if a context exists for this request, if so complete the context.

Parameters:
request - The request object
Throws:
javax.servlet.ServletException

abortContext

public static void abortContext(javax.servlet.http.HttpServletRequest request)


Copyright © 2013 DuraSpace. All Rights Reserved.