Class DemuxRequest
- java.lang.Object
-
- de.aristaflow.adept2.base.servletcontainer.demux.DemuxRequest
-
- All Implemented Interfaces:
javax.servlet.http.HttpServletRequest,javax.servlet.ServletRequest
public class DemuxRequest extends Object implements javax.servlet.http.HttpServletRequest
ADemuxRequestwraps aHttpServletRequestand adapts its paths. This is required to demultiplex the request properly, i. e. the paths valid for theDemuxServletneed to be adapted for the inner servlets so that theDemuxServletbecomes invisible for them. This is done by "moving" the servlet path of theDemuxServletto the context path and "moving" the path of the inner servlet (more or less its mapping) from the path info to the servlet path.
Also the servlet context is being changed. All other methods simply forward to the parent request.- See Also:
getServletContext(),getPathInfo(),getContextPath(),getServletPath()
-
-
Field Summary
Fields Modifier and Type Field Description protected StringdemuxContextPathThe context path of the demultiplexing servlet.protected javax.servlet.ServletContextdscThe (deferred) servlet context.protected javax.servlet.http.HttpServletRequestparentThe (wrapped) parent request (of the outerDemuxServlet).protected StringpathInfoThe path info the inner servlet.protected StringservletPathThe servlet path of the inner servlet.
-
Constructor Summary
Constructors Modifier Constructor Description protectedDemuxRequest(javax.servlet.ServletContext dsc, String demuxContextPath, String servletPath, javax.servlet.http.HttpServletRequest parent)Creates a new request handled by aDemuxServlet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanauthenticate(javax.servlet.http.HttpServletResponse response)StringchangeSessionId()javax.servlet.AsyncContextgetAsyncContext()ObjectgetAttribute(String name)Enumeration<String>getAttributeNames()StringgetAuthType()StringgetCharacterEncoding()intgetContentLength()longgetContentLengthLong()StringgetContentType()StringgetContextPath()Gets the context for the inner servlet adapted from the context path of theDemuxServlethandling this request.javax.servlet.http.Cookie[]getCookies()longgetDateHeader(String name)javax.servlet.DispatcherTypegetDispatcherType()StringgetHeader(String name)Enumeration<String>getHeaderNames()Enumeration<String>getHeaders(String name)javax.servlet.ServletInputStreamgetInputStream()intgetIntHeader(String name)StringgetLocalAddr()LocalegetLocale()Enumeration<Locale>getLocales()StringgetLocalName()intgetLocalPort()StringgetMethod()StringgetParameter(String name)Map<String,String[]>getParameterMap()Enumeration<String>getParameterNames()String[]getParameterValues(String name)javax.servlet.http.PartgetPart(String name)Collection<javax.servlet.http.Part>getParts()StringgetPathInfo()Gets the path info for the inner servlet adapted from the path info of theDemuxServlethandling this request.StringgetPathTranslated()StringgetProtocol()StringgetQueryString()BufferedReadergetReader()StringgetRealPath(String path)StringgetRemoteAddr()StringgetRemoteHost()intgetRemotePort()StringgetRemoteUser()javax.servlet.RequestDispatchergetRequestDispatcher(String path)StringgetRequestedSessionId()StringgetRequestURI()StringBuffergetRequestURL()StringgetScheme()StringgetServerName()intgetServerPort()javax.servlet.ServletContextgetServletContext()Gets theDeferredServletContextof theDemuxServlethandling this request.StringgetServletPath()Gets the servlet path for the inner servlet adapted from the servlet path of theDemuxServlethandling this request.javax.servlet.http.HttpSessiongetSession()javax.servlet.http.HttpSessiongetSession(boolean create)PrincipalgetUserPrincipal()booleanisAsyncStarted()booleanisAsyncSupported()booleanisRequestedSessionIdFromCookie()booleanisRequestedSessionIdFromUrl()booleanisRequestedSessionIdFromURL()booleanisRequestedSessionIdValid()booleanisSecure()booleanisUserInRole(String role)voidlogin(String username, String password)voidlogout()voidremoveAttribute(String name)voidsetAttribute(String name, Object o)voidsetCharacterEncoding(String env)javax.servlet.AsyncContextstartAsync()javax.servlet.AsyncContextstartAsync(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse)<T extends javax.servlet.http.HttpUpgradeHandler>
Tupgrade(Class<T> handlerClass)
-
-
-
Field Detail
-
dsc
protected final javax.servlet.ServletContext dsc
The (deferred) servlet context.
-
demuxContextPath
protected final String demuxContextPath
The context path of the demultiplexing servlet.
-
servletPath
protected final String servletPath
The servlet path of the inner servlet.
-
pathInfo
protected final String pathInfo
The path info the inner servlet.
-
parent
protected final javax.servlet.http.HttpServletRequest parent
The (wrapped) parent request (of the outerDemuxServlet).
-
-
Constructor Detail
-
DemuxRequest
protected DemuxRequest(javax.servlet.ServletContext dsc, String demuxContextPath, String servletPath, javax.servlet.http.HttpServletRequest parent)Creates a new request handled by aDemuxServlet. This adapts the servlet context and the paths of the designated parent request appropriately for theDemuxServlet.- Parameters:
dsc- The (deferred) servlet context.demuxContextPath- The context path of the demultiplexing servlet.servletPath- The servlet path of the inner servlet.parent- The (wrapped) parent request (of the outerDemuxServlet)
-
-
Method Detail
-
getAttribute
public Object getAttribute(String name)
- Specified by:
getAttributein interfacejavax.servlet.ServletRequest
-
getAttributeNames
public Enumeration<String> getAttributeNames()
- Specified by:
getAttributeNamesin interfacejavax.servlet.ServletRequest
-
getCharacterEncoding
public String getCharacterEncoding()
- Specified by:
getCharacterEncodingin interfacejavax.servlet.ServletRequest
-
setCharacterEncoding
public void setCharacterEncoding(String env) throws UnsupportedEncodingException
- Specified by:
setCharacterEncodingin interfacejavax.servlet.ServletRequest- Throws:
UnsupportedEncodingException
-
getContentLength
public int getContentLength()
- Specified by:
getContentLengthin interfacejavax.servlet.ServletRequest
-
getContentLengthLong
public long getContentLengthLong()
- Specified by:
getContentLengthLongin interfacejavax.servlet.ServletRequest
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfacejavax.servlet.ServletRequest
-
getInputStream
public javax.servlet.ServletInputStream getInputStream() throws IOException- Specified by:
getInputStreamin interfacejavax.servlet.ServletRequest- Throws:
IOException
-
getParameter
public String getParameter(String name)
- Specified by:
getParameterin interfacejavax.servlet.ServletRequest
-
getParameterNames
public Enumeration<String> getParameterNames()
- Specified by:
getParameterNamesin interfacejavax.servlet.ServletRequest
-
getParameterValues
public String[] getParameterValues(String name)
- Specified by:
getParameterValuesin interfacejavax.servlet.ServletRequest
-
getParameterMap
public Map<String,String[]> getParameterMap()
- Specified by:
getParameterMapin interfacejavax.servlet.ServletRequest
-
getProtocol
public String getProtocol()
- Specified by:
getProtocolin interfacejavax.servlet.ServletRequest
-
getScheme
public String getScheme()
- Specified by:
getSchemein interfacejavax.servlet.ServletRequest
-
getServerName
public String getServerName()
- Specified by:
getServerNamein interfacejavax.servlet.ServletRequest
-
getServerPort
public int getServerPort()
- Specified by:
getServerPortin interfacejavax.servlet.ServletRequest
-
getReader
public BufferedReader getReader() throws IOException
- Specified by:
getReaderin interfacejavax.servlet.ServletRequest- Throws:
IOException
-
getRemoteAddr
public String getRemoteAddr()
- Specified by:
getRemoteAddrin interfacejavax.servlet.ServletRequest
-
getRemoteHost
public String getRemoteHost()
- Specified by:
getRemoteHostin interfacejavax.servlet.ServletRequest
-
setAttribute
public void setAttribute(String name, Object o)
- Specified by:
setAttributein interfacejavax.servlet.ServletRequest
-
removeAttribute
public void removeAttribute(String name)
- Specified by:
removeAttributein interfacejavax.servlet.ServletRequest
-
getLocale
public Locale getLocale()
- Specified by:
getLocalein interfacejavax.servlet.ServletRequest
-
getLocales
public Enumeration<Locale> getLocales()
- Specified by:
getLocalesin interfacejavax.servlet.ServletRequest
-
isSecure
public boolean isSecure()
- Specified by:
isSecurein interfacejavax.servlet.ServletRequest
-
getRequestDispatcher
public javax.servlet.RequestDispatcher getRequestDispatcher(String path)
- Specified by:
getRequestDispatcherin interfacejavax.servlet.ServletRequest
-
getRealPath
public String getRealPath(String path)
- Specified by:
getRealPathin interfacejavax.servlet.ServletRequest
-
getRemotePort
public int getRemotePort()
- Specified by:
getRemotePortin interfacejavax.servlet.ServletRequest
-
getLocalName
public String getLocalName()
- Specified by:
getLocalNamein interfacejavax.servlet.ServletRequest
-
getLocalAddr
public String getLocalAddr()
- Specified by:
getLocalAddrin interfacejavax.servlet.ServletRequest
-
getLocalPort
public int getLocalPort()
- Specified by:
getLocalPortin interfacejavax.servlet.ServletRequest
-
getServletContext
public javax.servlet.ServletContext getServletContext()
Gets theDeferredServletContextof theDemuxServlethandling this request.- Specified by:
getServletContextin interfacejavax.servlet.ServletRequest
-
startAsync
public javax.servlet.AsyncContext startAsync() throws IllegalStateException- Specified by:
startAsyncin interfacejavax.servlet.ServletRequest- Throws:
IllegalStateException
-
startAsync
public javax.servlet.AsyncContext startAsync(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws IllegalStateException- Specified by:
startAsyncin interfacejavax.servlet.ServletRequest- Throws:
IllegalStateException
-
isAsyncStarted
public boolean isAsyncStarted()
- Specified by:
isAsyncStartedin interfacejavax.servlet.ServletRequest
-
isAsyncSupported
public boolean isAsyncSupported()
- Specified by:
isAsyncSupportedin interfacejavax.servlet.ServletRequest
-
getAsyncContext
public javax.servlet.AsyncContext getAsyncContext()
- Specified by:
getAsyncContextin interfacejavax.servlet.ServletRequest
-
getDispatcherType
public javax.servlet.DispatcherType getDispatcherType()
- Specified by:
getDispatcherTypein interfacejavax.servlet.ServletRequest
-
getAuthType
public String getAuthType()
- Specified by:
getAuthTypein interfacejavax.servlet.http.HttpServletRequest
-
getCookies
public javax.servlet.http.Cookie[] getCookies()
- Specified by:
getCookiesin interfacejavax.servlet.http.HttpServletRequest
-
getDateHeader
public long getDateHeader(String name)
- Specified by:
getDateHeaderin interfacejavax.servlet.http.HttpServletRequest
-
getHeader
public String getHeader(String name)
- Specified by:
getHeaderin interfacejavax.servlet.http.HttpServletRequest
-
getHeaders
public Enumeration<String> getHeaders(String name)
- Specified by:
getHeadersin interfacejavax.servlet.http.HttpServletRequest
-
getHeaderNames
public Enumeration<String> getHeaderNames()
- Specified by:
getHeaderNamesin interfacejavax.servlet.http.HttpServletRequest
-
getIntHeader
public int getIntHeader(String name)
- Specified by:
getIntHeaderin interfacejavax.servlet.http.HttpServletRequest
-
getMethod
public String getMethod()
- Specified by:
getMethodin interfacejavax.servlet.http.HttpServletRequest
-
getPathInfo
public String getPathInfo()
Gets the path info for the inner servlet adapted from the path info of theDemuxServlethandling this request.- Specified by:
getPathInfoin interfacejavax.servlet.http.HttpServletRequest
-
getPathTranslated
public String getPathTranslated()
- Specified by:
getPathTranslatedin interfacejavax.servlet.http.HttpServletRequest
-
getContextPath
public String getContextPath()
Gets the context for the inner servlet adapted from the context path of theDemuxServlethandling this request.- Specified by:
getContextPathin interfacejavax.servlet.http.HttpServletRequest
-
getQueryString
public String getQueryString()
- Specified by:
getQueryStringin interfacejavax.servlet.http.HttpServletRequest
-
getRemoteUser
public String getRemoteUser()
- Specified by:
getRemoteUserin interfacejavax.servlet.http.HttpServletRequest
-
isUserInRole
public boolean isUserInRole(String role)
- Specified by:
isUserInRolein interfacejavax.servlet.http.HttpServletRequest
-
getUserPrincipal
public Principal getUserPrincipal()
- Specified by:
getUserPrincipalin interfacejavax.servlet.http.HttpServletRequest
-
getRequestedSessionId
public String getRequestedSessionId()
- Specified by:
getRequestedSessionIdin interfacejavax.servlet.http.HttpServletRequest
-
getRequestURI
public String getRequestURI()
- Specified by:
getRequestURIin interfacejavax.servlet.http.HttpServletRequest
-
getRequestURL
public StringBuffer getRequestURL()
- Specified by:
getRequestURLin interfacejavax.servlet.http.HttpServletRequest
-
getServletPath
public String getServletPath()
Gets the servlet path for the inner servlet adapted from the servlet path of theDemuxServlethandling this request.- Specified by:
getServletPathin interfacejavax.servlet.http.HttpServletRequest
-
getSession
public javax.servlet.http.HttpSession getSession(boolean create)
- Specified by:
getSessionin interfacejavax.servlet.http.HttpServletRequest
-
getSession
public javax.servlet.http.HttpSession getSession()
- Specified by:
getSessionin interfacejavax.servlet.http.HttpServletRequest
-
changeSessionId
public String changeSessionId()
- Specified by:
changeSessionIdin interfacejavax.servlet.http.HttpServletRequest
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()
- Specified by:
isRequestedSessionIdValidin interfacejavax.servlet.http.HttpServletRequest
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()
- Specified by:
isRequestedSessionIdFromCookiein interfacejavax.servlet.http.HttpServletRequest
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()
- Specified by:
isRequestedSessionIdFromURLin interfacejavax.servlet.http.HttpServletRequest
-
isRequestedSessionIdFromUrl
public boolean isRequestedSessionIdFromUrl()
- Specified by:
isRequestedSessionIdFromUrlin interfacejavax.servlet.http.HttpServletRequest
-
authenticate
public boolean authenticate(javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException- Specified by:
authenticatein interfacejavax.servlet.http.HttpServletRequest- Throws:
IOExceptionjavax.servlet.ServletException
-
login
public void login(String username, String password) throws javax.servlet.ServletException
- Specified by:
loginin interfacejavax.servlet.http.HttpServletRequest- Throws:
javax.servlet.ServletException
-
logout
public void logout() throws javax.servlet.ServletException- Specified by:
logoutin interfacejavax.servlet.http.HttpServletRequest- Throws:
javax.servlet.ServletException
-
getParts
public Collection<javax.servlet.http.Part> getParts() throws IOException, javax.servlet.ServletException
- Specified by:
getPartsin interfacejavax.servlet.http.HttpServletRequest- Throws:
IOExceptionjavax.servlet.ServletException
-
getPart
public javax.servlet.http.Part getPart(String name) throws IOException, javax.servlet.ServletException
- Specified by:
getPartin interfacejavax.servlet.http.HttpServletRequest- Throws:
IOExceptionjavax.servlet.ServletException
-
upgrade
public <T extends javax.servlet.http.HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, javax.servlet.ServletException
- Specified by:
upgradein interfacejavax.servlet.http.HttpServletRequest- Throws:
IOExceptionjavax.servlet.ServletException
-
-