public class

ServletRequestAttributes

extends AbstractRequestAttributes
java.lang.Object
   ↳ org.springframework.web.context.request.AbstractRequestAttributes
     ↳ org.springframework.web.context.request.ServletRequestAttributes
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Servlet-based implementation of the RequestAttributes interface.

Accesses objects from servlet request and HTTP session scope, with no distinction between "session" and "global session".

Summary

[Expand]
Inherited Constants
From interface org.springframework.web.context.request.RequestAttributes
Fields
public static final String DESTRUCTION_CALLBACK_NAME_PREFIX Constant identifying the String prefixed to the name of a destruction callback when it is stored in a HttpSession.
[Expand]
Inherited Fields
From class org.springframework.web.context.request.AbstractRequestAttributes
Public Constructors
ServletRequestAttributes(HttpServletRequest request)
Create a new ServletRequestAttributes instance for the given request.
Public Methods
Object getAttribute(String name, int scope)
String[] getAttributeNames(int scope)
final HttpServletRequest getRequest()
Exposes the native HttpServletRequest that we're wrapping.
String getSessionId()
Object getSessionMutex()
void registerDestructionCallback(String name, Runnable callback, int scope)
void removeAttribute(String name, int scope)
Object resolveReference(String key)
void setAttribute(String name, Object value, int scope)
String toString()
Protected Methods
final HttpSession getSession(boolean allowCreate)
Exposes the HttpSession that we're wrapping.
void registerSessionDestructionCallback(String name, Runnable callback)
Register the given callback as to be executed after session termination.
void updateAccessedSessionAttributes()
Update all accessed session attributes through session.setAttribute calls, explicitly indicating to the container that they might have been modified.
[Expand]
Inherited Methods
From class org.springframework.web.context.request.AbstractRequestAttributes
From class java.lang.Object
From interface org.springframework.web.context.request.RequestAttributes

Fields

public static final String DESTRUCTION_CALLBACK_NAME_PREFIX

Constant identifying the String prefixed to the name of a destruction callback when it is stored in a HttpSession.

Public Constructors

public ServletRequestAttributes (HttpServletRequest request)

Create a new ServletRequestAttributes instance for the given request.

Parameters
request current HTTP request

Public Methods

public Object getAttribute (String name, int scope)

public String[] getAttributeNames (int scope)

public final HttpServletRequest getRequest ()

Exposes the native HttpServletRequest that we're wrapping.

public String getSessionId ()

public Object getSessionMutex ()

public void registerDestructionCallback (String name, Runnable callback, int scope)

public void removeAttribute (String name, int scope)

public Object resolveReference (String key)

public void setAttribute (String name, Object value, int scope)

public String toString ()

Protected Methods

protected final HttpSession getSession (boolean allowCreate)

Exposes the HttpSession that we're wrapping.

Parameters
allowCreate whether to allow creation of a new session if none exists yet

protected void registerSessionDestructionCallback (String name, Runnable callback)

Register the given callback as to be executed after session termination.

Note: The callback object should be serializable in order to survive web app restarts.

Parameters
name the name of the attribute to register the callback for
callback the callback to be executed for destruction

protected void updateAccessedSessionAttributes ()

Update all accessed session attributes through session.setAttribute calls, explicitly indicating to the container that they might have been modified.