Class AbstractRequestAttributesScope

java.lang.Object
org.springframework.web.context.request.AbstractRequestAttributesScope
All Implemented Interfaces:
org.springframework.beans.factory.config.Scope
Direct Known Subclasses:
RequestScope, SessionScope

public abstract class AbstractRequestAttributesScope extends Object implements org.springframework.beans.factory.config.Scope
Abstract Scope implementation that reads from a particular scope in the current thread-bound RequestAttributes object.

Subclasses simply need to implement getScope() to instruct this class which RequestAttributes scope to read attributes from.

Subclasses may wish to override the get(String, ObjectFactory) and remove(String) methods to add synchronization around the call back into this superclass.

Since:
2.0
Author:
Rod Johnson, Juergen Hoeller, Rob Harrop
  • Constructor Details

    • AbstractRequestAttributesScope

      public AbstractRequestAttributesScope()
  • Method Details

    • get

      public Object get(String name, org.springframework.beans.factory.ObjectFactory<?> objectFactory)
      Specified by:
      get in interface org.springframework.beans.factory.config.Scope
    • remove

      public @Nullable Object remove(String name)
      Specified by:
      remove in interface org.springframework.beans.factory.config.Scope
    • registerDestructionCallback

      public void registerDestructionCallback(String name, Runnable callback)
      Specified by:
      registerDestructionCallback in interface org.springframework.beans.factory.config.Scope
    • resolveContextualObject

      public @Nullable Object resolveContextualObject(String key)
      Specified by:
      resolveContextualObject in interface org.springframework.beans.factory.config.Scope
    • getScope

      protected abstract int getScope()
      Template method that determines the actual target scope.
      Returns:
      the target scope, in the form of an appropriate RequestAttributes constant
      See Also: