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 intHTTP_PORTDefault HTTP server port.static intHTTPS_PORTDefault HTTPS server port.
-
Constructor Summary
Constructors Constructor Description StubServletRequest(ServletContext context)Constructs this object with aServletContextobject.StubServletRequest(ServletContext context, ServletInputStream stream)Constructs this object with aServletContextobject and aServletInputStreamobject.
-
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 aServletContextobject. The input stream shall be set to empty.- Parameters:
context-ServletContextobject
-
StubServletRequest
public StubServletRequest(ServletContext context, ServletInputStream stream)
Constructs this object with aServletContextobject and aServletInputStreamobject.- Parameters:
context-ServletContextobjectstream-ServletInputStreamobject
-
-
Method Detail
-
getServletContext
public final ServletContext getServletContext()
This implementation returns the
ServletContextobject given to the constructor.- Specified by:
getServletContextin interfaceServletRequest
-
getInputStream
public final ServletInputStream getInputStream()
This implementation returns the
ServletInputStreamobject given to the constructor.- Specified by:
getInputStreamin interfaceServletRequest
-
setServerName
public final void setServerName(String value)
Sets the server name to aStringvalue.- Parameters:
value-Stringvalue to which the server name shall be set
-
setServerPort
public final void setServerPort(int value)
Sets the server port to anintvalue.- Parameters:
value-intvalue to which the server port shall be set
-
getAttribute
public final Object getAttribute(String name)
- Specified by:
getAttributein interfaceServletRequest
-
getAttributeNames
public final Enumeration<String> getAttributeNames()
- Specified by:
getAttributeNamesin interfaceServletRequest
-
setAttribute
public final void setAttribute(String name, Object object)
- Specified by:
setAttributein interfaceServletRequest
-
removeAttribute
public final void removeAttribute(String name)
- Specified by:
removeAttributein interfaceServletRequest
-
getCharacterEncoding
public String getCharacterEncoding()
- Specified by:
getCharacterEncodingin interfaceServletRequest
-
setCharacterEncoding
public void setCharacterEncoding(String env) throws UnsupportedEncodingException
- Specified by:
setCharacterEncodingin interfaceServletRequest- Throws:
UnsupportedEncodingException
-
getContentLength
public int getContentLength()
- Specified by:
getContentLengthin interfaceServletRequest
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfaceServletRequest
-
getParameter
public String getParameter(String name)
- Specified by:
getParameterin interfaceServletRequest
-
getParameterNames
public Enumeration<String> getParameterNames()
- Specified by:
getParameterNamesin interfaceServletRequest
-
getParameterValues
public String[] getParameterValues(String name)
- Specified by:
getParameterValuesin interfaceServletRequest
-
getParameterMap
public Map<String,String[]> getParameterMap()
- Specified by:
getParameterMapin interfaceServletRequest
-
getProtocol
public String getProtocol()
- Specified by:
getProtocolin interfaceServletRequest
-
getScheme
public String getScheme()
- Specified by:
getSchemein interfaceServletRequest
-
getServerName
public final String getServerName()
- Specified by:
getServerNamein interfaceServletRequest
-
getServerPort
public final int getServerPort()
- Specified by:
getServerPortin interfaceServletRequest
-
getReader
public final BufferedReader getReader() throws IOException
- Specified by:
getReaderin interfaceServletRequest- Throws:
IOException
-
getRemoteAddr
public final String getRemoteAddr()
- Specified by:
getRemoteAddrin interfaceServletRequest
-
getRemoteHost
public final String getRemoteHost()
- Specified by:
getRemoteHostin interfaceServletRequest
-
getContentLengthLong
public long getContentLengthLong()
- Specified by:
getContentLengthLongin interfaceServletRequest
-
getLocale
public final Locale getLocale()
This implementation returns the current locale.
- Specified by:
getLocalein interfaceServletRequest- Returns:
- the current locale
-
getLocales
public final Enumeration<Locale> getLocales()
This implementation returns an empty enumeration.
- Specified by:
getLocalesin interfaceServletRequest- Returns:
- an empty enumeration
-
isSecure
public final boolean isSecure()
This implementation always returns
false.- Specified by:
isSecurein 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:
getRequestDispatcherin interfaceServletRequest- Returns:
null
-
getRealPath
@Deprecated public final String getRealPath(String path)
Deprecated.This implementation uses
ServletContext.getRealPath(java.lang.String).- Specified by:
getRealPathin interfaceServletRequest
-
getRemotePort
public final int getRemotePort()
This implementation returns the remote TCP port of this request.
- Specified by:
getRemotePortin 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:
getLocalNamein 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:
getLocalAddrin 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:
getLocalPortin interfaceServletRequest- Returns:
- the local TCP port
-
startAsync
public AsyncContext startAsync()
This implementation always throws
IllegalStateException.- Specified by:
startAsyncin interfaceServletRequest- Throws:
IllegalStateException- always
-
startAsync
public AsyncContext startAsync(ServletRequest request, ServletResponse response)
This implementation always throws
IllegalStateException.- Specified by:
startAsyncin interfaceServletRequest- Throws:
IllegalStateException- always
-
isAsyncStarted
public boolean isAsyncStarted()
This implementation always returns
false.- Specified by:
isAsyncStartedin interfaceServletRequest- Returns:
false
-
isAsyncSupported
public boolean isAsyncSupported()
This implementation always returns false.
- Specified by:
isAsyncSupportedin interfaceServletRequest- Returns:
false
-
getAsyncContext
public AsyncContext getAsyncContext()
This implementation always throws
IllegalStateException.- Specified by:
getAsyncContextin 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:
getDispatcherTypein interfaceServletRequest- Returns:
DispatcherType.REQUEST
-
-