Class AttributesContext

  • All Implemented Interfaces:
    Context

    public final class AttributesContext
    extends AbstractContext
    An AttributesContext is a mechanism for transferring transient state between components when processing a single request. For example, a filter may store information about the end-user in the AttributeContext which can then be accessed in subsequent filters and handlers in order to perform access control decisions, routing decisions, etc.

    The AttributesContext has the same life-cycle as the request with which it is associated. Specifically, any attributes stored when processing one request will not be accessible when processing a subsequent request, even if it is from the same logical client.

    Use a SessionContext for maintaining state between successive requests from the same logical client.

    • Constructor Detail

      • AttributesContext

        public AttributesContext​(Context parent)
        Constructs a new AttributesContext.
        Parameters:
        parent - The parent Context.
      • AttributesContext

        public AttributesContext​(JsonValue savedContext,
                                 ClassLoader classLoader)
        Restore from JSON representation.
        Parameters:
        savedContext - The JSON representation from which this context's attributes should be parsed.
        classLoader - The ClassLoader which can properly resolve the persisted class-name.
    • Method Detail

      • getAttributes

        public Map<String,​Object> getAttributes()
        Returns the attributes associated with the current request.
        Returns:
        The attributes associated with the current request.