Package com.adobe.acs.commons.util
Class OverridePathSlingRequestWrapper
- java.lang.Object
-
- javax.servlet.ServletRequestWrapper
-
- javax.servlet.http.HttpServletRequestWrapper
-
- org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper
-
- com.adobe.acs.commons.util.OverridePathSlingRequestWrapper
-
- All Implemented Interfaces:
javax.servlet.http.HttpServletRequest,javax.servlet.ServletRequest,org.apache.sling.api.adapter.Adaptable,org.apache.sling.api.SlingHttpServletRequest
public class OverridePathSlingRequestWrapper extends org.apache.sling.api.wrappers.SlingHttpServletRequestWrapperRequest wrapper to get the Resource and SlingBindings objects for a request scoped to a specified path. Among other things, this enables injection of sling models from a SlingHttpServletRequest object rather than simply a Resource, which is required by some sling models for full functionality.
-
-
Constructor Summary
Constructors Constructor Description OverridePathSlingRequestWrapper(org.apache.sling.api.SlingHttpServletRequest request, String path)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <AdapterType>
AdapterTypeadaptTo(Class<AdapterType> type)Overriding `adaptTo` to avoid using the original request as the adaptable.ObjectgetAttribute(String name)org.apache.sling.api.resource.ResourcegetResource()-
Methods inherited from class org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper
getCookie, getRequestDispatcher, getRequestDispatcher, getRequestDispatcher, getRequestParameter, getRequestParameterList, getRequestParameterMap, getRequestParameters, getRequestPathInfo, getRequestProgressTracker, getResourceBundle, getResourceBundle, getResourceResolver, getResponseContentType, getResponseContentTypes, getSlingRequest
-
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole, login, logout, upgrade
-
Methods inherited from class javax.servlet.ServletRequestWrapper
getAsyncContext, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsync
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.servlet.http.HttpServletRequest
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole, login, logout, upgrade
-
Methods inherited from interface javax.servlet.ServletRequest
getAsyncContext, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
-
-
-
-
Constructor Detail
-
OverridePathSlingRequestWrapper
public OverridePathSlingRequestWrapper(org.apache.sling.api.SlingHttpServletRequest request, String path)Constructor.- Parameters:
request- A valid sling request.path- Path to represent by this request wrapper.
-
-
Method Detail
-
getAttribute
public Object getAttribute(String name)
- Specified by:
getAttributein interfacejavax.servlet.ServletRequest- Overrides:
getAttributein classjavax.servlet.ServletRequestWrapper
-
getResource
public org.apache.sling.api.resource.Resource getResource()
- Specified by:
getResourcein interfaceorg.apache.sling.api.SlingHttpServletRequest- Overrides:
getResourcein classorg.apache.sling.api.wrappers.SlingHttpServletRequestWrapper
-
adaptTo
public <AdapterType> AdapterType adaptTo(Class<AdapterType> type)
Overriding `adaptTo` to avoid using the original request as the adaptable.- Specified by:
adaptToin interfaceorg.apache.sling.api.adapter.Adaptable- Overrides:
adaptToin classorg.apache.sling.api.wrappers.SlingHttpServletRequestWrapper
-
-