Class StubHttpServletRequest
- java.lang.Object
-
- org.vx68k.bitbucket.stub.StubServletRequest
-
- org.vx68k.bitbucket.stub.StubHttpServletRequest
-
- All Implemented Interfaces:
HttpServletRequest
,ServletRequest
public class StubHttpServletRequest extends StubServletRequest implements HttpServletRequest
Stub implementation ofHttpServletRequest
.- Since:
- 5.0
- Author:
- Kaz Nishimura
-
-
Field Summary
-
Fields inherited from class org.vx68k.bitbucket.stub.StubServletRequest
HTTP_PORT, HTTPS_PORT
-
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
-
-
Constructor Summary
Constructors Constructor Description StubHttpServletRequest(ServletContext context)
Constructs this object with aServletContext
object.StubHttpServletRequest(ServletContext context, ServletInputStream stream)
Constructs this object with aServletContext
object and aServletInputStream
object.
-
Method Summary
-
Methods inherited from class org.vx68k.bitbucket.stub.StubServletRequest
getAsyncContext, getAttribute, 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, setServerName, setServerPort, 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.ServletRequest
getAsyncContext, getAttribute, 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
-
StubHttpServletRequest
public StubHttpServletRequest(ServletContext context)
Constructs this object with aServletContext
object. The input stream shall be set to empty.- Parameters:
context
-ServletContext
object
-
StubHttpServletRequest
public StubHttpServletRequest(ServletContext context, ServletInputStream stream)
Constructs this object with aServletContext
object and aServletInputStream
object.- Parameters:
context
-ServletContext
objectstream
-ServletInputStream
object
-
-
Method Detail
-
setMethod
public final void setMethod(String value)
Sets the request method of this request to aString
value. The given value will be returned bygetMethod
.- Parameters:
value
-String
value
-
setPathInfo
public final void setPathInfo(String value)
Sets the path information of this request to aString
value. The given value will be returned bygetPathInfo
.- Parameters:
value
-String
value
-
setQueryString
public final void setQueryString(String value)
Sets the query string of this request to aString
value. The given value will be returned bygetQueryString
.- Parameters:
value
-String
value
-
getAuthType
public String getAuthType()
This implementation always returns
null
. Subclasses may override this method to return other values.- Specified by:
getAuthType
in interfaceHttpServletRequest
- Returns:
null
-
getCookies
public Cookie[] getCookies()
This implementation always returns
null
. Subclasses may override this method to return other values.- Specified by:
getCookies
in interfaceHttpServletRequest
- Returns:
null
-
getDateHeader
public long getDateHeader(String name)
This implementation always returns
-1
. Subclasses may override this method to return other values.- Specified by:
getDateHeader
in interfaceHttpServletRequest
- Returns:
-1
-
getHeader
public String getHeader(String name)
This implementation always returns
null
. Subclasses may override this method to return other values.- Specified by:
getHeader
in interfaceHttpServletRequest
- Returns:
null
-
getHeaders
public Enumeration<String> getHeaders(String name)
This implementation always returns
null
. Subclasses may override this method to return other values.- Specified by:
getHeaders
in interfaceHttpServletRequest
- Returns:
null
-
getHeaderNames
public Enumeration<String> getHeaderNames()
This implementation always returns
null
. Subclasses may override this method to return other values.- Specified by:
getHeaderNames
in interfaceHttpServletRequest
- Returns:
null
-
getIntHeader
public int getIntHeader(String name)
This implementation always returns
-1
. Subclasses may override this method to return other values.- Specified by:
getIntHeader
in interfaceHttpServletRequest
- Returns:
-1
-
getMethod
public final String getMethod()
This implementation returns the value set by
setMethod
, which is"GET"
by default.- Specified by:
getMethod
in interfaceHttpServletRequest
- Returns:
- the value set by
setMethod
-
getPathInfo
public final String getPathInfo()
This implementation returns the value set by
setPathInfo
, which isnull
by default.- Specified by:
getPathInfo
in interfaceHttpServletRequest
- Returns:
- the value set by
setPathInfo
-
getPathTranslated
public String getPathTranslated()
This implementation always returns
null
. Subclasses may override this method to other values.- Specified by:
getPathTranslated
in interfaceHttpServletRequest
- Returns:
null
-
getContextPath
public String getContextPath()
This implementation always returns
""
. Subclasses may override this method to return other values.- Specified by:
getContextPath
in interfaceHttpServletRequest
- Returns:
""
-
getQueryString
public final String getQueryString()
This implementation returns the value set by
setQueryString
, which isnull
by default.- Specified by:
getQueryString
in interfaceHttpServletRequest
- Returns:
- the value set by
setQueryString
-
getRemoteUser
public String getRemoteUser()
This implementation always returns
null
. Subclasses may override this method to return other values.- Specified by:
getRemoteUser
in interfaceHttpServletRequest
- Returns:
null
-
isUserInRole
public boolean isUserInRole(String role)
This implementation always returns
false
. Subclasses may override this method to return other values.- Specified by:
isUserInRole
in interfaceHttpServletRequest
- Returns:
false
-
getUserPrincipal
public Principal getUserPrincipal()
This implementation always returns
null
. Subclasses may override this method to return other values.- Specified by:
getUserPrincipal
in interfaceHttpServletRequest
- Returns:
null
-
getRequestedSessionId
public String getRequestedSessionId()
This implementation always returns
null
. Subclasses may override this method to return other values.- Specified by:
getRequestedSessionId
in interfaceHttpServletRequest
- Returns:
null
-
getRequestURI
public String getRequestURI()
- Specified by:
getRequestURI
in interfaceHttpServletRequest
-
getRequestURL
public StringBuffer getRequestURL()
- Specified by:
getRequestURL
in interfaceHttpServletRequest
-
getServletPath
public String getServletPath()
- Specified by:
getServletPath
in interfaceHttpServletRequest
-
getSession
public HttpSession getSession(boolean create)
- Specified by:
getSession
in interfaceHttpServletRequest
-
getSession
public HttpSession getSession()
- Specified by:
getSession
in interfaceHttpServletRequest
-
changeSessionId
public String changeSessionId()
- Specified by:
changeSessionId
in interfaceHttpServletRequest
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()
- Specified by:
isRequestedSessionIdValid
in interfaceHttpServletRequest
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()
- Specified by:
isRequestedSessionIdFromCookie
in interfaceHttpServletRequest
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()
- Specified by:
isRequestedSessionIdFromURL
in interfaceHttpServletRequest
-
isRequestedSessionIdFromUrl
@Deprecated public final boolean isRequestedSessionIdFromUrl()
Deprecated.- Specified by:
isRequestedSessionIdFromUrl
in interfaceHttpServletRequest
-
authenticate
public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
- Specified by:
authenticate
in interfaceHttpServletRequest
- Throws:
IOException
ServletException
-
login
public void login(String username, String password) throws ServletException
- Specified by:
login
in interfaceHttpServletRequest
- Throws:
ServletException
-
logout
public void logout() throws ServletException
- Specified by:
logout
in interfaceHttpServletRequest
- Throws:
ServletException
-
getParts
public Collection<Part> getParts() throws IOException, ServletException
- Specified by:
getParts
in interfaceHttpServletRequest
- Throws:
IOException
ServletException
-
getPart
public Part getPart(String name) throws IOException, ServletException
- Specified by:
getPart
in interfaceHttpServletRequest
- Throws:
IOException
ServletException
-
upgrade
public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException
- Specified by:
upgrade
in interfaceHttpServletRequest
- Throws:
IOException
ServletException
-
-