|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.Uniform
org.restlet.Restlet
org.restlet.Connector
org.restlet.Server
public class Server
Connector acting as a generic server. It internally uses one of the available connectors registered with the current Restlet implementation.
| 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,
List<Protocol> protocols,
String address,
int port,
Restlet target,
String helperClass)
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 |
getEphemeralPort()
Returns the actual ephemeral port used when the listening port is set to '0'. |
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, setProtocols |
| Methods inherited from class org.restlet.Restlet |
|---|
getApplication, 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 |
|---|
public Server(Context context,
List<Protocol> protocols,
int port,
Restlet target)
context - The context.protocols - The connector protocols.port - The listening port.target - The target Restlet.
public Server(Context context,
List<Protocol> protocols,
String address,
int port,
Restlet target)
context - The context.protocols - The connector protocols.address - The optional listening IP address (useful if multiple IP
addresses available). You can also use a domain name as an
alias for the IP address to listen to.port - The listening port.target - The target Restlet.
public Server(Context context,
List<Protocol> protocols,
String address,
int port,
Restlet target,
String helperClass)
context - The context.protocols - The connector protocols.address - The optional listening IP address (useful if multiple IP
addresses available). You can also use a domain name as an
alias for the IP address to listen to.port - The listening port.target - The target Restlet.helperClass - Optional helper class name.
public Server(Context context,
Protocol protocol,
int port,
Restlet target)
context - The context.protocol - The connector protocol.port - The listening port.target - The target Restlet.
public Server(Context context,
Protocol protocol,
Restlet target)
context - The context.protocol - The connector protocol.target - The target Restlet.
public Server(Context context,
Protocol protocol,
String address,
int port,
Restlet target)
context - The context.protocol - The connector protocol.address - The optional listening IP address (useful if multiple IP
addresses available). You can also use a domain name as an
alias for the IP address to listen to.port - The listening port.target - The target Restlet.
public Server(List<Protocol> protocols,
int port,
Restlet target)
protocols - The connector protocols.port - The listening port.target - The target Restlet.
public Server(List<Protocol> protocols,
String address,
int port,
Restlet target)
protocols - The connector protocols.address - The optional listening IP address (useful if multiple IP
addresses available). You can also use a domain name as an
alias for the IP address to listen to.port - The listening port.target - The target Restlet.
public Server(Protocol protocol,
int port,
Restlet target)
protocol - The connector protocol.port - The listening port.target - The target Restlet.
public Server(Protocol protocol,
Restlet target)
protocol - The connector protocol.target - The target Restlet.
public Server(Protocol protocol,
String address,
int port,
Restlet target)
protocol - The connector protocol.address - The optional listening IP address (useful if multiple IP
addresses available). You can also use a domain name as an
alias for the IP address to listen to.port - The listening port.target - The target Restlet.
public Server(Protocol protocol,
String address,
Restlet target)
protocol - The connector protocol.address - The listening IP address (useful if multiple IP addresses
available). You can also use a domain name as an alias for
the IP address to listen to.target - The target Restlet.| Method Detail |
|---|
public String getAddress()
public int getEphemeralPort()
InetSocketAddress.InetSocketAddress(int),
ServerSocket.getLocalPort()public int getPort()
public Restlet getTarget()
public void handle(Request request,
Response response)
RestletRestlet.init(Request, Response) method. In next version,
Restlet.init(Request, Response) will be removed and its logic directly
added to this method instead.
Subclasses overriding this method should make sure that they call super.handle(request, response) before adding their own logic.
handle in class Restletrequest - The request to handle.response - The response to update.public boolean hasTarget()
protected void setAddress(String address)
address - The optional listening IP address (local host used if
null).protected void setPort(int port)
getEphemeralPort() method.
port - The listening port if specified.public void setTarget(Restlet target)
target - The target Restlet.
public void start()
throws Exception
Restlet
start in class RestletException
public void stop()
throws Exception
Restlet
stop in class RestletException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||