Package org.springframework.web.context.request

# 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(java.lang.String, org.springframework.beans.factory.ObjectFactory<?>)` and `remove(java.lang.String)` methods to add synchronization around the call back into this superclass.

Since:
  2.0
Author:
  Rod Johnson, Juergen Hoeller, Rob Harrop

## Constructor Summary

Constructors
Constructor
Description
`AbstractRequestAttributesScope()`

## Method Summary

Modifier and Type
Method
Description
`Object`
`get(String name, org.springframework.beans.factory.ObjectFactory<?> objectFactory)`
`protected abstract int`
`getScope()`
Template method that determines the actual target scope.
`void`
`registerDestructionCallback(String name, Runnable callback)`
`Object`
`remove(String name)`
`Object`
`resolveContextualObject(String key)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.beans.factory.config.Scope

`getConversationId`

## 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

@Nullable public 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

@Nullable public 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:
  - `RequestAttributes.SCOPE_REQUEST`
  - `RequestAttributes.SCOPE_SESSION`