public static class Serve.ServeConnection extends Object implements Runnable, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse
Modifier and Type | Field and Description |
---|---|
static String |
ACCEPT_LANGUAGE |
static String |
CHUNKED |
static String |
CONNECTION |
static String |
CONTENT_ENCODING |
static String |
CONTENTLENGTH |
static String |
CONTENTTYPE |
static String |
COOKIE |
static String |
HOST |
protected boolean |
keepAlive |
static String |
KEEPALIVE |
protected long |
lastRun |
protected long |
lastWait |
protected String |
reqQuery |
static String |
SESSION_COOKIE_NAME |
static String |
SESSION_URL_NAME |
static String |
SETCOOKIE |
protected int |
timesRequested |
static String |
TRANSFERENCODING |
static String |
WWWFORMURLENCODE |
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_FOUND, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY
Constructor and Description |
---|
Serve.ServeConnection(Socket socket,
Serve serve) |
Modifier and Type | Method and Description |
---|---|
void |
addCookie(javax.servlet.http.Cookie cookie) |
void |
addDateHeader(String header,
long date) |
void |
addHeader(String header,
String value) |
void |
addIntHeader(String header,
int value) |
void |
closeSocket() |
void |
closeStreams()
it closes stream awaring of keep -alive
|
boolean |
containsHeader(String name) |
String |
encodeRedirectUrl(String url) |
String |
encodeRedirectURL(String url) |
String |
encodeUrl(String url) |
String |
encodeURL(String url) |
void |
flushBuffer() |
Object |
getAttribute(String name) |
Enumeration |
getAttributeNames() |
String |
getAuthType() |
int |
getBufferSize() |
String |
getCharacterEncoding() |
int |
getContentLength() |
String |
getContentType() |
String |
getContextPath() |
javax.servlet.http.Cookie[] |
getCookies() |
long |
getDateHeader(String name) |
String |
getHeader(String name) |
Enumeration |
getHeaderNames() |
Enumeration |
getHeaders(String header) |
javax.servlet.ServletInputStream |
getInputStream() |
int |
getIntHeader(String name) |
String |
getLocalAddr()
Returns the Internet Protocol (IP) address of the interface on which the request was received.
|
Locale |
getLocale()
For request: Returns the preferred Locale that the client will accept content in, based on the Accept-Language header.
|
Enumeration |
getLocales()
Returns an Enumeration of Locale objects indicating, in decreasing order starting with the preferred locale, the locales that are acceptable to the
client based on the Accept-Language header.
|
String |
getLocalName()
Returns the host name of the Internet Protocol (IP) interface on which the request was received.
|
int |
getLocalPort()
Returns the Internet Protocol (IP) port number of the interface on which the request was received.
|
String |
getMethod() |
javax.servlet.ServletOutputStream |
getOutputStream() |
String |
getParameter(String name) |
Map |
getParameterMap()
Returns a java.util.Map of the parameters of this request.
|
Enumeration |
getParameterNames() |
String[] |
getParameterValues(String name) |
String |
getPathInfo() |
String |
getPathTranslated() |
String |
getProtocol() |
String |
getQueryString() |
BufferedReader |
getReader() |
String |
getRealPath(String path) |
String |
getRemoteAddr() |
String |
getRemoteHost() |
int |
getRemotePort()
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
|
String |
getRemoteUser() |
javax.servlet.RequestDispatcher |
getRequestDispatcher(String urlpath) |
String |
getRequestedSessionId() |
String |
getRequestURI()
****************************************************************************************************************************************************
Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request.
|
StringBuffer |
getRequestURL()
Reconstructs the URL the client used to make the request.
|
String |
getScheme() |
String |
getServerName() |
int |
getServerPort() |
String |
getServletPath() |
javax.servlet.http.HttpSession |
getSession() |
javax.servlet.http.HttpSession |
getSession(boolean create) |
Socket |
getSocket() |
Principal |
getUserPrincipal() |
PrintWriter |
getWriter() |
boolean |
isCommitted()
Returns a boolean indicating if the response has been committed.
|
boolean |
isRequestedSessionIdFromCookie()
Checks whether the session id specified by this request came in as a cookie.
|
boolean |
isRequestedSessionIdFromUrl() |
boolean |
isRequestedSessionIdFromURL() |
boolean |
isRequestedSessionIdValid() |
boolean |
isSecure() |
boolean |
isUserInRole(String user) |
void |
removeAttribute(String name) |
void |
reset()
Clears any data that exists in the buffer as well as the status code and headers.
|
void |
resetBuffer()
Clears the content of the underlying buffer in the response without clearing headers or status code.
|
void |
run() |
void |
sendError(int resCode) |
void |
sendError(int resCode,
String resMessage) |
void |
sendRedirect(String location) |
void |
setAttribute(String key,
Object o)
Stores an attribute in this request.
|
void |
setBufferSize(int size) |
void |
setCharacterEncoding(String _enc)
Overrides the name of the character encoding used in the body of this request.
|
void |
setContentLength(int length) |
void |
setContentType(String type) |
void |
setDateHeader(String header,
long value) |
void |
setHeader(String header,
String value) |
void |
setInInclude(boolean set) |
void |
setIntHeader(String header,
int value) |
void |
setLocale(Locale locale)
Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate.
|
void |
setLongHeader(String header,
long value) |
void |
setStatus(int resCode) |
void |
setStatus(int resCode,
String resMessage) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
authenticate, changeSessionId, getPart, getParts, login, logout, upgrade
public static final String WWWFORMURLENCODE
public static final String TRANSFERENCODING
public static final String KEEPALIVE
public static final String CONTENT_ENCODING
public static final String CONNECTION
public static final String CHUNKED
public static final String CONTENTLENGTH
public static final String CONTENTTYPE
public static final String SETCOOKIE
public static final String HOST
public static final String COOKIE
public static final String ACCEPT_LANGUAGE
public static final String SESSION_COOKIE_NAME
public static final String SESSION_URL_NAME
protected boolean keepAlive
protected int timesRequested
protected long lastRun
protected long lastWait
protected String reqQuery
public void closeStreams() throws IOException
IOException
public void closeSocket()
public int getContentLength()
getContentLength
in interface javax.servlet.ServletRequest
public String getContentType()
getContentType
in interface javax.servlet.ServletRequest
getContentType
in interface javax.servlet.ServletResponse
public String getProtocol()
getProtocol
in interface javax.servlet.ServletRequest
public String getScheme()
getScheme
in interface javax.servlet.ServletRequest
public String getServerName()
getServerName
in interface javax.servlet.ServletRequest
public int getServerPort()
getServerPort
in interface javax.servlet.ServletRequest
public String getRemoteAddr()
getRemoteAddr
in interface javax.servlet.ServletRequest
public String getRemoteHost()
getRemoteHost
in interface javax.servlet.ServletRequest
public String getRealPath(String path)
getRealPath
in interface javax.servlet.ServletRequest
public javax.servlet.ServletInputStream getInputStream() throws IOException
getInputStream
in interface javax.servlet.ServletRequest
IOException
public BufferedReader getReader()
getReader
in interface javax.servlet.ServletRequest
public Enumeration getParameterNames()
getParameterNames
in interface javax.servlet.ServletRequest
public String getParameter(String name)
getParameter
in interface javax.servlet.ServletRequest
public String[] getParameterValues(String name)
getParameterValues
in interface javax.servlet.ServletRequest
public Object getAttribute(String name)
getAttribute
in interface javax.servlet.ServletRequest
public javax.servlet.http.Cookie[] getCookies()
getCookies
in interface javax.servlet.http.HttpServletRequest
public String getMethod()
getMethod
in interface javax.servlet.http.HttpServletRequest
public String getRequestURI()
getRequestURI
in interface javax.servlet.http.HttpServletRequest
public StringBuffer getRequestURL()
getRequestURL
in interface javax.servlet.http.HttpServletRequest
public String getServletPath()
getServletPath
in interface javax.servlet.http.HttpServletRequest
public String getPathInfo()
getPathInfo
in interface javax.servlet.http.HttpServletRequest
public String getPathTranslated()
getPathTranslated
in interface javax.servlet.http.HttpServletRequest
public String getQueryString()
getQueryString
in interface javax.servlet.http.HttpServletRequest
public String getRemoteUser()
getRemoteUser
in interface javax.servlet.http.HttpServletRequest
public String getAuthType()
getAuthType
in interface javax.servlet.http.HttpServletRequest
public String getHeader(String name)
getHeader
in interface javax.servlet.http.HttpServletRequest
getHeader
in interface javax.servlet.http.HttpServletResponse
public int getIntHeader(String name)
getIntHeader
in interface javax.servlet.http.HttpServletRequest
public long getDateHeader(String name)
getDateHeader
in interface javax.servlet.http.HttpServletRequest
public Enumeration getHeaderNames()
getHeaderNames
in interface javax.servlet.http.HttpServletRequest
getHeaderNames
in interface javax.servlet.http.HttpServletResponse
public javax.servlet.http.HttpSession getSession(boolean create)
getSession
in interface javax.servlet.http.HttpServletRequest
public javax.servlet.http.HttpSession getSession()
getSession
in interface javax.servlet.http.HttpServletRequest
public boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL
in interface javax.servlet.http.HttpServletRequest
public Enumeration getAttributeNames()
getAttributeNames
in interface javax.servlet.ServletRequest
public void setAttribute(String key, Object o)
Attribute names should follow the same conventions as package names. Names beginning with java.*, javax.*, and com.sun.*, are reserved for use by Sun Microsystems. If the object passed in is null, the effect is the same as calling removeAttribute(java.lang.String).
It is warned that when the request is dispatched from the servlet resides in a different web application by RequestDispatcher, the object set by this method may not be correctly retrieved in the caller servlet.setAttribute
in interface javax.servlet.ServletRequest
name
- - a String specifying the name of the attributeo
- - the Object to be storedpublic String getRequestedSessionId()
getRequestedSessionId
in interface javax.servlet.http.HttpServletRequest
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid
in interface javax.servlet.http.HttpServletRequest
public boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie
in interface javax.servlet.http.HttpServletRequest
public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl
in interface javax.servlet.http.HttpServletRequest
public void setContentLength(int length)
setContentLength
in interface javax.servlet.ServletResponse
public void setContentType(String type)
setContentType
in interface javax.servlet.ServletResponse
public javax.servlet.ServletOutputStream getOutputStream()
getOutputStream
in interface javax.servlet.ServletResponse
public PrintWriter getWriter() throws IOException
getWriter
in interface javax.servlet.ServletResponse
IOException
public String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletRequest
getCharacterEncoding
in interface javax.servlet.ServletResponse
public void flushBuffer() throws IOException
flushBuffer
in interface javax.servlet.ServletResponse
IOException
public void resetBuffer()
resetBuffer
in interface javax.servlet.ServletResponse
public int getBufferSize()
getBufferSize
in interface javax.servlet.ServletResponse
public void setBufferSize(int size)
setBufferSize
in interface javax.servlet.ServletResponse
public boolean isCommitted()
isCommitted
in interface javax.servlet.ServletResponse
setBufferSize(int), getBufferSize(), flushBuffer(), reset()
public void reset() throws IllegalStateException
reset
in interface javax.servlet.ServletResponse
IllegalStateException
- -
if the response has already been committedsetBufferSize(int), getBufferSize(), flushBuffer(), isCommitted()
public void setLocale(Locale locale)
setLocale
in interface javax.servlet.ServletResponse
loc
- -
the locale of the responsegetLocale()
public Locale getLocale()
getLocale
in interface javax.servlet.ServletRequest
getLocale
in interface javax.servlet.ServletResponse
public Enumeration getLocales()
getLocales
in interface javax.servlet.ServletRequest
public void setCharacterEncoding(String _enc)
setCharacterEncoding
in interface javax.servlet.ServletRequest
setCharacterEncoding
in interface javax.servlet.ServletResponse
a
- -
String containing the name of the chararacter encoding.UnsupportedEncodingException
- -
if this is not a valid encodingpublic void addDateHeader(String header, long date)
addDateHeader
in interface javax.servlet.http.HttpServletResponse
public void addHeader(String header, String value)
addHeader
in interface javax.servlet.http.HttpServletResponse
public void addIntHeader(String header, int value)
addIntHeader
in interface javax.servlet.http.HttpServletResponse
public javax.servlet.RequestDispatcher getRequestDispatcher(String urlpath)
getRequestDispatcher
in interface javax.servlet.ServletRequest
public boolean isSecure()
isSecure
in interface javax.servlet.ServletRequest
public void removeAttribute(String name)
removeAttribute
in interface javax.servlet.ServletRequest
public String getContextPath()
getContextPath
in interface javax.servlet.http.HttpServletRequest
public Enumeration getHeaders(String header)
getHeaders
in interface javax.servlet.http.HttpServletRequest
getHeaders
in interface javax.servlet.http.HttpServletResponse
public Principal getUserPrincipal()
getUserPrincipal
in interface javax.servlet.http.HttpServletRequest
public boolean isUserInRole(String user)
isUserInRole
in interface javax.servlet.http.HttpServletRequest
public Map getParameterMap()
getParameterMap
in interface javax.servlet.ServletRequest
public void addCookie(javax.servlet.http.Cookie cookie)
addCookie
in interface javax.servlet.http.HttpServletResponse
public boolean containsHeader(String name)
containsHeader
in interface javax.servlet.http.HttpServletResponse
public String encodeURL(String url)
encodeURL
in interface javax.servlet.http.HttpServletResponse
public String encodeRedirectURL(String url)
encodeRedirectURL
in interface javax.servlet.http.HttpServletResponse
public int getRemotePort()
getRemotePort
in interface javax.servlet.ServletRequest
public String getLocalName()
getLocalName
in interface javax.servlet.ServletRequest
String
containing the host name of the IP on which the request was received.public String getLocalAddr()
getLocalAddr
in interface javax.servlet.ServletRequest
String
containing the IP address on which the request was received.public int getLocalPort()
getLocalPort
in interface javax.servlet.ServletRequest
public void setStatus(int resCode, String resMessage)
setStatus
in interface javax.servlet.http.HttpServletResponse
public void setStatus(int resCode)
setStatus
in interface javax.servlet.http.HttpServletResponse
public void setHeader(String header, String value)
setHeader
in interface javax.servlet.http.HttpServletResponse
public void setIntHeader(String header, int value)
setIntHeader
in interface javax.servlet.http.HttpServletResponse
public void setLongHeader(String header, long value)
public void setDateHeader(String header, long value)
setDateHeader
in interface javax.servlet.http.HttpServletResponse
public void sendError(int resCode, String resMessage) throws IOException
sendError
in interface javax.servlet.http.HttpServletResponse
IOException
public void sendError(int resCode) throws IOException
sendError
in interface javax.servlet.http.HttpServletResponse
IOException
public void setInInclude(boolean set)
public void sendRedirect(String location) throws IOException
sendRedirect
in interface javax.servlet.http.HttpServletResponse
IOException
public String encodeUrl(String url)
encodeUrl
in interface javax.servlet.http.HttpServletResponse
public String encodeRedirectUrl(String url)
encodeRedirectUrl
in interface javax.servlet.http.HttpServletResponse
public Socket getSocket()
Copyright © 2014. All Rights Reserved.