Package cloud.piranha.webapp.impl
Class DefaultWebApplicationRequest
- java.lang.Object
-
- java.io.InputStream
-
- javax.servlet.ServletInputStream
-
- cloud.piranha.webapp.impl.DefaultWebApplicationRequest
-
- All Implemented Interfaces:
WebApplicationRequest
,Closeable
,AutoCloseable
,HttpServletRequest
,ServletRequest
- Direct Known Subclasses:
DefaultWebApplicationServerRequest
,EmbeddedRequest
,NanoRequest
public class DefaultWebApplicationRequest extends ServletInputStream implements WebApplicationRequest
The default WebApplicationRequest.- Author:
- Manfred Riem ([email protected])
-
-
Field Summary
Fields Modifier and Type Field Description protected AsyncContext
asyncContext
Stores the async context.protected boolean
asyncStarted
Stores if async is started.protected boolean
asyncSupported
Stores if async is supported.protected AttributeManager
attributeManager
Stores the attribute manager.protected String
authType
Stores the auth type.protected String
characterEncoding
Stores the character encoding.protected long
contentLength
Stores the content length.protected String
contentType
Stores the content type.protected String
contextPath
Stores the context path.protected Cookie[]
cookies
Stores the cookies.protected String
currentSessionId
Stores the current session id.protected DispatcherType
dispatcherType
Stores the dispatcher type.protected boolean
gotInputStream
Stores the gotInputStream flag.protected boolean
gotReader
Stores the gotReader flag.protected HttpHeaderManager
headerManager
Stores the header manager.protected InputStream
inputStream
Stores the input stream.protected String
localAddress
Stores the local address.protected String
localName
Stores the local name.protected int
localPort
Stores the local port.protected String
method
Stores the method.protected HashMap<String,String[]>
parameters
Stores the parameters.protected boolean
parametersParsed
Stores the parameters parsed flag.protected String
pathInfo
Stores the path info.protected String
protocol
Stores the protocol.protected String
queryString
Stores the query string.protected BufferedReader
reader
Stores the reader.protected String
remoteAddr
Stores the remote address.protected String
remoteHost
Stores the remote host.protected int
remotePort
Stores the remote port.protected String
requestedSessionId
Stores the requested session id.protected boolean
requestedSessionIdFromCookie
Stores the requested session id from cookie flag.protected boolean
requestedSessionIdFromURL
Stores the requested session id from url flag.protected String
scheme
Stores the scheme.protected String
serverName
Stores the server name.protected int
serverPort
Stores the server port.protected String
servletPath
Stores the servlet path.protected boolean
upgraded
Stores the upgraded flag.protected HttpUpgradeHandler
upgradeHandler
Stores the upgrade handler.protected Principal
userPrincipal
Stores the user principal.protected WebApplication
webApplication
Stores the web application-
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
-
-
Constructor Summary
Constructors Constructor Description DefaultWebApplicationRequest()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
authenticate(HttpServletResponse response)
Authenticate.String
changeSessionId()
Change the session id.AsyncContext
getAsyncContext()
Get the async context.Object
getAttribute(String name)
Get the attribute.Enumeration<String>
getAttributeNames()
Get attribute names.String
getAuthType()
Get the auth type.String
getCharacterEncoding()
Get the character encoding.int
getContentLength()
Get the content length.long
getContentLengthLong()
Get the content length.String
getContentType()
Get the content type.String
getContextPath()
Get the context path.Cookie[]
getCookies()
Get the cookies.long
getDateHeader(String name)
Get the date header.DispatcherType
getDispatcherType()
Get the dispatcher type.String
getHeader(String name)
Get the header.Enumeration<String>
getHeaderNames()
Get the header names.Enumeration<String>
getHeaders(String name)
Get the headers.ServletInputStream
getInputStream()
Get the input stream.int
getIntHeader(String name)
Get the int header.String
getLocalAddr()
Get the local address.Locale
getLocale()
Get locale.Enumeration<Locale>
getLocales()
Get the locales.String
getLocalName()
Get the local name.int
getLocalPort()
Get the local port.String
getMethod()
Get the request method.String
getParameter(String name)
Get the parameter.Map<String,String[]>
getParameterMap()
Get the parameter map.Enumeration<String>
getParameterNames()
Get the parameter names.protected void
getParametersFromRequest()
Get the parameters from the request.String[]
getParameterValues(String name)
Get the parameter values.Part
getPart(String name)
Get the part.Collection<Part>
getParts()
Get the parts.String
getPathInfo()
Get the path info.String
getPathTranslated()
Get the translated path.String
getProtocol()
Get the protocol.String
getQueryString()
Get the query string.BufferedReader
getReader()
Get the reader.String
getRealPath(String path)
Deprecated.String
getRemoteAddr()
Get the remote address.String
getRemoteHost()
Get the remote host.int
getRemotePort()
Get the remote port.String
getRemoteUser()
Get the remote user.RequestDispatcher
getRequestDispatcher(String path)
Get the request dispatcher.String
getRequestedSessionId()
Get the requested session id.String
getRequestURI()
Get the request URI.StringBuffer
getRequestURL()
Get the request URL.String
getScheme()
Get the scheme.String
getServerName()
Get the server name.int
getServerPort()
Get the server port.WebApplication
getServletContext()
Get the servlet context.String
getServletPath()
Get the servlet path.HttpSession
getSession()
Get the session.HttpSession
getSession(boolean create)
Get the session.HttpUpgradeHandler
getUpgradeHandler()
Get the upgrade handler.Principal
getUserPrincipal()
Get the user principal.boolean
isAsyncStarted()
Is async started.boolean
isAsyncSupported()
Is async supported.boolean
isFinished()
Is the Servlet input stream finished?boolean
isReady()
Is the Servlet input stream ready?boolean
isRequestedSessionIdFromCookie()
Is the requested session id from cookie.boolean
isRequestedSessionIdFromUrl()
Deprecated.boolean
isRequestedSessionIdFromURL()
Is the requested session id from the request url.boolean
isRequestedSessionIdValid()
Is the requested session id valid?boolean
isSecure()
Is the request secure.boolean
isUpgraded()
Is the request upgraded.boolean
isUserInRole(String role)
Is the user in the specified role.void
login(String username, String password)
Login.void
logout()
Logout.int
read()
Read from the Servlet input stream.void
removeAttribute(String name)
Remove the attribute.void
setAsyncSupported(boolean asyncSupported)
Set the async supported flag.void
setAttribute(String name, Object value)
Set the attribute.void
setAuthType(String authType)
Set the auth type.void
setCharacterEncoding(String characterEncoding)
Set the character encoding.void
setContentLength(int contentLength)
Set the content length.void
setContentType(String contentType)
Set the content type.void
setContextPath(String contextPath)
Set the context path.void
setCookies(Cookie[] cookies)
Set the cookies.void
setDispatcherType(DispatcherType dispatcherType)
Set the dispatcher type.void
setHeader(String name, String value)
Set the header.void
setInputStream(InputStream inputStream)
Set the input stream.void
setLocalAddr(String localAddress)
Set the local address.void
setLocalName(String localName)
Set the local name.void
setLocalPort(int localPort)
Set the local port.void
setMethod(String method)
Set the method.void
setParameter(String name, String[] values)
Set the parameter values.void
setPathInfo(String pathInfo)
Set the path info.void
setProtocol(String protocol)
Set the protocol.void
setQueryString(String queryString)
Set the query string.void
setReadListener(ReadListener listener)
Set the read listener.void
setRemoteAddr(String remoteAddr)
Set the remote address.void
setRemoteHost(String remoteHost)
Set the remote host.void
setRemotePort(int remotePort)
Set the remote port.void
setRequestedSessionId(String requestedSessionId)
Set the requested session id.void
setRequestedSessionIdFromCookie(boolean requestedSessionIdFromCookie)
Set the requested session id from cookie.void
setRequestedSessionIdFromURL(boolean requestedSessionIdFromURL)
Set the request session id from URL flag.void
setScheme(String scheme)
Set the scheme.void
setServerName(String serverName)
Set the server name.void
setServerPort(int serverPort)
Set the server port.void
setServletPath(String servletPath)
Set the servlet path.void
setUpgraded(boolean upgraded)
Set the upgraded flag.void
setUserPrincipal(Principal userPrincipal)
Set the user principal.void
setWebApplication(WebApplication webApplication)
Set the web application.AsyncContext
startAsync()
Start async.AsyncContext
startAsync(ServletRequest request, ServletResponse response)
Start async.<T extends HttpUpgradeHandler>
Tupgrade(Class<T> handlerClass)
Upgrade the request.protected void
verifyMultipartFormData()
Verify the method is of type "multipart/form-data"-
Methods inherited from class javax.servlet.ServletInputStream
readLine
-
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
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
getHttpServletMapping, getTrailerFields, isTrailerFieldsReady, newPushBuilder
-
-
-
-
Field Detail
-
authType
protected String authType
Stores the auth type.
-
asyncContext
protected AsyncContext asyncContext
Stores the async context.
-
asyncStarted
protected boolean asyncStarted
Stores if async is started.
-
asyncSupported
protected boolean asyncSupported
Stores if async is supported.
-
attributeManager
protected AttributeManager attributeManager
Stores the attribute manager.
-
characterEncoding
protected String characterEncoding
Stores the character encoding.
-
contentLength
protected long contentLength
Stores the content length.
-
contentType
protected String contentType
Stores the content type.
-
contextPath
protected String contextPath
Stores the context path.
-
cookies
protected Cookie[] cookies
Stores the cookies.
-
currentSessionId
protected String currentSessionId
Stores the current session id.
-
dispatcherType
protected DispatcherType dispatcherType
Stores the dispatcher type.
-
gotInputStream
protected boolean gotInputStream
Stores the gotInputStream flag.
-
gotReader
protected boolean gotReader
Stores the gotReader flag.
-
headerManager
protected HttpHeaderManager headerManager
Stores the header manager.
-
inputStream
protected InputStream inputStream
Stores the input stream.
-
localAddress
protected String localAddress
Stores the local address.
-
localName
protected String localName
Stores the local name.
-
localPort
protected int localPort
Stores the local port.
-
method
protected String method
Stores the method.
-
parametersParsed
protected boolean parametersParsed
Stores the parameters parsed flag.
-
pathInfo
protected String pathInfo
Stores the path info.
-
protocol
protected String protocol
Stores the protocol.
-
queryString
protected String queryString
Stores the query string.
-
reader
protected BufferedReader reader
Stores the reader.
-
remoteAddr
protected String remoteAddr
Stores the remote address.
-
remoteHost
protected String remoteHost
Stores the remote host.
-
remotePort
protected int remotePort
Stores the remote port.
-
requestedSessionId
protected String requestedSessionId
Stores the requested session id.
-
requestedSessionIdFromCookie
protected boolean requestedSessionIdFromCookie
Stores the requested session id from cookie flag.
-
requestedSessionIdFromURL
protected boolean requestedSessionIdFromURL
Stores the requested session id from url flag.
-
scheme
protected String scheme
Stores the scheme.
-
serverName
protected String serverName
Stores the server name.
-
serverPort
protected int serverPort
Stores the server port.
-
servletPath
protected String servletPath
Stores the servlet path.
-
upgraded
protected boolean upgraded
Stores the upgraded flag.
-
upgradeHandler
protected HttpUpgradeHandler upgradeHandler
Stores the upgrade handler.
-
userPrincipal
protected Principal userPrincipal
Stores the user principal.
-
webApplication
protected WebApplication webApplication
Stores the web application
-
-
Method Detail
-
authenticate
public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
Authenticate.- Specified by:
authenticate
in interfaceHttpServletRequest
- Parameters:
response
- the HTTP servlet response.- Returns:
- true if authenticated, false otherwise.
- Throws:
IOException
- when an I/O error occurs.ServletException
- when a Servlet error occurs.
-
changeSessionId
public String changeSessionId()
Change the session id.- Specified by:
changeSessionId
in interfaceHttpServletRequest
- Returns:
- the changed session id.
-
getAsyncContext
public AsyncContext getAsyncContext()
Get the async context.- Specified by:
getAsyncContext
in interfaceServletRequest
- Returns:
- the async context.
-
getAttribute
public Object getAttribute(String name)
Get the attribute.- Specified by:
getAttribute
in interfaceServletRequest
- Parameters:
name
- the attribute name.- Returns:
- the value.
-
getAttributeNames
public Enumeration<String> getAttributeNames()
Get attribute names.- Specified by:
getAttributeNames
in interfaceServletRequest
- Returns:
- the attribute names.
-
getAuthType
public String getAuthType()
Get the auth type.- Specified by:
getAuthType
in interfaceHttpServletRequest
- Returns:
- the auth type.
-
getCharacterEncoding
public String getCharacterEncoding()
Get the character encoding.- Specified by:
getCharacterEncoding
in interfaceServletRequest
- Returns:
- the character encoding.
-
getContentLength
public int getContentLength()
Get the content length.- Specified by:
getContentLength
in interfaceServletRequest
- Returns:
- the content length.
-
getContentLengthLong
public long getContentLengthLong()
Get the content length.- Specified by:
getContentLengthLong
in interfaceServletRequest
- Returns:
- the content length.
-
getContentType
public String getContentType()
Get the content type.- Specified by:
getContentType
in interfaceServletRequest
- Returns:
- the content type.
-
getContextPath
public String getContextPath()
Get the context path.- Specified by:
getContextPath
in interfaceHttpServletRequest
- Returns:
- the context path.
-
getCookies
public Cookie[] getCookies()
Get the cookies.- Specified by:
getCookies
in interfaceHttpServletRequest
- Returns:
- the cookies.
-
getDateHeader
public long getDateHeader(String name)
Get the date header.- Specified by:
getDateHeader
in interfaceHttpServletRequest
- Parameters:
name
- the header name.- Returns:
- the date header.
-
getDispatcherType
public DispatcherType getDispatcherType()
Get the dispatcher type.- Specified by:
getDispatcherType
in interfaceServletRequest
- Returns:
- the dispatcher type.
-
getHeader
public String getHeader(String name)
Get the header.- Specified by:
getHeader
in interfaceHttpServletRequest
- Parameters:
name
- the header name.- Returns:
- the header value.
-
getHeaderNames
public Enumeration<String> getHeaderNames()
Get the header names.- Specified by:
getHeaderNames
in interfaceHttpServletRequest
- Returns:
- the header names.
-
getHeaders
public Enumeration<String> getHeaders(String name)
Get the headers.- Specified by:
getHeaders
in interfaceHttpServletRequest
- Parameters:
name
- the header name.- Returns:
- the header values.
-
getInputStream
public ServletInputStream getInputStream() throws IOException
Get the input stream.- Specified by:
getInputStream
in interfaceServletRequest
- Returns:
- the input stream.
- Throws:
IOException
- when a serious I/O error occurs.
-
getIntHeader
public int getIntHeader(String name)
Get the int header.- Specified by:
getIntHeader
in interfaceHttpServletRequest
- Parameters:
name
- the name.- Returns:
- the int header.
-
getLocalAddr
public String getLocalAddr()
Get the local address.- Specified by:
getLocalAddr
in interfaceServletRequest
- Returns:
- the local address.
-
getLocalName
public String getLocalName()
Get the local name.- Specified by:
getLocalName
in interfaceServletRequest
- Returns:
- the local name.
-
getLocalPort
public int getLocalPort()
Get the local port.- Specified by:
getLocalPort
in interfaceServletRequest
- Returns:
- the local port.
-
getLocale
public Locale getLocale()
Get locale.- Specified by:
getLocale
in interfaceServletRequest
- Returns:
- the locale.
-
getLocales
public Enumeration<Locale> getLocales()
Get the locales.- Specified by:
getLocales
in interfaceServletRequest
- Returns:
- the locales.
-
getMethod
public String getMethod()
Get the request method.- Specified by:
getMethod
in interfaceHttpServletRequest
- Returns:
- the request method.
-
getParameter
public String getParameter(String name)
Get the parameter.- Specified by:
getParameter
in interfaceServletRequest
- Parameters:
name
- the name.- Returns:
- the value.
-
getParameterMap
public Map<String,String[]> getParameterMap()
Get the parameter map.- Specified by:
getParameterMap
in interfaceServletRequest
- Returns:
- the parameter map.
-
getParameterNames
public Enumeration<String> getParameterNames()
Get the parameter names.- Specified by:
getParameterNames
in interfaceServletRequest
- Returns:
- the parameter names.
-
getParameterValues
public String[] getParameterValues(String name)
Get the parameter values.- Specified by:
getParameterValues
in interfaceServletRequest
- Parameters:
name
- the parameter name.- Returns:
- the parameter values.
-
getParametersFromRequest
protected void getParametersFromRequest()
Get the parameters from the request.
-
getPart
public Part getPart(String name) throws IOException, ServletException
Get the part.- Specified by:
getPart
in interfaceHttpServletRequest
- Parameters:
name
- the name.- Returns:
- the part, or null.
- Throws:
IOException
- when an I/O error occurs.ServletException
- when a servlet error occurs.
-
getParts
public Collection<Part> getParts() throws IOException, ServletException
Get the parts.- Specified by:
getParts
in interfaceHttpServletRequest
- Returns:
- the parts.
- Throws:
IOException
- when an I/O error occurs.ServletException
- when a servlet error occurs.
-
getPathInfo
public String getPathInfo()
Get the path info.- Specified by:
getPathInfo
in interfaceHttpServletRequest
- Returns:
- the path info.
-
getPathTranslated
public String getPathTranslated()
Get the translated path.- Specified by:
getPathTranslated
in interfaceHttpServletRequest
- Returns:
- the translated path.
-
getProtocol
public String getProtocol()
Get the protocol.- Specified by:
getProtocol
in interfaceServletRequest
- Returns:
- the protocol.
-
getQueryString
public String getQueryString()
Get the query string.- Specified by:
getQueryString
in interfaceHttpServletRequest
- Returns:
- the query string.
-
getReader
public BufferedReader getReader() throws IOException
Get the reader.- Specified by:
getReader
in interfaceServletRequest
- Returns:
- the reader.
- Throws:
IOException
- when a serious I/O error occurs.
-
getRealPath
public String getRealPath(String path)
Deprecated.Get the real path.- Specified by:
getRealPath
in interfaceServletRequest
- Parameters:
path
- the path.- Returns:
- the real path.
-
getRemoteAddr
public String getRemoteAddr()
Get the remote address.- Specified by:
getRemoteAddr
in interfaceServletRequest
- Returns:
- the remote address.
-
getRemoteHost
public String getRemoteHost()
Get the remote host.- Specified by:
getRemoteHost
in interfaceServletRequest
- Returns:
- the remote host.
-
getRemotePort
public int getRemotePort()
Get the remote port.- Specified by:
getRemotePort
in interfaceServletRequest
- Returns:
- the remote port.
-
getRemoteUser
public String getRemoteUser()
Get the remote user.- Specified by:
getRemoteUser
in interfaceHttpServletRequest
- Returns:
- the remote user.
-
getRequestDispatcher
public RequestDispatcher getRequestDispatcher(String path)
Get the request dispatcher.- Specified by:
getRequestDispatcher
in interfaceServletRequest
- Parameters:
path
- the path.- Returns:
- the request dispatcher.
-
getRequestURI
public String getRequestURI()
Get the request URI.- Specified by:
getRequestURI
in interfaceHttpServletRequest
- Returns:
- the request URI.
-
getRequestURL
public StringBuffer getRequestURL()
Get the request URL.- Specified by:
getRequestURL
in interfaceHttpServletRequest
- Returns:
- the request URL.
-
getRequestedSessionId
public String getRequestedSessionId()
Get the requested session id.- Specified by:
getRequestedSessionId
in interfaceHttpServletRequest
- Returns:
- the requested session id.
-
getScheme
public String getScheme()
Get the scheme.- Specified by:
getScheme
in interfaceServletRequest
- Returns:
- the scheme.
-
getServerName
public String getServerName()
Get the server name.- Specified by:
getServerName
in interfaceServletRequest
- Returns:
- the server name.
-
getServerPort
public int getServerPort()
Get the server port.- Specified by:
getServerPort
in interfaceServletRequest
- Returns:
- the server port.
-
getServletContext
public WebApplication getServletContext()
Get the servlet context.- Specified by:
getServletContext
in interfaceServletRequest
- Returns:
- the servlet context.
-
getServletPath
public String getServletPath()
Get the servlet path.- Specified by:
getServletPath
in interfaceHttpServletRequest
- Returns:
- the servlet path.
-
getSession
public HttpSession getSession()
Get the session.- Specified by:
getSession
in interfaceHttpServletRequest
- Returns:
- the session.
-
getSession
public HttpSession getSession(boolean create)
Get the session.- Specified by:
getSession
in interfaceHttpServletRequest
- Parameters:
create
- to create it or not.- Returns:
- the session.
-
getUpgradeHandler
public HttpUpgradeHandler getUpgradeHandler()
Get the upgrade handler.- Returns:
- the upgrade handler.
-
getUserPrincipal
public Principal getUserPrincipal()
Get the user principal.- Specified by:
getUserPrincipal
in interfaceHttpServletRequest
- Returns:
- the user principal.
-
isAsyncStarted
public boolean isAsyncStarted()
Is async started.- Specified by:
isAsyncStarted
in interfaceServletRequest
- Returns:
- is async started.
-
isAsyncSupported
public boolean isAsyncSupported()
Is async supported.- Specified by:
isAsyncSupported
in interfaceServletRequest
- Returns:
- true if is async is supported.
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()
Is the requested session id from cookie.- Specified by:
isRequestedSessionIdFromCookie
in interfaceHttpServletRequest
- Returns:
- if the requested session id from cookie.
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()
Is the requested session id from the request url.- Specified by:
isRequestedSessionIdFromURL
in interfaceHttpServletRequest
- Returns:
- if the requested session id from the request url.
-
isRequestedSessionIdFromUrl
public boolean isRequestedSessionIdFromUrl()
Deprecated.Is the requested session id from the request url.- Specified by:
isRequestedSessionIdFromUrl
in interfaceHttpServletRequest
- Returns:
- if the requested session id from the request url.
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()
Is the requested session id valid?- Specified by:
isRequestedSessionIdValid
in interfaceHttpServletRequest
- Returns:
- true if it is, false otherwise.
-
isSecure
public boolean isSecure()
Is the request secure.- Specified by:
isSecure
in interfaceServletRequest
- Returns:
- is the request secure.
-
isUpgraded
public boolean isUpgraded()
Is the request upgraded.- Returns:
- false
-
isUserInRole
public boolean isUserInRole(String role)
Is the user in the specified role.- Specified by:
isUserInRole
in interfaceHttpServletRequest
- Parameters:
role
- the role.- Returns:
- if the user in the specified role.
-
login
public void login(String username, String password) throws ServletException
Login.- Specified by:
login
in interfaceHttpServletRequest
- Parameters:
username
- the username.password
- the password.- Throws:
ServletException
- when a serious error occurs.
-
logout
public void logout() throws ServletException
Logout.- Specified by:
logout
in interfaceHttpServletRequest
- Throws:
ServletException
- when a serious error occurs.
-
removeAttribute
public void removeAttribute(String name)
Remove the attribute.- Specified by:
removeAttribute
in interfaceServletRequest
- Parameters:
name
- the name.
-
setAsyncSupported
public void setAsyncSupported(boolean asyncSupported)
Set the async supported flag.- Parameters:
asyncSupported
- the async supported flag.
-
setAttribute
public void setAttribute(String name, Object value)
Set the attribute.- Specified by:
setAttribute
in interfaceServletRequest
- Parameters:
name
- the name.value
- the value.
-
setAuthType
public void setAuthType(String authType)
Set the auth type.- Parameters:
authType
- the auth type.
-
setCharacterEncoding
public void setCharacterEncoding(String characterEncoding) throws UnsupportedEncodingException
Set the character encoding.- Specified by:
setCharacterEncoding
in interfaceServletRequest
- Parameters:
characterEncoding
- the character encoding.- Throws:
UnsupportedEncodingException
- when the encoding is not supported.
-
setContentLength
public void setContentLength(int contentLength)
Set the content length.- Parameters:
contentLength
- the content length.
-
setContentType
public void setContentType(String contentType)
Set the content type.- Parameters:
contentType
- the content type.
-
setContextPath
public void setContextPath(String contextPath)
Set the context path.- Parameters:
contextPath
- the context path.
-
setCookies
public void setCookies(Cookie[] cookies)
Set the cookies.- Parameters:
cookies
- the cookies.
-
setDispatcherType
public void setDispatcherType(DispatcherType dispatcherType)
Set the dispatcher type.- Specified by:
setDispatcherType
in interfaceWebApplicationRequest
- Parameters:
dispatcherType
- the dispatcher type.
-
setHeader
public void setHeader(String name, String value)
Set the header.- Parameters:
name
- the name.value
- the value (string).
-
setInputStream
public void setInputStream(InputStream inputStream)
Set the input stream.- Parameters:
inputStream
- the input stream.
-
setLocalAddr
public void setLocalAddr(String localAddress)
Set the local address.- Parameters:
localAddress
- the local address.
-
setLocalName
public void setLocalName(String localName)
Set the local name.- Parameters:
localName
- the local name.
-
setLocalPort
public void setLocalPort(int localPort)
Set the local port.- Parameters:
localPort
- the local port.
-
setMethod
public void setMethod(String method)
Set the method.- Parameters:
method
- the method.
-
setParameter
public void setParameter(String name, String[] values)
Set the parameter values.- Parameters:
name
- the parameter name.values
- the values.
-
setPathInfo
public void setPathInfo(String pathInfo)
Set the path info.- Parameters:
pathInfo
- the path info.
-
setProtocol
public void setProtocol(String protocol)
Set the protocol.- Parameters:
protocol
- the protocol.
-
setQueryString
public void setQueryString(String queryString)
Set the query string.- Parameters:
queryString
- the query string.
-
setRemoteAddr
public void setRemoteAddr(String remoteAddr)
Set the remote address.- Parameters:
remoteAddr
- the remote address.
-
setRemoteHost
public void setRemoteHost(String remoteHost)
Set the remote host.- Parameters:
remoteHost
- the remote host.
-
setRemotePort
public void setRemotePort(int remotePort)
Set the remote port.- Parameters:
remotePort
- the remote port.
-
setRequestedSessionId
public void setRequestedSessionId(String requestedSessionId)
Set the requested session id.- Parameters:
requestedSessionId
- the requested session id.
-
setRequestedSessionIdFromCookie
public void setRequestedSessionIdFromCookie(boolean requestedSessionIdFromCookie)
Set the requested session id from cookie.- Parameters:
requestedSessionIdFromCookie
- the requested session id from cookie.
-
setRequestedSessionIdFromURL
public void setRequestedSessionIdFromURL(boolean requestedSessionIdFromURL)
Set the request session id from URL flag.- Parameters:
requestedSessionIdFromURL
- the requested session if from URL flag.
-
setScheme
public void setScheme(String scheme)
Set the scheme.- Parameters:
scheme
- the scheme.
-
setServerName
public void setServerName(String serverName)
Set the server name.- Parameters:
serverName
- the server name.
-
setServerPort
public void setServerPort(int serverPort)
Set the server port.- Parameters:
serverPort
- the server port.
-
setServletPath
public void setServletPath(String servletPath)
Set the servlet path.- Parameters:
servletPath
- the servlet path.
-
setUpgraded
public void setUpgraded(boolean upgraded)
Set the upgraded flag.- Parameters:
upgraded
- the upgraded flag.
-
setUserPrincipal
public void setUserPrincipal(Principal userPrincipal)
Set the user principal.- Parameters:
userPrincipal
- the user principal.
-
setWebApplication
public void setWebApplication(WebApplication webApplication)
Set the web application.- Parameters:
webApplication
- the web application.
-
startAsync
public AsyncContext startAsync() throws IllegalStateException
Start async.- Specified by:
startAsync
in interfaceServletRequest
- Returns:
- the async context.
- Throws:
IllegalStateException
- when async is not supported.
-
startAsync
public AsyncContext startAsync(ServletRequest request, ServletResponse response) throws IllegalStateException
Start async.- Specified by:
startAsync
in interfaceServletRequest
- Parameters:
request
- the request.response
- the response.- Returns:
- the async context.
- Throws:
IllegalStateException
- when async is not supported.
-
upgrade
public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException
Upgrade the request.- Specified by:
upgrade
in interfaceHttpServletRequest
- Type Parameters:
T
- the type.- Parameters:
handlerClass
- the handler class.- Returns:
- the upgrade handler.
- Throws:
IOException
- when an I/O error occurs.ServletException
- when a serious error occurs.
-
verifyMultipartFormData
protected void verifyMultipartFormData() throws ServletException
Verify the method is of type "multipart/form-data"- Throws:
ServletException
- the exception thrown when it is not.
-
isFinished
public boolean isFinished()
Is the Servlet input stream finished?- Specified by:
isFinished
in classServletInputStream
- Returns:
- true if it is, false otherwise.
-
isReady
public boolean isReady()
Is the Servlet input stream ready?- Specified by:
isReady
in classServletInputStream
- Returns:
- true if it is, false otherwise.
-
setReadListener
public void setReadListener(ReadListener listener)
Set the read listener.- Specified by:
setReadListener
in classServletInputStream
- Parameters:
listener
- the read listener.
-
read
public int read() throws IOException
Read from the Servlet input stream.- Specified by:
read
in classInputStream
- Returns:
- the read value.
- Throws:
IOException
- when an I/O error occurs.
-
-