| java.lang.Object org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils
ScopedServletUtils | public class ScopedServletUtils (Code) | | Utilities for creating scoped wrapper versions of HttpRequest, HttpResponse, ServletContext. These
wrappers are the basis for a scoped servlet environment, which can be used to scope the Struts
framework.
|
Method Summary | |
public static String | decodeURI(HttpServletRequest request) | public static HttpServletRequest | getOuterRequest(HttpServletRequest request) Get the outer (unwrapped) request.
Parameters: request - the request to unwrap. | public static ServletRequest | getOuterServletRequest(ServletRequest request) Get the outer (unwrapped) request.
Parameters: request - the request to unwrap. | final public static String | getRelativeURI(HttpServletRequest request) Get the request URI, relative to the webapp root. | final public static String | getRelativeURI(HttpServletRequest request, String uri) Get a URI relative to the webapp root. | final public static String | getRelativeURI(String contextPath, String uri) Get a URI relative to a given webapp root. | public static String | getScopedName(String baseName, Object scopeKey) Get a scoped version of a given name.
Parameters: baseName - the name to be scoped. Parameters: scopeKey - the context key for scoping the name. | public static ScopedRequest | getScopedRequest(HttpServletRequest realRequest, String overrideURI, ServletContext servletContext, Object scopeKey) Get the cached ScopedRequest wrapper. | public static ScopedRequest | getScopedRequest(HttpServletRequest realRequest, String overrideURI, ServletContext servletContext, Object scopeKey, boolean seeOuterRequestAttributes) Get the cached ScopedRequest wrapper. | public static Object | getScopedRequestAttribute(String attrName, ServletRequest request) Get an attribute from the given request, and if it is a
ScopedRequest , ensure that the attribute
is not "showing through" from the outer request, even if the ScopedRequest allows that by
default. | public static ScopedResponse | getScopedResponse(HttpServletResponse realResponse, ScopedRequest scopedRequest) Get the cached wrapper servlet response. | public static Object | getScopedSessionAttr(String attrName, HttpServletRequest request) If the request is a ScopedRequest, this returns an attribute whose name is scoped to that request's scope-ID;
otherwise, it is a straight passthrough to
HttpSession.getAttribute . | public static String | getScopedSessionAttrName(String attrName, HttpServletRequest request) If the request is a ScopedRequest, this returns an attribute name scoped to
that request's scope-ID; otherwise, it returns the given attribute name. | public static String | normalizeURI(String uri) Resolve "." and ".." in a URI. | public static void | removeScopedSessionAttr(String attrName, HttpServletRequest request) If the request is a ScopedRequest, this removes an attribute whose name is scoped to that request's scope-ID;
otherwise, it is a straight passthrough to
HttpSession.removeAttribute . | public static void | renameScope(Object oldScopeKey, Object newScopeKey, HttpServletRequest request) Find all scoped objects (
ScopedRequest ,
ScopedResponse )
which have a certain scope-key, replaces this scope-key with the new one, and re-caches the objects
the new scope-key. | public static void | setScopedSessionAttr(String attrName, Object val, HttpServletRequest request) If the request is a ScopedRequest, this sets an attribute whose name is scoped to that request's scope-ID;
otherwise, it is a straight passthrough to
HttpSession.setAttribute . | public static ScopedRequest | unwrapRequest(ServletRequest request) Unwraps the contained ScopedRequest from the given ServletRequest, which may be a
ServletRequestWrapper.
Parameters: request - the ScopedRequest, or a wrapper (ServletRequestWrapper) around it. | public static ScopedResponse | unwrapResponse(ServletResponse response) Unwraps the contained ScopedResponseImpl from the given ServletResponse, which may be a
ServletResponseWrapper.
Parameters: response - the ScopedResponse, or a wrapper (ServletResponseWrapper) around it. |
SCOPE_ID_PARAM | final public static String SCOPE_ID_PARAM(Code) | | |
getOuterRequest | public static HttpServletRequest getOuterRequest(HttpServletRequest request)(Code) | | Get the outer (unwrapped) request.
Parameters: request - the request to unwrap. the outer request, if the given request is a ScopedRequest (or wraps a ScopedRequest);otherwise, the given request itself. |
getOuterServletRequest | public static ServletRequest getOuterServletRequest(ServletRequest request)(Code) | | Get the outer (unwrapped) request.
Parameters: request - the request to unwrap. the outer request, if the given request is a ScopedRequest (or wraps a ScopedRequest);otherwise, the given request itself. |
getRelativeURI | final public static String getRelativeURI(HttpServletRequest request)(Code) | | Get the request URI, relative to the webapp root.
Parameters: request - the current HttpServletRequest. |
getRelativeURI | final public static String getRelativeURI(HttpServletRequest request, String uri)(Code) | | Get a URI relative to the webapp root.
Parameters: request - the current HttpServletRequest. Parameters: uri - the URI which should be made relative. |
getRelativeURI | final public static String getRelativeURI(String contextPath, String uri)(Code) | | Get a URI relative to a given webapp root.
Parameters: contextPath - the webapp context path, e.g., "/myWebapp" Parameters: uri - the URI which should be made relative. |
getScopedName | public static String getScopedName(String baseName, Object scopeKey)(Code) | | Get a scoped version of a given name.
Parameters: baseName - the name to be scoped. Parameters: scopeKey - the context key for scoping the name. a scoped version of the given name. |
getScopedRequest | public static ScopedRequest getScopedRequest(HttpServletRequest realRequest, String overrideURI, ServletContext servletContext, Object scopeKey, boolean seeOuterRequestAttributes)(Code) | | Get the cached ScopedRequest wrapper. If none exists, creates one and caches it.
Parameters: realRequest - the "real" (outer) HttpServletRequest, which will be wrapped. Parameters: overrideURI - the request-URI for the wrapped object. This URI must begin with the context path. Parameters: servletContext - the current ServletContext. Parameters: scopeKey - the scope-key associated with the new (or looked-up) scoped request. Parameters: seeOuterRequestAttributes - if true , a request attribute will be "seen" in the outer request,if it is not found within the scoped request; if false , attributes are only seen whenthey are present in the scoped request. the cached (or newly-created) ScopedRequest. |
getScopedRequestAttribute | public static Object getScopedRequestAttribute(String attrName, ServletRequest request)(Code) | | Get an attribute from the given request, and if it is a
ScopedRequest , ensure that the attribute
is not "showing through" from the outer request, even if the ScopedRequest allows that by
default.
|
getScopedResponse | public static ScopedResponse getScopedResponse(HttpServletResponse realResponse, ScopedRequest scopedRequest)(Code) | | Get the cached wrapper servlet response. If none exists, creates one and caches it.
Parameters: realResponse - the "real" (outer) ServletResponse, which will be wrapped. Parameters: scopedRequest - the ScopedRequest returned from ScopedServletUtils.getScopedRequest. the cached (or newly-created) ScopedResponse. |
getScopedSessionAttrName | public static String getScopedSessionAttrName(String attrName, HttpServletRequest request)(Code) | | If the request is a ScopedRequest, this returns an attribute name scoped to
that request's scope-ID; otherwise, it returns the given attribute name.
|
normalizeURI | public static String normalizeURI(String uri)(Code) | | Resolve "." and ".." in a URI.
|
removeScopedSessionAttr | public static void removeScopedSessionAttr(String attrName, HttpServletRequest request)(Code) | | If the request is a ScopedRequest, this removes an attribute whose name is scoped to that request's scope-ID;
otherwise, it is a straight passthrough to
HttpSession.removeAttribute .
|
renameScope | public static void renameScope(Object oldScopeKey, Object newScopeKey, HttpServletRequest request)(Code) | | Find all scoped objects (
ScopedRequest ,
ScopedResponse )
which have a certain scope-key, replaces this scope-key with the new one, and re-caches the objects
the new scope-key.
Parameters: oldScopeKey - Parameters: newScopeKey - Parameters: request - the real (outer) request, where the scoped objects are cached. |
unwrapRequest | public static ScopedRequest unwrapRequest(ServletRequest request)(Code) | | Unwraps the contained ScopedRequest from the given ServletRequest, which may be a
ServletRequestWrapper.
Parameters: request - the ScopedRequest, or a wrapper (ServletRequestWrapper) around it. the unwrapped ScopedRequest. |
unwrapResponse | public static ScopedResponse unwrapResponse(ServletResponse response)(Code) | | Unwraps the contained ScopedResponseImpl from the given ServletResponse, which may be a
ServletResponseWrapper.
Parameters: response - the ScopedResponse, or a wrapper (ServletResponseWrapper) around it. the unwrapped ScopedResponseImpl. |
|
|