SMILA (incubation) API documentation

org.eclipse.smila.http.server
Interface HttpExchange

All Known Implementing Classes:
HttpExchangeImpl

public interface HttpExchange

Provides the functionality for processing a HTTP request and generating a related response. The members of this class can be used when implementing the 'handle' method of the HttpHandler interface.


Method Summary
 java.lang.String getCharacterEncoding()
          Return the character encoding used in the request or null if none was set.
 java.lang.String getCompletePath()
           
 java.lang.String getHost()
          Return the host name of the HTTP server.
 java.util.Enumeration<java.lang.String> getParameterNames()
          Returns the a Enumeration of the parameter names.
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns the values of a parameter name.
 int getPort()
          Return the port of the HTTP server.
 java.lang.String getProtocol()
           
 java.lang.String getQueryParameter(java.lang.String name)
           
 java.lang.String getQueryString()
           
 java.lang.String getRequestHeader(java.lang.String name)
           
 java.util.Enumeration<java.lang.String> getRequestHeaders()
           
 int getRequestIntHeader(java.lang.String name)
           
 java.lang.String getRequestMethod()
           
 java.io.InputStream getRequestStream()
           
 java.lang.String getRequestURI()
           
 java.io.OutputStream getResponseStream()
          Returns a stream for writing binary data in the response.
 void setResponseHeader(java.lang.String name, java.lang.String value)
          Sets a response header with the given name and value.
 void setResponseIntHeader(java.lang.String name, int value)
          Sets a response header with the given name and integer value.
 void setResponseStatus(int sc)
          Sets the response's status code.
 

Method Detail

getHost

java.lang.String getHost()
Return the host name of the HTTP server.

Returns:
the host name of the HTTP server.

getPort

int getPort()
Return the port of the HTTP server.

Returns:
the port of the HTTP server.

getProtocol

java.lang.String getProtocol()
Returns:
the HTTP protocol version string.

getRequestMethod

java.lang.String getRequestMethod()
Returns:
the name of the HTTP method, for example, GET, POST, or PUT.

getRequestHeader

java.lang.String getRequestHeader(java.lang.String name)
Parameters:
name - header name
Returns:
the value of the specified request header.

getRequestIntHeader

int getRequestIntHeader(java.lang.String name)
Parameters:
name - header name
Returns:
the integer value of the specified request header.

getRequestHeaders

java.util.Enumeration<java.lang.String> getRequestHeaders()
Returns:
names of request headers.

getRequestURI

java.lang.String getRequestURI()
Returns:
the part of the request's URL from the protocol name up to the query string in the first line of the HTTP request. Example: POST /aaa/bbb?x=y HTTP/1.1 => /aaa/bbb

getCompletePath

java.lang.String getCompletePath()
Returns:
complete request path including query parameters and fragments.

getCharacterEncoding

java.lang.String getCharacterEncoding()
Return the character encoding used in the request or null if none was set.

Returns:
the character encoding or null

getQueryString

java.lang.String getQueryString()
Returns:
the query string contained in the request URL after the path.

getQueryParameter

java.lang.String getQueryParameter(java.lang.String name)
Parameters:
name - parameter name
Returns:
the value of the specified parameter from the query string.

getRequestStream

java.io.InputStream getRequestStream()
                                     throws java.io.IOException
Returns:
a stream for reading the request's body as binary data.
Throws:
java.io.IOException - IO error

getParameterNames

java.util.Enumeration<java.lang.String> getParameterNames()
Returns the a Enumeration of the parameter names.

Returns:
a Enumeration of the parameter names

getParameterValues

java.lang.String[] getParameterValues(java.lang.String name)
Returns the values of a parameter name.

Parameters:
name - the name of the parameter
Returns:
the values of the parameter

setResponseStatus

void setResponseStatus(int sc)
Sets the response's status code.

Parameters:
sc - new status code

setResponseHeader

void setResponseHeader(java.lang.String name,
                       java.lang.String value)
Sets a response header with the given name and value.

Parameters:
name - header name
value - header value

setResponseIntHeader

void setResponseIntHeader(java.lang.String name,
                          int value)
Sets a response header with the given name and integer value.

Parameters:
name - header name
value - int header value

getResponseStream

java.io.OutputStream getResponseStream()
                                       throws java.io.IOException
Returns a stream for writing binary data in the response. Calling flush() on the stream commits the response.

Returns:
a stream for writing binary data in the response.
Throws:
java.io.IOException - IO error

SMILA (incubation) API documentation