/** * Adds a new server connector in the map supporting the given protocol on * the specified port. * * @param protocol * The connector protocol. * @param port * The listening port. * @return The added server. */ public Server add(Protocol protocol, int port) { Server result = new Server(protocol, null, port, getTarget()); result.setContext(getContext().createChildContext()); add(result); return result; }
/** * Adds a new server connector in the map supporting the given protocol. * * @param protocol * The connector protocol. * @return The added server. */ public Server add(Protocol protocol) { Server result = new Server(protocol, null, protocol.getDefaultPort(), getTarget()); result.setContext(getContext().createChildContext()); add(result); return result; }
/** * Adds a new server connector in the map supporting the given protocol on * the specified IP address and port. * * @param protocol * The connector protocol. * @param address * The optional listening IP address (useful if multiple IP * addresses available). * @param port * The listening port. * @return The added server. */ public Server add(Protocol protocol, String address, int port) { Server result = new Server(protocol, address, port, getTarget()); result.setContext(getContext().createChildContext()); add(result); return result; }
/** * Adds a server at the end of the list. * * @return True (as per the general contract of the Collection.add method). */ @Override public boolean add(Server server) { // Set the server's context, if the server does not have already one. if (server.getContext() == null) { server.setContext(getContext().createChildContext()); } server.setTarget(getTarget()); return super.add(server); }