/** * This {@link HttpServer} will accept connections on the {@code endpoint} and will handle each with the * <var>httpClientConnectionHandler</var>. * * @param endpoint The {@link InetAddress} and local port the server will bind to; {@link * InetSocketAddress#InetSocketAddress(int)} will accept connections on any/all local addresses; * port number zero will pick an ephemeral port */ public HttpServer( InetSocketAddress endpoint, final HttpClientConnectionHandler httpClientConnectionHandler ) throws IOException { this.tcpServer = new TcpServer(endpoint, 0, httpClientConnectionHandler); }
/** * This {@link HttpServer} will accept connections on the <var>endpoint</var> and will handle each with the * <var>httpClientConnectionHandler</var>. * * @param endpoint The {@link InetAddress} and local port the server will bind to; {@link * InetSocketAddress#InetSocketAddress(int)} will accept connections on any/all local addresses; * port number zero will pick an ephemeral port */ public HttpServer( InetSocketAddress endpoint, final HttpClientConnectionHandler httpClientConnectionHandler ) throws IOException { this.tcpServer = new TcpServer(endpoint, 0, httpClientConnectionHandler); }
/** * This {@link HttpServer} will accept secure (HTTPS) connections on the {@code endpoint} and will handle each * with the <var>httpClientConnectionHandler</var>. * * @param endpoint The {@link InetAddress} and local port the server will bind to; {@link * InetSocketAddress#InetSocketAddress(int)} will accept connections on any/all local addresses; * port number zero will pick an ephemeral port */ public HttpServer( InetSocketAddress endpoint, SSLContext sslContext, final HttpClientConnectionHandler httpClientConnectionHandler ) throws IOException { this.tcpServer = new TcpServer(endpoint, 0, sslContext, httpClientConnectionHandler); }
/** * This {@link HttpServer} will accept secure (HTTPS) connections on the <var>endpoint</var> and will handle each * with the <var>httpClientConnectionHandler</var>. * * @param endpoint The {@link InetAddress} and local port the server will bind to; {@link * InetSocketAddress#InetSocketAddress(int)} will accept connections on any/all local addresses; * port number zero will pick an ephemeral port */ public HttpServer( InetSocketAddress endpoint, SSLContext sslContext, final HttpClientConnectionHandler httpClientConnectionHandler ) throws IOException { this.tcpServer = new TcpServer(endpoint, 0, sslContext, httpClientConnectionHandler); }
/** * This {@link FtpServer} will accept connections and run a new {@link FtpSession} with the given * <var>Ftplett</var>. * * @param endpoint The {@link InetAddress} and local port the server will bind to; {@link * InetSocketAddress#InetSocketAddress(int)} will accept connections on any/all local addresses; * port number zero will pick an ephemeral port */ public FtpServer(InetSocketAddress endpoint, int backlog, final Ftplett ftplett) throws IOException { this.tcpServer = new TcpServer(endpoint, backlog, new TcpServer.ConnectionHandler() { @Override public void handleConnection( final InputStream in, final OutputStream out, InetSocketAddress localSocketAddress, final InetSocketAddress remoteSocketAddress, final Stoppable stoppable ) throws IOException { new FtpSession(in, out, localSocketAddress, remoteSocketAddress.getAddress(), ftplett).run(); } }); }
/** * This {@link FtpServer} will accept connections and run a new {@link FtpSession} with the given * <var>Ftplett</var>. * * @param endpoint The {@link InetAddress} and local port the server will bind to; {@link * InetSocketAddress#InetSocketAddress(int)} will accept connections on any/all local addresses; * port number zero will pick an ephemeral port */ public FtpServer(InetSocketAddress endpoint, int backlog, final Ftplett ftplett) throws IOException { this.tcpServer = new TcpServer(endpoint, backlog, new TcpServer.ConnectionHandler() { @Override public void handleConnection( final InputStream in, final OutputStream out, InetSocketAddress localSocketAddress, final InetSocketAddress remoteSocketAddress, final Stoppable stoppable ) throws IOException { new FtpSession(in, out, localSocketAddress, remoteSocketAddress.getAddress(), ftplett).run(); } }); }
final TransformerWhichThrows<? super HttpResponse, HttpResponse, IOException> responseTransformer ) throws IOException { this.tcpServer = new TcpServer(endpoint, 0, new HttpClientConnectionHandler() {
final TransformerWhichThrows<? super HttpResponse, HttpResponse, IOException> responseTransformer ) throws IOException { this.tcpServer = new TcpServer(endpoint, 0, new HttpClientConnectionHandler(">>> ", "<<< ") {
final ProxyConnectionHandler proxyConnectionHandler ) throws IOException { this.server = new TcpServer(endpoint, backlog, new TcpServer.ConnectionHandler() {
final ProxyConnectionHandler proxyConnectionHandler ) throws IOException { this.server = new TcpServer(endpoint, backlog, new TcpServer.ConnectionHandler() {
/** * Accepts secure (HTTPS) connections on the <var>endpoint</var>; responds each received request with the contents * of the file designated by the <var>documentRootDirectoryNamePattern</var>/<var>path</var>, where the placeholder * "<code>{path}</code>" is substituted with the "path" component of the requested URI. */ public Httpd(InetSocketAddress endpoint, SSLContext sslContext, final String documentRootDirectoryNamePattern) throws IOException { this.tcpServer = new TcpServer( endpoint, 0, sslContext, new HttpClientConnectionHandler(new FileServlett() { @Override protected File getFile(HttpRequest httpRequest) { return new File(documentRootDirectoryNamePattern.replace("{path}", httpRequest.getUri().getPath())); } }) ); }
/** * Accepts connections on the <var>endpoint</var>; responds each received request with the contents of the file * designated by the <var>documentRootDirectoryNamePattern</var>/<var>path</var>, where the placeholder * "<code>{path}</code>" is substituted with the "path" component of the requested URI. */ public Httpd(InetSocketAddress endpoint, final String documentRootDirectoryNamePattern) throws IOException { this.tcpServer = new TcpServer( endpoint, 0, new HttpClientConnectionHandler(new FileServlett() { @Override protected File getFile(HttpRequest httpRequest) { return new File(documentRootDirectoryNamePattern.replace("{path}", httpRequest.getUri().getPath())); } }) ); }
/** * Accepts connections on the <var>endpoint</var>; responds each received request with the contents of the file * designated by the <var>documentRootDirectoryNamePattern</var>/<var>path</var>, where the placeholder * "<code>{path}</code>" is substituted with the "path" component of the requested URI. */ public Httpd(InetSocketAddress endpoint, final String documentRootDirectoryNamePattern) throws IOException { this.tcpServer = new TcpServer( endpoint, 0, new HttpClientConnectionHandler(new FileServlett() { @Override protected File getFile(HttpRequest httpRequest) { return new File(documentRootDirectoryNamePattern.replace("{path}", httpRequest.getUri().getPath())); } }) ); }
/** * Accepts secure (HTTPS) connections on the <var>endpoint</var>; responds each received request with the contents * of the file designated by the <var>documentRootDirectoryNamePattern</var>/<var>path</var>, where the placeholder * "<code>{path}</code>" is substituted with the "path" component of the requested URI. */ public Httpd(InetSocketAddress endpoint, SSLContext sslContext, final String documentRootDirectoryNamePattern) throws IOException { this.tcpServer = new TcpServer( endpoint, 0, sslContext, new HttpClientConnectionHandler(new FileServlett() { @Override protected File getFile(HttpRequest httpRequest) { return new File(documentRootDirectoryNamePattern.replace("{path}", httpRequest.getUri().getPath())); } }) ); }
new TcpServer(new InetSocketAddress(port), 0, new TcpServer.ConnectionHandler() {
new TcpServer(new InetSocketAddress(port), 0, new TcpServer.ConnectionHandler() {