com.noelios.restlet.ext.servlet
Class ServletCall

java.lang.Object
  extended by com.noelios.restlet.http.HttpCall
      extended by com.noelios.restlet.http.HttpServerCall
          extended by com.noelios.restlet.ext.servlet.ServletCall

public class ServletCall
extends HttpServerCall

Call that is used by the Servlet HTTP server connector.

Author:
Jerome Louvel (contact@noelios.com)

Constructor Summary
ServletCall(Logger logger, String serverAddress, int serverPort, HttpServletRequest request, HttpServletResponse response)
          Constructor.
ServletCall(Server server, HttpServletRequest request, HttpServletResponse response)
          Constructor.
 
Method Summary
 String getClientAddress()
           
 int getClientPort()
           
 String getHostDomain()
          Returns the server domain name.
 String getMethod()
          Returns the request method.
 Protocol getProtocol()
          Returns the server protocol.
 HttpServletRequest getRequest()
          Returns the HTTP Servlet request.
 ReadableByteChannel getRequestChannel()
          Returns the request entity channel if it exists.
 Series<Parameter> getRequestHeaders()
          Returns the list of request headers.
 InputStream getRequestStream()
          Returns the request entity stream if it exists.
 String getRequestUri()
          Returns the full request URI.
 HttpServletResponse getResponse()
          Returns the HTTP Servlet response.
 WritableByteChannel getResponseChannel()
          Returns the response channel if it exists.
 OutputStream getResponseStream()
          Returns the response stream if it exists.
 String getServerAddress()
          Returns the response address.
Corresponds to the IP address of the responding server.
 int getServerPort()
          Returns the server port.
 String getVersion()
           
 boolean isConfidential()
          Indicates if the request was made using a confidential mean.
 void sendResponse(Response response)
          Sends the response back to the client.
 
Methods inherited from class com.noelios.restlet.http.HttpServerCall
getHostPort, getRequestEntity, readRequestHead, writeResponseBody, writeResponseHead, writeResponseHead
 
Methods inherited from class com.noelios.restlet.http.HttpCall
formatDate, getConnectorService, getLogger, getReasonPhrase, getResponseHeaders, getStatusCode, parseDate, setClientAddress, setClientPort, setConfidential, setHostDomain, setHostPort, setLogger, setMethod, setProtocol, setReasonPhrase, setRequestUri, setServerAddress, setServerPort, setStatusCode, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletCall

public ServletCall(Server server,
                   HttpServletRequest request,
                   HttpServletResponse response)
Constructor.

Parameters:
server - The parent server.
request - The HTTP Servlet request to wrap.
response - The HTTP Servlet response to wrap.

ServletCall

public ServletCall(Logger logger,
                   String serverAddress,
                   int serverPort,
                   HttpServletRequest request,
                   HttpServletResponse response)
Constructor.

Parameters:
logger - The logger.
serverAddress - The server IP address.
serverPort - The server port.
Method Detail

getClientAddress

public String getClientAddress()
Overrides:
getClientAddress in class HttpCall

getClientPort

public int getClientPort()
Overrides:
getClientPort in class HttpCall

getHostDomain

public String getHostDomain()
Returns the server domain name.

Overrides:
getHostDomain in class HttpServerCall
Returns:
The server domain name.

getMethod

public String getMethod()
Returns the request method.

Overrides:
getMethod in class HttpCall
Returns:
The request method.

getProtocol

public Protocol getProtocol()
Returns the server protocol.

Overrides:
getProtocol in class HttpCall
Returns:
The server protocol.

getRequest

public HttpServletRequest getRequest()
Returns the HTTP Servlet request.

Returns:
The HTTP Servlet request.

getRequestChannel

public ReadableByteChannel getRequestChannel()
Returns the request entity channel if it exists.

Specified by:
getRequestChannel in class HttpServerCall
Returns:
The request entity channel if it exists.

getRequestHeaders

public Series<Parameter> getRequestHeaders()
Returns the list of request headers.

Overrides:
getRequestHeaders in class HttpCall
Returns:
The list of request headers.

getRequestStream

public InputStream getRequestStream()
Returns the request entity stream if it exists.

Specified by:
getRequestStream in class HttpServerCall
Returns:
The request entity stream if it exists.

getRequestUri

public String getRequestUri()
Returns the full request URI.

Overrides:
getRequestUri in class HttpCall
Returns:
The full request URI.

getResponse

public HttpServletResponse getResponse()
Returns the HTTP Servlet response.

Returns:
The HTTP Servlet response.

getResponseChannel

public WritableByteChannel getResponseChannel()
Returns the response channel if it exists.

Specified by:
getResponseChannel in class HttpServerCall
Returns:
The response channel if it exists.

getResponseStream

public OutputStream getResponseStream()
Returns the response stream if it exists.

Specified by:
getResponseStream in class HttpServerCall
Returns:
The response stream if it exists.

getServerAddress

public String getServerAddress()
Returns the response address.
Corresponds to the IP address of the responding server.

Overrides:
getServerAddress in class HttpCall
Returns:
The response address.

getServerPort

public int getServerPort()
Returns the server port.

Overrides:
getServerPort in class HttpCall
Returns:
The server port.

getVersion

public String getVersion()
Overrides:
getVersion in class HttpCall

isConfidential

public boolean isConfidential()
Indicates if the request was made using a confidential mean.

Overrides:
isConfidential in class HttpCall
Returns:
True if the request was made using a confidential mean.

sendResponse

public void sendResponse(Response response)
                  throws IOException
Sends the response back to the client. Commits the status, headers and optional entity and send them on the network.

Overrides:
sendResponse in class HttpServerCall
Parameters:
response - The high-level response.
Throws:
IOException


Copyright © 2005-2007 Noelios Consulting.