org.openmobileis.embedded.webserver
Class WebServerConnection

java.lang.Object
  extended byorg.openmobileis.embedded.webserver.WebServerConnection

public class WebServerConnection
extends java.lang.Object


Field Summary
static java.lang.String CHUNKED
           
protected  long connexionLifeTime
           
static java.lang.String CONTENTLENGTH
           
static java.lang.String CONTENTTYPE
           
protected static java.text.SimpleDateFormat expdatefmt
           
protected static java.text.SimpleDateFormat headerdateformat
           
static java.lang.String TRANSFERENCODING
           
static java.lang.String WWWFORMURLENCODE
           
 
Constructor Summary
WebServerConnection()
           
 
Method Summary
 void addCookie(Cookie cookie)
           
 void addDateHeader(java.lang.String header, long date)
           
 void addHeader(java.lang.String header, java.lang.String value)
           
 void addIntHeader(java.lang.String header, int value)
           
 boolean containsHeader(java.lang.String name)
           
 java.lang.String encodeRedirectUrl(java.lang.String url)
           
 java.lang.String encodeRedirectURL(java.lang.String url)
           
 java.lang.String encodeUrl(java.lang.String url)
           
 java.lang.String encodeURL(java.lang.String url)
           
 void flushBuffer()
           
 java.lang.Object getAttribute(java.lang.String name)
           
 java.util.Enumeration getAttributeNames()
           
 java.lang.String getAuthType()
           
 int getBufferSize()
           
 java.lang.String getCharacterEncoding()
           
 int getContentLength()
           
 java.lang.String getContentType()
           
 java.lang.String getContextPath()
           
 Cookie[] getCookies()
           
 long getDateHeader(java.lang.String name)
           
 java.lang.String getHeader(java.lang.String name)
           
 java.util.Enumeration getHeaderNames()
           
 java.util.Enumeration getHeaders(java.lang.String header)
           
 ServletInputStream getInputStream()
           
 int getIntHeader(java.lang.String name)
           
 java.lang.String getLocalAddr()
          Returns the Internet Protocol (IP) address of the interface on which the request was received.
 java.util.Locale getLocale()
           
 java.util.Enumeration getLocales()
           
 java.lang.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.
 java.lang.String getMethod()
           
 ServletOutputStream getOutputStream()
           
 java.lang.String getParameter(java.lang.String name)
           
 java.util.Map getParameterMap()
          Returns a java.util.Map of the parameters of this request.
 java.util.Enumeration getParameterNames()
           
 java.lang.String[] getParameterValues(java.lang.String name)
           
 java.lang.String getPathInfo()
           
 java.lang.String getPathTranslated()
           
 java.lang.String getProtocol()
           
 java.lang.String getQueryString()
           
 java.io.BufferedReader getReader()
           
 java.lang.String getRealPath(java.lang.String path)
           
 java.lang.String getRemoteAddr()
           
 java.lang.String getRemoteHost()
           
 int getRemotePort()
          Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
 java.lang.String getRemoteUser()
           
 RequestDispatcher getRequestDispatcher(java.lang.String urlpath)
           
 java.lang.String getRequestedSessionId()
           
 java.lang.String getRequestURI()
           
 java.lang.StringBuffer getRequestURL()
           
 java.lang.String getScheme()
           
 java.lang.String getServerName()
           
 int getServerPort()
           
 java.lang.String getServletPath()
           
 HttpSession getSession()
           
 HttpSession getSession(boolean create)
           
 java.security.Principal getUserPrincipal()
           
 java.io.PrintWriter getWriter()
           
 void init(WebServer webserver, java.net.Socket socket)
           
 boolean isCommitted()
          Returns a boolean indicating if the response has been committed.
 boolean isRequestedSessionIdFromCookie()
           
 boolean isRequestedSessionIdFromUrl()
           
 boolean isRequestedSessionIdFromURL()
           
 boolean isRequestedSessionIdValid()
           
 boolean isSecure()
           
 boolean isUserInRole(java.lang.String arg0)
           
 void removeAttribute(java.lang.String name)
           
 void reset()
          Clears any data that exists in the buffer as well as the status code and headers.
 void resetBuffer()
           
 void run()
           
 void sendError(int resCode)
           
 void sendError(int resCode, java.lang.String resMessage)
           
 void sendRedirect(java.lang.String location)
           
 void setAttribute(java.lang.String key, java.lang.Object o)
           
 void setBufferSize(int size)
           
 void setCharacterEncoding(java.lang.String _enc)
          Overrides the name of the character encoding used in the body of this request.
 void setContentLength(int length)
           
 void setContentType(java.lang.String type)
           
 void setDateHeader(java.lang.String name, long value)
           
 void setHeader(java.lang.String name, java.lang.String value)
           
 void setIntHeader(java.lang.String name, int value)
           
 void setLocale(java.util.Locale locale)
          Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate.
 void setStatus(int resCode)
           
 void setStatus(int resCode, java.lang.String resMessage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WWWFORMURLENCODE

public static final java.lang.String WWWFORMURLENCODE
See Also:
Constant Field Values

TRANSFERENCODING

public static final java.lang.String TRANSFERENCODING
See Also:
Constant Field Values

CHUNKED

public static final java.lang.String CHUNKED
See Also:
Constant Field Values

CONTENTLENGTH

public static final java.lang.String CONTENTLENGTH
See Also:
Constant Field Values

CONTENTTYPE

public static final java.lang.String CONTENTTYPE
See Also:
Constant Field Values

connexionLifeTime

protected long connexionLifeTime

expdatefmt

protected static final java.text.SimpleDateFormat expdatefmt

headerdateformat

protected static final java.text.SimpleDateFormat headerdateformat
Constructor Detail

WebServerConnection

public WebServerConnection()
Method Detail

init

public void init(WebServer webserver,
                 java.net.Socket socket)

run

public void run()

getAttribute

public java.lang.Object getAttribute(java.lang.String name)

getAttributeNames

public java.util.Enumeration getAttributeNames()

getAuthType

public java.lang.String getAuthType()

getContentLength

public int getContentLength()

getContentType

public java.lang.String getContentType()

getContextPath

public java.lang.String getContextPath()

getCookies

public Cookie[] getCookies()

getDateHeader

public long getDateHeader(java.lang.String name)

getHeader

public java.lang.String getHeader(java.lang.String name)

getHeaderNames

public java.util.Enumeration getHeaderNames()

getHeaders

public java.util.Enumeration getHeaders(java.lang.String header)

getInputStream

public ServletInputStream getInputStream()
                                  throws java.io.IOException
Throws:
java.io.IOException

getIntHeader

public int getIntHeader(java.lang.String name)

getLocalAddr

public java.lang.String getLocalAddr()
Returns the Internet Protocol (IP) address of the interface on which the request was received.

Returns:
a String containing the IP address on which the request was received.
Since:
2.4

getLocales

public java.util.Enumeration getLocales()

getLocalName

public java.lang.String getLocalName()
Returns the host name of the Internet Protocol (IP) interface on which the request was received.

Returns:
a String containing the host name of the IP on which the request was received.
Since:
2.4

getLocalPort

public int getLocalPort()
Returns the Internet Protocol (IP) port number of the interface on which the request was received.

Returns:
an integer specifying the port number
Since:
2.4

getMethod

public java.lang.String getMethod()

getParameter

public java.lang.String getParameter(java.lang.String name)

getParameterMap

public java.util.Map getParameterMap()
Returns a java.util.Map of the parameters of this request. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.

Returns:
an immutable java.util.Map containing parameter names as keys and parameter values as map values. The keys in the parameter map are of type String. The values in the parameter map are of type String array.
Since:
2.3

getParameterNames

public java.util.Enumeration getParameterNames()

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)

getPathInfo

public java.lang.String getPathInfo()

getPathTranslated

public java.lang.String getPathTranslated()

getProtocol

public java.lang.String getProtocol()

getQueryString

public java.lang.String getQueryString()

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException
Throws:
java.io.IOException

getRealPath

public java.lang.String getRealPath(java.lang.String path)

getRemoteAddr

public java.lang.String getRemoteAddr()

getRemoteHost

public java.lang.String getRemoteHost()

getRemotePort

public int getRemotePort()
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.

Returns:
an integer specifying the port number
Since:
2.4

getRemoteUser

public java.lang.String getRemoteUser()

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(java.lang.String urlpath)

getRequestedSessionId

public java.lang.String getRequestedSessionId()

getRequestURI

public java.lang.String getRequestURI()

getRequestURL

public java.lang.StringBuffer getRequestURL()

getScheme

public java.lang.String getScheme()

getServerName

public java.lang.String getServerName()

getServerPort

public int getServerPort()

getServletPath

public java.lang.String getServletPath()

getSession

public HttpSession getSession()

getSession

public HttpSession getSession(boolean create)

getUserPrincipal

public java.security.Principal getUserPrincipal()

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()

isSecure

public boolean isSecure()

isUserInRole

public boolean isUserInRole(java.lang.String arg0)

removeAttribute

public void removeAttribute(java.lang.String name)

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object o)

setCharacterEncoding

public void setCharacterEncoding(java.lang.String _enc)
Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading request parameters or reading input using getReader().

Throws:
java.io.UnsupportedEncodingException - - if this is not a valid encoding
Since:
JSDK 2.3

getCharacterEncoding

public java.lang.String getCharacterEncoding()

getLocale

public java.util.Locale getLocale()

addCookie

public void addCookie(Cookie cookie)

addDateHeader

public void addDateHeader(java.lang.String header,
                          long date)

addHeader

public void addHeader(java.lang.String header,
                      java.lang.String value)

addIntHeader

public void addIntHeader(java.lang.String header,
                         int value)

containsHeader

public boolean containsHeader(java.lang.String name)

encodeRedirectUrl

public java.lang.String encodeRedirectUrl(java.lang.String url)

encodeRedirectURL

public java.lang.String encodeRedirectURL(java.lang.String url)

encodeUrl

public java.lang.String encodeUrl(java.lang.String url)

encodeURL

public java.lang.String encodeURL(java.lang.String url)

flushBuffer

public void flushBuffer()

getBufferSize

public int getBufferSize()

getOutputStream

public ServletOutputStream getOutputStream()
                                    throws java.io.IOException
Throws:
java.io.IOException

getWriter

public java.io.PrintWriter getWriter()
                              throws java.io.IOException
Throws:
java.io.IOException

isCommitted

public boolean isCommitted()
Returns a boolean indicating if the response has been committed. A commited response has already had its status code and headers written.

Returns:
a boolean indicating if the response has been committed
See Also:
setBufferSize(int), getBufferSize(), flushBuffer(), reset()

reset

public void reset()
Clears any data that exists in the buffer as well as the status code and headers. If the response has been committed, this method throws an IllegalStateException.

Throws:
java.lang.IllegalStateException - - if the response has already been committed
See Also:
setBufferSize(int), getBufferSize(), flushBuffer(), isCommitted()

resetBuffer

public void resetBuffer()

sendError

public void sendError(int resCode,
                      java.lang.String resMessage)
               throws java.io.IOException
Throws:
java.io.IOException

sendError

public void sendError(int resCode)
               throws java.io.IOException
Throws:
java.io.IOException

sendRedirect

public void sendRedirect(java.lang.String location)
                  throws java.io.IOException
Throws:
java.io.IOException

setBufferSize

public void setBufferSize(int size)

setContentLength

public void setContentLength(int length)

setContentType

public void setContentType(java.lang.String type)

setDateHeader

public void setDateHeader(java.lang.String name,
                          long value)

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)

setIntHeader

public void setIntHeader(java.lang.String name,
                         int value)

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate. This method should be called before a call to getWriter(). By default, the response locale is the default locale for the server.

See Also:
getLocale()

setStatus

public void setStatus(int resCode)

setStatus

public void setStatus(int resCode,
                      java.lang.String resMessage)


Copyright 2005 e-Care. All Rights Reserved.