blackboard.platform.context
Interface Context

All Superinterfaces:
Entitled

public interface Context
extends Entitled

Context is a core component of the Blackboard API, encapsulating as much as information about the current service request as possible. In most cases, the service request means an HTTP request to the server. Context is set via the ContextManager.setContext() method. The data that's stored context includes session data and data relevant just to the current request, such as which Course or Content object is being accessed. Other data which might be in context includes Group and User (accessed via the BbSession object.

Since:
Bb 6
Version:
$Revision: #1 $ $Date: 2007/06/27 $

Nested Class Summary
static class Context.OverrideType
           
 
Field Summary
static java.lang.String PARAM_NAME
          Standard name for the context param in request attributes
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
          Gets an arbitrary attribute for use in this context.
 java.util.Map<java.lang.String,java.lang.Object> getAttributes()
          Gets all the attributes in this context in the form of a HashMap.
 Context.OverrideType getContextOverride()
          returns the OverrideType of this Context object.
 java.util.List<SecurityContext> getSecurityContexts()
          Returns all security contexts for the current user.
 BbSession getSession()
           
 boolean hasContentContext()
          Returns true if the ContentId is set for this Context
 boolean hasCourseContext()
          Returns true if the CourseId is set for this Context
 boolean hasGroupContext()
          Returns true if the GroupId is set for this Context
 boolean hasRequestContext()
          Returns true if the web Request information is set for this Context
 boolean hasSystemContext()
          Returns true if the Virtual Request information is set for this Context
 boolean hasUserContext()
          Returns true if the UserId is set for this Context
 java.lang.Object removeAttribute(java.lang.String name)
          Removes an arbitrary attribute for use in this context.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Sets an arbitrary attribute for use in this context.
 void setContextOverride(Context.OverrideType override)
          The context override is used to override the context that is implied from the request parameters.
 
Methods inherited from interface blackboard.platform.security.Entitled
getEntitlements
 

Field Detail

PARAM_NAME

static final java.lang.String PARAM_NAME
Standard name for the context param in request attributes

See Also:
Constant Field Values
Method Detail

hasContentContext

boolean hasContentContext()
Returns true if the ContentId is set for this Context


hasUserContext

boolean hasUserContext()
Returns true if the UserId is set for this Context


hasCourseContext

boolean hasCourseContext()
Returns true if the CourseId is set for this Context


hasGroupContext

boolean hasGroupContext()
Returns true if the GroupId is set for this Context


hasSystemContext

boolean hasSystemContext()
Returns true if the Virtual Request information is set for this Context


hasRequestContext

boolean hasRequestContext()
Returns true if the web Request information is set for this Context


setAttribute

void setAttribute(java.lang.String name,
                  java.lang.Object value)
Sets an arbitrary attribute for use in this context.


getAttribute

java.lang.Object getAttribute(java.lang.String name)
Gets an arbitrary attribute for use in this context.


getAttributes

java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Gets all the attributes in this context in the form of a HashMap.


removeAttribute

java.lang.Object removeAttribute(java.lang.String name)
Removes an arbitrary attribute for use in this context. Returns attribute being removed.


getSession

BbSession getSession()

setContextOverride

void setContextOverride(Context.OverrideType override)
The context override is used to override the context that is implied from the request parameters. This is especially useful for ensuring the locale is displayed correctly. One example of this is the Manage Course pages from the Admin Panel > Courses list page. These pages use course_id, which sets the course context, but the locale that should be displayed is the user's context, not the course's enforced context.

Parameters:
override - the context OverrideType to set. Possible values are as follows: ADMIN_PANEL

getContextOverride

Context.OverrideType getContextOverride()
returns the OverrideType of this Context object. The OverrideType is the type of context that should be used to determine things such as Locale when the implicit context type is insufficient.

Returns:
OverrideType

getSecurityContexts

java.util.List<SecurityContext> getSecurityContexts()
Returns all security contexts for the current user. This method is used by "cross-context" entitlements checks, in which the authorization request is for a context other than the current one. Extending the list of security contexts is handled by ContextHandler extensions.

Returns:
List of SecurityContext objects gathered for this request by all context handlers.


Copyright © 2003 Blackboard, Inc. All Rights Reserved.