WebApplicationRequest
, Closeable
, AutoCloseable
, HttpServletRequest
, ServletRequest
DefaultWebApplicationServerRequest
, EmbeddedRequest
, NanoRequest
public class DefaultWebApplicationRequest extends ServletInputStream implements WebApplicationRequest
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 HashMap<String,Part> |
parts |
Stores the parts.
|
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
|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
Constructor | Description |
---|---|
DefaultWebApplicationRequest() |
Constructor.
|
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> |
upgrade(Class<T> handlerClass) |
Upgrade the request.
|
protected void |
verifyMultipartFormData() |
Verify the method is of type "multipart/form-data"
|
getHttpServletMapping, getTrailerFields, isTrailerFieldsReady, newPushBuilder
available, close, mark, markSupported, read, read, readAllBytes, readNBytes, reset, skip, transferTo
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
readLine
protected String authType
protected AsyncContext asyncContext
protected boolean asyncStarted
protected boolean asyncSupported
protected AttributeManager attributeManager
protected String characterEncoding
protected long contentLength
protected String contentType
protected String contextPath
protected Cookie[] cookies
protected String currentSessionId
protected DispatcherType dispatcherType
protected boolean gotInputStream
protected boolean gotReader
protected HttpHeaderManager headerManager
protected InputStream inputStream
protected String localAddress
protected String localName
protected int localPort
protected String method
protected boolean parametersParsed
protected String pathInfo
protected String protocol
protected String queryString
protected BufferedReader reader
protected String remoteAddr
protected String remoteHost
protected int remotePort
protected String requestedSessionId
protected boolean requestedSessionIdFromCookie
protected boolean requestedSessionIdFromURL
protected String scheme
protected String serverName
protected int serverPort
protected String servletPath
protected boolean upgraded
protected HttpUpgradeHandler upgradeHandler
protected Principal userPrincipal
protected WebApplication webApplication
public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
authenticate
in interface HttpServletRequest
response
- the HTTP servlet response.IOException
- when an I/O error occurs.ServletException
- when a Servlet error occurs.public String changeSessionId()
changeSessionId
in interface HttpServletRequest
public AsyncContext getAsyncContext()
getAsyncContext
in interface ServletRequest
public Object getAttribute(String name)
getAttribute
in interface ServletRequest
name
- the attribute name.public Enumeration<String> getAttributeNames()
getAttributeNames
in interface ServletRequest
public String getAuthType()
getAuthType
in interface HttpServletRequest
public String getCharacterEncoding()
getCharacterEncoding
in interface ServletRequest
public int getContentLength()
getContentLength
in interface ServletRequest
public long getContentLengthLong()
getContentLengthLong
in interface ServletRequest
public String getContentType()
getContentType
in interface ServletRequest
public String getContextPath()
getContextPath
in interface HttpServletRequest
public Cookie[] getCookies()
getCookies
in interface HttpServletRequest
public long getDateHeader(String name)
getDateHeader
in interface HttpServletRequest
name
- the header name.public DispatcherType getDispatcherType()
getDispatcherType
in interface ServletRequest
public String getHeader(String name)
getHeader
in interface HttpServletRequest
name
- the header name.public Enumeration<String> getHeaderNames()
getHeaderNames
in interface HttpServletRequest
public Enumeration<String> getHeaders(String name)
getHeaders
in interface HttpServletRequest
name
- the header name.public ServletInputStream getInputStream() throws IOException
getInputStream
in interface ServletRequest
IOException
- when a serious I/O error occurs.public int getIntHeader(String name)
getIntHeader
in interface HttpServletRequest
name
- the name.public String getLocalAddr()
getLocalAddr
in interface ServletRequest
public String getLocalName()
getLocalName
in interface ServletRequest
public int getLocalPort()
getLocalPort
in interface ServletRequest
public Locale getLocale()
getLocale
in interface ServletRequest
public Enumeration<Locale> getLocales()
getLocales
in interface ServletRequest
public String getMethod()
getMethod
in interface HttpServletRequest
public String getParameter(String name)
getParameter
in interface ServletRequest
name
- the name.public Map<String,String[]> getParameterMap()
getParameterMap
in interface ServletRequest
public Enumeration<String> getParameterNames()
getParameterNames
in interface ServletRequest
public String[] getParameterValues(String name)
getParameterValues
in interface ServletRequest
name
- the parameter name.protected void getParametersFromRequest()
public Part getPart(String name) throws IOException, ServletException
getPart
in interface HttpServletRequest
name
- the name.IOException
- when an I/O error occurs.ServletException
- when a servlet error occurs.public Collection<Part> getParts() throws IOException, ServletException
getParts
in interface HttpServletRequest
IOException
- when an I/O error occurs.ServletException
- when a servlet error occurs.public String getPathInfo()
getPathInfo
in interface HttpServletRequest
public String getPathTranslated()
getPathTranslated
in interface HttpServletRequest
public String getProtocol()
getProtocol
in interface ServletRequest
public String getQueryString()
getQueryString
in interface HttpServletRequest
public BufferedReader getReader() throws IOException
getReader
in interface ServletRequest
IOException
- when a serious I/O error occurs.public String getRealPath(String path)
getRealPath
in interface ServletRequest
path
- the path.public String getRemoteAddr()
getRemoteAddr
in interface ServletRequest
public String getRemoteHost()
getRemoteHost
in interface ServletRequest
public int getRemotePort()
getRemotePort
in interface ServletRequest
public String getRemoteUser()
getRemoteUser
in interface HttpServletRequest
public RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher
in interface ServletRequest
path
- the path.public String getRequestURI()
getRequestURI
in interface HttpServletRequest
public StringBuffer getRequestURL()
getRequestURL
in interface HttpServletRequest
public String getRequestedSessionId()
getRequestedSessionId
in interface HttpServletRequest
public String getScheme()
getScheme
in interface ServletRequest
public String getServerName()
getServerName
in interface ServletRequest
public int getServerPort()
getServerPort
in interface ServletRequest
public WebApplication getServletContext()
getServletContext
in interface ServletRequest
public String getServletPath()
getServletPath
in interface HttpServletRequest
public HttpSession getSession()
getSession
in interface HttpServletRequest
public HttpSession getSession(boolean create)
getSession
in interface HttpServletRequest
create
- to create it or not.public HttpUpgradeHandler getUpgradeHandler()
public Principal getUserPrincipal()
getUserPrincipal
in interface HttpServletRequest
public boolean isAsyncStarted()
isAsyncStarted
in interface ServletRequest
public boolean isAsyncSupported()
isAsyncSupported
in interface ServletRequest
public boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie
in interface HttpServletRequest
public boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL
in interface HttpServletRequest
public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl
in interface HttpServletRequest
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid
in interface HttpServletRequest
public boolean isSecure()
isSecure
in interface ServletRequest
public boolean isUpgraded()
public boolean isUserInRole(String role)
isUserInRole
in interface HttpServletRequest
role
- the role.public void login(String username, String password) throws ServletException
login
in interface HttpServletRequest
username
- the username.password
- the password.ServletException
- when a serious error occurs.public void logout() throws ServletException
logout
in interface HttpServletRequest
ServletException
- when a serious error occurs.public void removeAttribute(String name)
removeAttribute
in interface ServletRequest
name
- the name.public void setAsyncSupported(boolean asyncSupported)
asyncSupported
- the async supported flag.public void setAttribute(String name, Object value)
setAttribute
in interface ServletRequest
name
- the name.value
- the value.public void setAuthType(String authType)
authType
- the auth type.public void setCharacterEncoding(String characterEncoding) throws UnsupportedEncodingException
setCharacterEncoding
in interface ServletRequest
characterEncoding
- the character encoding.UnsupportedEncodingException
- when the encoding is not supported.public void setContentLength(int contentLength)
contentLength
- the content length.public void setContentType(String contentType)
contentType
- the content type.public void setContextPath(String contextPath)
contextPath
- the context path.public void setCookies(Cookie[] cookies)
cookies
- the cookies.public void setDispatcherType(DispatcherType dispatcherType)
setDispatcherType
in interface WebApplicationRequest
dispatcherType
- the dispatcher type.public void setHeader(String name, String value)
name
- the name.value
- the value (string).public void setInputStream(InputStream inputStream)
inputStream
- the input stream.public void setLocalAddr(String localAddress)
localAddress
- the local address.public void setLocalName(String localName)
localName
- the local name.public void setLocalPort(int localPort)
localPort
- the local port.public void setMethod(String method)
method
- the method.public void setParameter(String name, String[] values)
name
- the parameter name.values
- the values.public void setPathInfo(String pathInfo)
pathInfo
- the path info.public void setProtocol(String protocol)
protocol
- the protocol.public void setQueryString(String queryString)
queryString
- the query string.public void setRemoteAddr(String remoteAddr)
remoteAddr
- the remote address.public void setRemoteHost(String remoteHost)
remoteHost
- the remote host.public void setRemotePort(int remotePort)
remotePort
- the remote port.public void setRequestedSessionId(String requestedSessionId)
requestedSessionId
- the requested session id.public void setRequestedSessionIdFromCookie(boolean requestedSessionIdFromCookie)
requestedSessionIdFromCookie
- the requested session id from cookie.public void setRequestedSessionIdFromURL(boolean requestedSessionIdFromURL)
requestedSessionIdFromURL
- the requested session if from URL flag.public void setScheme(String scheme)
scheme
- the scheme.public void setServerName(String serverName)
serverName
- the server name.public void setServerPort(int serverPort)
serverPort
- the server port.public void setServletPath(String servletPath)
servletPath
- the servlet path.public void setUpgraded(boolean upgraded)
upgraded
- the upgraded flag.public void setUserPrincipal(Principal userPrincipal)
userPrincipal
- the user principal.public void setWebApplication(WebApplication webApplication)
webApplication
- the web application.public AsyncContext startAsync() throws IllegalStateException
startAsync
in interface ServletRequest
IllegalStateException
- when async is not supported.public AsyncContext startAsync(ServletRequest request, ServletResponse response) throws IllegalStateException
startAsync
in interface ServletRequest
request
- the request.response
- the response.IllegalStateException
- when async is not supported.public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException
upgrade
in interface HttpServletRequest
T
- the type.handlerClass
- the handler class.IOException
- when an I/O error occurs.ServletException
- when a serious error occurs.protected void verifyMultipartFormData() throws ServletException
ServletException
- the exception thrown when it is not.public boolean isFinished()
isFinished
in class ServletInputStream
public boolean isReady()
isReady
in class ServletInputStream
public void setReadListener(ReadListener listener)
setReadListener
in class ServletInputStream
listener
- the read listener.public int read() throws IOException
read
in class InputStream
IOException
- when an I/O error occurs.Copyright © 2020 Piranha Cloud. All rights reserved.