public class

ContextExposingHttpServletRequest

extends HttpServletRequestWrapper
java.lang.Object
   ↳ javax.servlet.ServletRequestWrapper
     ↳ javax.servlet.http.HttpServletRequestWrapper
       ↳ org.springframework.web.context.support.ContextExposingHttpServletRequest

Class Overview

HttpServletRequest decorator that makes all Spring beans in a given WebApplicationContext accessible as request attributes, through lazy checking once an attribute gets accessed.

Summary

[Expand]
Inherited Constants
From interface javax.servlet.http.HttpServletRequest
Public Constructors
ContextExposingHttpServletRequest(HttpServletRequest originalRequest, WebApplicationContext context)
Create a new ContextExposingHttpServletRequest for the given request.
ContextExposingHttpServletRequest(HttpServletRequest originalRequest, WebApplicationContext context, Set<String> exposedContextBeanNames)
Create a new ContextExposingHttpServletRequest for the given request.
Public Methods
Object getAttribute(String name)
final WebApplicationContext getWebApplicationContext()
Return the WebApplicationContext that this request runs in.
void setAttribute(String name, Object value)
[Expand]
Inherited Methods
From class javax.servlet.http.HttpServletRequestWrapper
From class javax.servlet.ServletRequestWrapper
From class java.lang.Object
From interface javax.servlet.ServletRequest
From interface javax.servlet.http.HttpServletRequest

Public Constructors

public ContextExposingHttpServletRequest (HttpServletRequest originalRequest, WebApplicationContext context)

Create a new ContextExposingHttpServletRequest for the given request.

Parameters
originalRequest the original HttpServletRequest
context the WebApplicationContext that this request runs in

public ContextExposingHttpServletRequest (HttpServletRequest originalRequest, WebApplicationContext context, Set<String> exposedContextBeanNames)

Create a new ContextExposingHttpServletRequest for the given request.

Parameters
originalRequest the original HttpServletRequest
context the WebApplicationContext that this request runs in
exposedContextBeanNames the names of beans in the context which are supposed to be exposed (if this is non-null, only the beans in this Set are eligible for exposure as attributes)

Public Methods

public Object getAttribute (String name)

public final WebApplicationContext getWebApplicationContext ()

Return the WebApplicationContext that this request runs in.

public void setAttribute (String name, Object value)