Acme.Serve.ServeConnection Class Reference

List of all members.

Detailed Description

provides request/response

Definition at line 1000 of file Serve.java.

Public Member Functions

 ServeConnection (Socket socket, Serve serve)
 Constructor.
String getLocalAddr ()
 Returns the Internet Protocol (IP) address of the interface on which the request was received.
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.
int getRemotePort ()
 Returns the Internet Protocol (IP) source port of the client or last proxy that sent the request.
void run ()
int getContentLength ()
 Returns the size of the request entity data, or -1 if not known.
String getContentType ()
 Returns the MIME type of the request entity data, or null if.
String getProtocol ()
 Returns the protocol and version of the request as a string of.
String getScheme ()
 Returns the scheme of the URL used in this request, for example.
String getServerName ()
 Returns the host name of the server as used in the <host> part of.
int getServerPort ()
 Returns the port number on which this request was received as used in.
String getRemoteAddr ()
 Returns the IP address of the agent that sent the request.
String getRemoteHost ()
 Returns the fully qualified host name of the agent that sent the.
String getRealPath (String path)
 Applies alias rules to the specified virtual path and returns the.
ServletInputStream getInputStream () throws IOException
 Returns an input stream for reading request data.
BufferedReader getReader ()
 Returns a buffered reader for reading request data.
Enumeration getParameterNames ()
 Returns the parameter names for this request.
String getParameter (String name)
 Returns the value of the specified query string parameter, or null.
String[] getParameterValues (String name)
 Returns the values of the specified parameter for the request as an.
Object getAttribute (String name)
 Returns the value of the named attribute of the request, or null if.
Cookie[] getCookies ()
 Gets the array of cookies found in this request.
String getMethod ()
 Returns the method with which the request was made. This can be "GET",.
String getRequestURI ()
 Returns the full request URI.
java.lang.StringBuffer getRequestURL ()
 Reconstructs the URL the client used to make the request.
String getServletPath ()
 Returns the part of the request URI that referred to the servlet being.
String getPathInfo ()
 Returns optional extra path information following the servlet path, but.
String getPathTranslated ()
 Returns extra path information translated to a real path. Returns.
String getQueryString ()
 Returns the query string part of the servlet URI, or null if not known.
String getRemoteUser ()
 Returns the name of the user making this request, or null if not known.
String getAuthType ()
 Returns the authentication scheme of the request, or null if none.
String getHeader (String name)
 Returns the value of a header field, or null if not known.
int getIntHeader (String name)
int getIntHeader (String name, int def)
 Returns the value of an integer header field.
long getLongHeader (String name, long def)
 Returns the value of a long header field.
long getDateHeader (String name)
long getDateHeader (String name, long def)
 Returns the value of a date header field.
Enumeration getHeaderNames ()
 Returns an Enumeration of the header names.
HttpSession getSession (boolean create)
 Gets the current valid session associated with this request, if.
HttpSession getSession ()
boolean isRequestedSessionIdFromURL ()
Enumeration getAttributeNames ()
void setAttribute (String key, Object o)
String getRequestedSessionId ()
 Gets the session id specified with this request. This may differ.
boolean isRequestedSessionIdValid ()
 Checks whether this request is associated with a session that is.
boolean isRequestedSessionIdFromCookie ()
 Checks whether the session id specified by this request came in as a cookie.
boolean isRequestedSessionIdFromUrl ()
 Checks whether the session id specified by this request came in as.
void setContentLength (int length)
 Sets the content length for this response.
void setContentType (String type)
 Sets the content type for this response.
ServletOutputStream getOutputStream ()
 Returns an output stream for writing response data.
PrintWriter getWriter () throws IOException
 Returns a print writer for writing response data. The MIME type of.
String getCharacterEncoding ()
 Returns the character set encoding used for this MIME body. The.
void flushBuffer ()
void resetBuffer ()
 Clears the content of the underlying buffer in the response without clearing headers or status code.
int getBufferSize ()
void setBufferSize (int size)
boolean isCommitted ()
 Returns a boolean indicating if the response has been committed.
void reset () throws IllegalStateException
 Clears any data that exists in the buffer as well as the status code and headers.
void setLocale (java.util.Locale locale)
 Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate.
java.util.Locale getLocale ()
Enumeration getLocales ()
void setCharacterEncoding (String _enc)
 Overrides the name of the character encoding used in the body of this request.
void addDateHeader (String header, long date)
void addHeader (String header, String value)
void addIntHeader (String header, int value)
RequestDispatcher getRequestDispatcher (String urlpath)
boolean isSecure ()
void removeAttribute (String name)
String getContextPath ()
Enumeration getHeaders (String header)
java.security.Principal getUserPrincipal ()
boolean isUserInRole (String user)
java.util.Map getParameterMap ()
 Returns a java.util.Map of the parameters of this request.
void addCookie (Cookie cookie)
 Adds the specified cookie to the response. It can be called.
boolean containsHeader (String name)
 Checks whether the response message header has a field with the.
String encodeURL (String url)
String encodeRedirectURL (String url)
void setStatus (int resCode, String resMessage)
 Sets the status code and message for this response.
void setStatus (int resCode)
 Sets the status code and a default message for this response.
void setHeader (String name, String value)
 Sets the value of a header field.
void setIntHeader (String name, int value)
 Sets the value of an integer header field.
void setLongHeader (String name, long value)
 Sets the value of a long header field.
void setDateHeader (String name, long value)
 Sets the value of a date header field.
void sendError (int resCode, String resMessage) throws IOException
 Writes an error response using the specified status code and message.
void sendError (int resCode) throws IOException
 Writes an error response using the specified status code and a default.
void sendRedirect (String location) throws IOException
 Sends a redirect message to the client using the specified redirect.
String encodeUrl (String url)
 Encodes the specified URL by including the session ID in it, or, if.
String encodeRedirectUrl (String url)
 Encodes the specified URL for use in the sendRedirect method or, if.

Static Public Attributes

static final String WWWFORMURLENCODE = "application/x-www-form-urlencoded"
static final String TRANSFERENCODING = "Transfer-Encoding"
static final String CHUNKED = "chunked"
static final String CONTENTLENGTH = "Content-Length"
static final String CONTENTTYPE = "Content-Type"
static final String SETCOOKIE = "Set-Cookie"
static final String COOKIE = "Cookie"
static final String SESSION_COOKIE_NAME = "JSESSIONID"

Static Protected Attributes

static final SimpleDateFormat expdatefmt = new SimpleDateFormat("EEE, dd-MMM-yyyy HH:mm:ss 'GMT'")
static final SimpleDateFormat headerdateformat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z")

Package Functions

void parseCookies ()
void writeHeaders () throws IOException
 Writes the status line and message headers for this response to the.

Package Attributes

String reqQuery = null


Member Function Documentation

String Acme.Serve.ServeConnection.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

Definition at line 1064 of file Serve.java.

String Acme.Serve.ServeConnection.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

Definition at line 1077 of file Serve.java.

int Acme.Serve.ServeConnection.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

Definition at line 1089 of file Serve.java.

References Acme.Serve.Serve.port.

int Acme.Serve.ServeConnection.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

Definition at line 1101 of file Serve.java.

References Acme.Serve.Serve.port.

java.lang.StringBuffer Acme.Serve.ServeConnection.getRequestURL (  ) 

Reconstructs the URL the client used to make the request.

The returned URL contains a protocol, server name, port number, and server path, but it does not include query string parameters.
Because this method returns a StringBuffer, not a string, you can modify the URL easily, for example, to append query parameters.

This method is useful for creating redirect messages and for reporting errors.

Returns:
a StringBuffer object containing the reconstructed URL
Since:
2.3

Definition at line 1598 of file Serve.java.

References Acme.Serve.ServeConnection.getRequestURI(), Acme.Serve.ServeConnection.getScheme(), Acme.Serve.Serve.hostName, and Acme.Serve.Serve.port.

boolean Acme.Serve.ServeConnection.isRequestedSessionIdFromCookie (  ) 

Checks whether the session id specified by this request came in as a cookie.

(The requested session may not be one returned by the getSession method.)

Definition at line 1797 of file Serve.java.

void Acme.Serve.ServeConnection.resetBuffer (  ) 

Clears the content of the underlying buffer in the response without clearing headers or status code.

If the response has been committed, this method throws an IllegalStateException.

Since:
2.3

Definition at line 1888 of file Serve.java.

boolean Acme.Serve.ServeConnection.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()

Definition at line 1908 of file Serve.java.

Referenced by Acme.Serve.ServeConnection.reset(), and Acme.Serve.ServeConnection.sendRedirect().

void Acme.Serve.ServeConnection.reset (  )  throws IllegalStateException

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.

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

Definition at line 1918 of file Serve.java.

References Acme.Serve.ServeConnection.isCommitted().

void Acme.Serve.ServeConnection.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.

Parameters:
loc - the locale of the response
See also:
getLocale()

Definition at line 1934 of file Serve.java.

void Acme.Serve.ServeConnection.setCharacterEncoding ( 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().

Parameters:
a - String containing the name of the chararacter encoding.
Exceptions:
java.io.UnsupportedEncodingException - if this is not a valid encoding
Since:
JSDK 2.3

Definition at line 1956 of file Serve.java.

java.util.Map Acme.Serve.ServeConnection.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

Definition at line 2031 of file Serve.java.


The documentation for this class was generated from the following file:
Generated on Mon Dec 4 11:03:33 2006 for OpenMobileIS by  doxygen 1.5.1-p1