Class StubServletRequest
- java.lang.Object
-
- org.vx68k.bitbucket.stub.StubServletRequest
-
- All Implemented Interfaces:
ServletRequest
- Direct Known Subclasses:
StubHttpServletRequest
public class StubServletRequest extends Object implements ServletRequest
Stub implementation ofServletRequest
.- Since:
- 5.0
- Author:
- Kaz Nishimura
-
-
Field Summary
Fields Modifier and Type Field Description static int
HTTP_PORT
Default HTTP server port.static int
HTTPS_PORT
Default HTTPS server port.
-
Constructor Summary
Constructors Constructor Description StubServletRequest(ServletContext context)
Constructs this object with aServletContext
object.StubServletRequest(ServletContext context, ServletInputStream stream)
Constructs this object with aServletContext
object and aServletInputStream
object.
-
Method Summary
-
-
-
Field Detail
-
HTTP_PORT
public static final int HTTP_PORT
Default HTTP server port.- See Also:
- Constant Field Values
-
HTTPS_PORT
public static final int HTTPS_PORT
Default HTTPS server port.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StubServletRequest
public StubServletRequest(ServletContext context)
Constructs this object with aServletContext
object. The input stream shall be set to empty.- Parameters:
context
-ServletContext
object
-
StubServletRequest
public StubServletRequest(ServletContext context, ServletInputStream stream)
Constructs this object with aServletContext
object and aServletInputStream
object.- Parameters:
context
-ServletContext
objectstream
-ServletInputStream
object
-
-
Method Detail
-
getServletContext
public final ServletContext getServletContext()
This implementation returns the
ServletContext
object given to the constructor.- Specified by:
getServletContext
in interfaceServletRequest
-
getInputStream
public final ServletInputStream getInputStream()
This implementation returns the
ServletInputStream
object given to the constructor.- Specified by:
getInputStream
in interfaceServletRequest
-
setServerName
public final void setServerName(String value)
Sets the server name to aString
value.- Parameters:
value
-String
value to which the server name shall be set
-
setServerPort
public final void setServerPort(int value)
Sets the server port to anint
value.- Parameters:
value
-int
value to which the server port shall be set
-
getAttribute
public final Object getAttribute(String name)
- Specified by:
getAttribute
in interfaceServletRequest
-
getAttributeNames
public final Enumeration<String> getAttributeNames()
- Specified by:
getAttributeNames
in interfaceServletRequest
-
setAttribute
public final void setAttribute(String name, Object object)
- Specified by:
setAttribute
in interfaceServletRequest
-
removeAttribute
public final void removeAttribute(String name)
- Specified by:
removeAttribute
in interfaceServletRequest
-
getCharacterEncoding
public String getCharacterEncoding()
- Specified by:
getCharacterEncoding
in interfaceServletRequest
-
setCharacterEncoding
public void setCharacterEncoding(String env) throws UnsupportedEncodingException
- Specified by:
setCharacterEncoding
in interfaceServletRequest
- Throws:
UnsupportedEncodingException
-
getContentLength
public int getContentLength()
- Specified by:
getContentLength
in interfaceServletRequest
-
getContentType
public String getContentType()
- Specified by:
getContentType
in interfaceServletRequest
-
getParameter
public String getParameter(String name)
- Specified by:
getParameter
in interfaceServletRequest
-
getParameterNames
public Enumeration<String> getParameterNames()
- Specified by:
getParameterNames
in interfaceServletRequest
-
getParameterValues
public String[] getParameterValues(String name)
- Specified by:
getParameterValues
in interfaceServletRequest
-
getParameterMap
public Map<String,String[]> getParameterMap()
- Specified by:
getParameterMap
in interfaceServletRequest
-
getProtocol
public String getProtocol()
- Specified by:
getProtocol
in interfaceServletRequest
-
getScheme
public String getScheme()
- Specified by:
getScheme
in interfaceServletRequest
-
getServerName
public final String getServerName()
- Specified by:
getServerName
in interfaceServletRequest
-
getServerPort
public final int getServerPort()
- Specified by:
getServerPort
in interfaceServletRequest
-
getReader
public final BufferedReader getReader() throws IOException
- Specified by:
getReader
in interfaceServletRequest
- Throws:
IOException
-
getRemoteAddr
public final String getRemoteAddr()
- Specified by:
getRemoteAddr
in interfaceServletRequest
-
getRemoteHost
public final String getRemoteHost()
- Specified by:
getRemoteHost
in interfaceServletRequest
-
getContentLengthLong
public long getContentLengthLong()
- Specified by:
getContentLengthLong
in interfaceServletRequest
-
getLocale
public final Locale getLocale()
This implementation returns the current locale.
- Specified by:
getLocale
in interfaceServletRequest
- Returns:
- the current locale
-
getLocales
public final Enumeration<Locale> getLocales()
This implementation returns an empty enumeration.
- Specified by:
getLocales
in interfaceServletRequest
- Returns:
- an empty enumeration
-
isSecure
public final boolean isSecure()
This implementation always returns
false
.- Specified by:
isSecure
in interfaceServletRequest
- Returns:
false
-
getRequestDispatcher
public RequestDispatcher getRequestDispatcher(String path)
This implementation always returns
null
. Subclasses may override this method to return other values.- Specified by:
getRequestDispatcher
in interfaceServletRequest
- Returns:
null
-
getRealPath
@Deprecated public final String getRealPath(String path)
Deprecated.This implementation uses
ServletContext.getRealPath(java.lang.String)
.- Specified by:
getRealPath
in interfaceServletRequest
-
getRemotePort
public final int getRemotePort()
This implementation returns the remote TCP port of this request.
- Specified by:
getRemotePort
in interfaceServletRequest
- Returns:
- the remote TCP port
-
getLocalName
public final String getLocalName()
This implementation returns the local host name (
"localhost"
by default) of this request.- Specified by:
getLocalName
in interfaceServletRequest
- Returns:
- the local host name
-
getLocalAddr
public final String getLocalAddr()
This implementation returns the local IP address (
"127.0.0.1"
by default) of this request.- Specified by:
getLocalAddr
in interfaceServletRequest
- Returns:
- the local IP address
-
getLocalPort
public final int getLocalPort()
This implementation returns the local TCP port (80 by default) of this request.
- Specified by:
getLocalPort
in interfaceServletRequest
- Returns:
- the local TCP port
-
startAsync
public AsyncContext startAsync()
This implementation always throws
IllegalStateException
.- Specified by:
startAsync
in interfaceServletRequest
- Throws:
IllegalStateException
- always
-
startAsync
public AsyncContext startAsync(ServletRequest request, ServletResponse response)
This implementation always throws
IllegalStateException
.- Specified by:
startAsync
in interfaceServletRequest
- Throws:
IllegalStateException
- always
-
isAsyncStarted
public boolean isAsyncStarted()
This implementation always returns
false
.- Specified by:
isAsyncStarted
in interfaceServletRequest
- Returns:
false
-
isAsyncSupported
public boolean isAsyncSupported()
This implementation always returns false.
- Specified by:
isAsyncSupported
in interfaceServletRequest
- Returns:
false
-
getAsyncContext
public AsyncContext getAsyncContext()
This implementation always throws
IllegalStateException
.- Specified by:
getAsyncContext
in interfaceServletRequest
- Throws:
IllegalStateException
- always
-
getDispatcherType
public DispatcherType getDispatcherType()
This implementation always returns
DispatcherType.REQUEST
. Subclasses may override this method to return other values.- Specified by:
getDispatcherType
in interfaceServletRequest
- Returns:
DispatcherType.REQUEST
-
-