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 aServletContextobject.StubHttpServletRequest(ServletContext context, ServletInputStream stream)Constructs this object with aServletContextobject and aServletInputStreamobject.
-
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 aServletContextobject. The input stream shall be set to empty.- Parameters:
context-ServletContextobject
-
StubHttpServletRequest
public StubHttpServletRequest(ServletContext context, ServletInputStream stream)
Constructs this object with aServletContextobject and aServletInputStreamobject.- Parameters:
context-ServletContextobjectstream-ServletInputStreamobject
-
-
Method Detail
-
setMethod
public final void setMethod(String value)
Sets the request method of this request to aStringvalue. The given value will be returned bygetMethod.- Parameters:
value-Stringvalue
-
setPathInfo
public final void setPathInfo(String value)
Sets the path information of this request to aStringvalue. The given value will be returned bygetPathInfo.- Parameters:
value-Stringvalue
-
setQueryString
public final void setQueryString(String value)
Sets the query string of this request to aStringvalue. The given value will be returned bygetQueryString.- Parameters:
value-Stringvalue
-
getAuthType
public String getAuthType()
This implementation always returns
null. Subclasses may override this method to return other values.- Specified by:
getAuthTypein interfaceHttpServletRequest- Returns:
null
-
getCookies
public Cookie[] getCookies()
This implementation always returns
null. Subclasses may override this method to return other values.- Specified by:
getCookiesin 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:
getDateHeaderin 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:
getHeaderin 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:
getHeadersin interfaceHttpServletRequest- Returns:
null
-
getHeaderNames
public Enumeration<String> getHeaderNames()
This implementation always returns
null. Subclasses may override this method to return other values.- Specified by:
getHeaderNamesin 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:
getIntHeaderin interfaceHttpServletRequest- Returns:
-1
-
getMethod
public final String getMethod()
This implementation returns the value set by
setMethod, which is"GET"by default.- Specified by:
getMethodin interfaceHttpServletRequest- Returns:
- the value set by
setMethod
-
getPathInfo
public final String getPathInfo()
This implementation returns the value set by
setPathInfo, which isnullby default.- Specified by:
getPathInfoin 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:
getPathTranslatedin interfaceHttpServletRequest- Returns:
null
-
getContextPath
public String getContextPath()
This implementation always returns
"". Subclasses may override this method to return other values.- Specified by:
getContextPathin interfaceHttpServletRequest- Returns:
""
-
getQueryString
public final String getQueryString()
This implementation returns the value set by
setQueryString, which isnullby default.- Specified by:
getQueryStringin 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:
getRemoteUserin 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:
isUserInRolein interfaceHttpServletRequest- Returns:
false
-
getUserPrincipal
public Principal getUserPrincipal()
This implementation always returns
null. Subclasses may override this method to return other values.- Specified by:
getUserPrincipalin interfaceHttpServletRequest- Returns:
null
-
getRequestedSessionId
public String getRequestedSessionId()
This implementation always returns
null. Subclasses may override this method to return other values.- Specified by:
getRequestedSessionIdin interfaceHttpServletRequest- Returns:
null
-
getRequestURI
public String getRequestURI()
- Specified by:
getRequestURIin interfaceHttpServletRequest
-
getRequestURL
public StringBuffer getRequestURL()
- Specified by:
getRequestURLin interfaceHttpServletRequest
-
getServletPath
public String getServletPath()
- Specified by:
getServletPathin interfaceHttpServletRequest
-
getSession
public HttpSession getSession(boolean create)
- Specified by:
getSessionin interfaceHttpServletRequest
-
getSession
public HttpSession getSession()
- Specified by:
getSessionin interfaceHttpServletRequest
-
changeSessionId
public String changeSessionId()
- Specified by:
changeSessionIdin interfaceHttpServletRequest
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()
- Specified by:
isRequestedSessionIdValidin interfaceHttpServletRequest
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()
- Specified by:
isRequestedSessionIdFromCookiein interfaceHttpServletRequest
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()
- Specified by:
isRequestedSessionIdFromURLin interfaceHttpServletRequest
-
isRequestedSessionIdFromUrl
@Deprecated public final boolean isRequestedSessionIdFromUrl()
Deprecated.- Specified by:
isRequestedSessionIdFromUrlin interfaceHttpServletRequest
-
authenticate
public boolean authenticate(HttpServletResponse response) throws IOException, ServletException
- Specified by:
authenticatein interfaceHttpServletRequest- Throws:
IOExceptionServletException
-
login
public void login(String username, String password) throws ServletException
- Specified by:
loginin interfaceHttpServletRequest- Throws:
ServletException
-
logout
public void logout() throws ServletException- Specified by:
logoutin interfaceHttpServletRequest- Throws:
ServletException
-
getParts
public Collection<Part> getParts() throws IOException, ServletException
- Specified by:
getPartsin interfaceHttpServletRequest- Throws:
IOExceptionServletException
-
getPart
public Part getPart(String name) throws IOException, ServletException
- Specified by:
getPartin interfaceHttpServletRequest- Throws:
IOExceptionServletException
-
upgrade
public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException
- Specified by:
upgradein interfaceHttpServletRequest- Throws:
IOExceptionServletException
-
-