Package org.dspace.app.rest.utils
Class ContextUtil
- java.lang.Object
-
- org.dspace.app.rest.utils.ContextUtil
-
public class ContextUtil extends Object
Miscellaneous UI utility methods methods for managing DSpace context. This class was "adapted" from the class of the same name in old XMLUI.- Author:
- Tim Donohue
-
-
Field Summary
Fields Modifier and Type Field Description static StringDSPACE_CONTEXTWhere the context is stored on an HTTP Request object
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidabortContext(javax.servlet.ServletRequest request)static voidcompleteContext(javax.servlet.ServletRequest request)Check if a context exists for this request, if so complete the context.static booleanisContextAvailable(javax.servlet.ServletRequest request)Inspection method to check if a DSpace context has been created for this request.static ContextobtainContext(javax.servlet.http.HttpServletRequest request)Obtain a new context object.static ContextobtainCurrentRequestContext()Shortcut for#obtainContext(Request)using theRequestServiceto retrieve the current thread request
-
-
-
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
-
-
Method Detail
-
isContextAvailable
public static boolean isContextAvailable(javax.servlet.ServletRequest request)
Inspection method to check if a DSpace context has been created for this request.- Parameters:
request- the servlet request object- Returns:
- True if a context has previously been created, false otherwise.
-
obtainContext
public static Context obtainContext(javax.servlet.http.HttpServletRequest request)
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 servlet request object- Returns:
- a context object
-
obtainCurrentRequestContext
public static Context obtainCurrentRequestContext()
Shortcut for#obtainContext(Request)using theRequestServiceto retrieve the current thread request- Returns:
- the DSpace Context associated with the current thread-bound request
-
completeContext
public static void completeContext(javax.servlet.ServletRequest request) throws javax.servlet.ServletExceptionCheck 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.ServletRequest request)
-
-