org.restlet
Class Server

java.lang.Object
  extended by org.restlet.Uniform
      extended by org.restlet.Restlet
          extended by org.restlet.Connector
              extended by org.restlet.Server

public class Server
extends Connector

Connector acting as a generic server. It internally uses one of the available connectors registered with the current Restlet implementation.

Author:
Jerome Louvel (contact@noelios.com)

Constructor Summary
Server(Context context, List<Protocol> protocols, int port, Restlet target)
          Constructor.
Server(Context context, List<Protocol> protocols, String address, int port, Restlet target)
          Constructor.
Server(Context context, Protocol protocol, int port, Restlet target)
          Constructor.
Server(Context context, Protocol protocol, Restlet target)
          Constructor using the protocol's default port.
Server(Context context, Protocol protocol, String address, int port, Restlet target)
          Constructor.
Server(List<Protocol> protocols, int port, Restlet target)
          Constructor.
Server(List<Protocol> protocols, String address, int port, Restlet target)
          Constructor.
Server(Protocol protocol, int port, Restlet target)
          Constructor.
Server(Protocol protocol, Restlet target)
          Constructor using the protocol's default port.
Server(Protocol protocol, String address, int port, Restlet target)
          Constructor.
Server(Protocol protocol, String address, Restlet target)
          Constructor using the protocol's default port.
 
Method Summary
 String getAddress()
          Returns the optional listening IP address (local host used if null).
 int getPort()
          Returns the listening port if specified.
 Restlet getTarget()
          Returns the target Restlet.
 void handle(Request request, Response response)
          Handles a call.
 boolean hasTarget()
          Indicates if a target Restlet is set.
protected  void setAddress(String address)
          Sets the optional listening IP address (local host used if null).
protected  void setPort(int port)
          Sets the listening port if specified.
 void setTarget(Restlet target)
          Sets the target Restlet.
 void start()
          Starts the Restlet.
 void stop()
          Stops the Restlet.
 
Methods inherited from class org.restlet.Connector
getProtocols
 
Methods inherited from class org.restlet.Restlet
getContext, getLogger, init, isStarted, isStopped, setContext
 
Methods inherited from class org.restlet.Uniform
delete, delete, get, get, handle, head, head, options, options, post, post, put, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Server

public Server(Context context,
              List<Protocol> protocols,
              int port,
              Restlet target)
Constructor.

Parameters:
context - The context.
protocols - The connector protocols.
port - The listening port.
target - The target Restlet.

Server

public Server(Context context,
              List<Protocol> protocols,
              String address,
              int port,
              Restlet target)
Constructor.

Parameters:
context - The context.
protocols - The connector protocols.
address - The optional listening IP address (useful if multiple IP addresses available).
port - The listening port.
target - The target Restlet.

Server

public Server(Context context,
              Protocol protocol,
              int port,
              Restlet target)
Constructor.

Parameters:
context - The context.
protocol - The connector protocol.
port - The listening port.
target - The target Restlet.

Server

public Server(Context context,
              Protocol protocol,
              Restlet target)
Constructor using the protocol's default port.

Parameters:
context - The context.
protocol - The connector protocol.
target - The target Restlet.

Server

public Server(Context context,
              Protocol protocol,
              String address,
              int port,
              Restlet target)
Constructor.

Parameters:
context - The context.
protocol - The connector protocol.
address - The optional listening IP address (useful if multiple IP addresses available).
port - The listening port.
target - The target Restlet.

Server

public Server(List<Protocol> protocols,
              int port,
              Restlet target)
Constructor.

Parameters:
protocols - The connector protocols.
port - The listening port.
target - The target Restlet.

Server

public Server(List<Protocol> protocols,
              String address,
              int port,
              Restlet target)
Constructor.

Parameters:
protocols - The connector protocols.
address - The optional listening IP address (useful if multiple IP addresses available).
port - The listening port.
target - The target Restlet.

Server

public Server(Protocol protocol,
              int port,
              Restlet target)
Constructor.

Parameters:
protocol - The connector protocol.
port - The listening port.
target - The target Restlet.

Server

public Server(Protocol protocol,
              Restlet target)
Constructor using the protocol's default port.

Parameters:
protocol - The connector protocol.
target - The target Restlet.

Server

public Server(Protocol protocol,
              String address,
              Restlet target)
Constructor using the protocol's default port.

Parameters:
protocol - The connector protocol.
address - The listening IP address (useful if multiple IP addresses available).
target - The target Restlet.

Server

public Server(Protocol protocol,
              String address,
              int port,
              Restlet target)
Constructor.

Parameters:
protocol - The connector protocol.
address - The optional listening IP address (useful if multiple IP addresses available).
port - The listening port.
target - The target Restlet.
Method Detail

getAddress

public String getAddress()
Returns the optional listening IP address (local host used if null).

Returns:
The optional listening IP address (local host used if null).

getPort

public int getPort()
Returns the listening port if specified.

Returns:
The listening port if specified.

getTarget

public Restlet getTarget()
Returns the target Restlet.

Returns:
The target Restlet.

handle

public void handle(Request request,
                   Response response)
Handles a call.

Overrides:
handle in class Restlet
Parameters:
request - The request to handle.
response - The response to update.

hasTarget

public boolean hasTarget()
Indicates if a target Restlet is set.

Returns:
True if a target Restlet is set.

setAddress

protected void setAddress(String address)
Sets the optional listening IP address (local host used if null).

Parameters:
address - The optional listening IP address (local host used if null).

setPort

protected void setPort(int port)
Sets the listening port if specified.

Parameters:
port - The listening port if specified.

setTarget

public void setTarget(Restlet target)
Sets the target Restlet.

Parameters:
target - The target Restlet.

start

public void start()
           throws Exception
Description copied from class: Restlet
Starts the Restlet.

Overrides:
start in class Restlet
Throws:
Exception

stop

public void stop()
          throws Exception
Description copied from class: Restlet
Stops the Restlet.

Overrides:
stop in class Restlet
Throws:
Exception


Copyright © 2005-2007 Noelios Technologies.