org.restlet.util

## Class ServerList

- java.lang.Object
- - org.restlet.util.WrapperList<Server>
  - - org.restlet.util.ServerList

All Implemented Interfaces:
  java.lang.Iterable<Server>, java.util.Collection<Server>, java.util.List<Server>

    public final class ServerList
    extends WrapperList<Server>

Modifiable list of server connectors.

Author:
  Jerome Louvel

### Constructor Summary

Constructors
Constructor and Description
`ServerList(Context context, Restlet next)` Constructor.

### Method Summary

Methods
`Server` `add(Protocol protocol)` Adds a new server connector in the map supporting the given protocol.
`Server` `add(Protocol protocol, int port)` Adds a new server connector in the map supporting the given protocol on the specified port.
`Server` `add(Protocol protocol, java.lang.String address, int port)` Adds a new server connector in the map supporting the given protocol on the specified IP address and port.
`boolean` `add(Server server)` Adds a server at the end of the list.
`Context` `getContext()` Returns the context.
`Restlet` `getNext()` Returns the next Restlet.
`Restlet` `getTarget()` Deprecated. Use the `getNext()` method instead.
`void` `setContext(Context context)` Sets the context.
`void` `setNext(java.lang.Class<?> nextClass)` Sets the next Restlet as a Finder for a given resource class.
`void` `setNext(Restlet next)` Sets the next Restlet.
`void` `setTarget(Restlet next)` Deprecated. Use the `setNext(Restlet)` method instead.

### Methods inherited from class org.restlet.util.WrapperList

`add, addAll, addAll, clear, contains, containsAll, equals, get, getDelegate, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### ServerList

    public ServerList(Context context,
              Restlet next)

Constructor.

Parameters:
  `context` - The context.
  `next` - The next Restlet of added servers.

### Method Detail

#### add

    public Server add(Protocol protocol)

Adds a new server connector in the map supporting the given protocol.

Parameters:
  `protocol` - The connector protocol.
Returns:
  The added server.

#### add

    public Server add(Protocol protocol,
             int port)

Adds a new server connector in the map supporting the given protocol on the specified port.

Parameters:
  `protocol` - The connector protocol.
  `port` - The listening port.
Returns:
  The added server.

#### add

    public Server add(Protocol protocol,
             java.lang.String address,
             int port)

Adds a new server connector in the map supporting the given protocol on the specified IP address and port.

Parameters:
  `protocol` - The connector protocol.
  `address` - The optional listening IP address (useful if multiple IP addresses available).
  `port` - The listening port.
Returns:
  The added server.

#### add

    public boolean add(Server server)

Adds a server at the end of the list.

Specified by:
  `add` in interface `java.util.Collection<Server>`
Specified by:
  `add` in interface `java.util.List<Server>`
Overrides:
  `add` in class `WrapperList<Server>`
Returns:
  True (as per the general contract of the Collection.add method).

#### getContext

    public Context getContext()

Returns the context.

Returns:
  The context.

#### getNext

    public Restlet getNext()

Returns the next Restlet.

Returns:
  The next Restlet.

#### getTarget

    @Deprecated
    public Restlet getTarget()

Deprecated. Use the `getNext()` method instead.
Returns the next Restlet.

Returns:
  The next Restlet.

#### setContext

    public void setContext(Context context)

Sets the context.

Parameters:
  `context` - The context.

#### setNext

    public void setNext(java.lang.Class<?> nextClass)

Sets the next Restlet as a Finder for a given resource class. When the call is delegated to the Finder instance, a new instance of the resource class will be created and will actually handle the request.

Parameters:
  `nextClass` - The next resource class to attach.

#### setNext

    public void setNext(Restlet next)

Sets the next Restlet.

Parameters:
  `next` - The next Restlet.

#### setTarget

    @Deprecated
    public void setTarget(Restlet next)

Deprecated. Use the `setNext(Restlet)` method instead.
Sets the next Restlet.

Parameters:
  `next` - The next Restlet.