Package org.apache.http.impl

Examples of org.apache.http.impl.DefaultHttpServerConnection


            System.out.println("Listening on port " + this.serversocket.getLocalPort());
            while (!Thread.interrupted()) {
                try {
                    // Set up incoming HTTP connection
                    Socket insocket = this.serversocket.accept();
                    DefaultHttpServerConnection inconn = new DefaultHttpServerConnection();
                    System.out.println("Incoming connection from " + insocket.getInetAddress());
                    inconn.bind(insocket, this.params);

                    // Set up outgoing HTTP connection
                    Socket outsocket = new Socket(this.target.getHostName(), this.target.getPort());
                    DefaultHttpClientConnection outconn = new DefaultHttpClientConnection();
                    outconn.bind(outsocket, this.params);
View Full Code Here


            while (_serverSocket != null) {
                try {
                    // Set up HTTP connection
                    Socket socket = _serverSocket.accept();
                    final DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
                    conn.bind(socket, _params);

                    _executor.execute(new ManagedContextRunnable() {
                        @Override
                        protected void runInContext() {
                            HttpContext context = new BasicHttpContext(null);
                            try {
                                while (!Thread.interrupted() && conn.isOpen()) {
                                    if (s_logger.isTraceEnabled())
                                        s_logger.trace("dispatching cluster request from " + conn.getRemoteAddress().toString());

                                    _httpService.handleRequest(conn, context);

                                    if (s_logger.isTraceEnabled())
                                        s_logger.trace("Cluster request from " + conn.getRemoteAddress().toString() + " is processed");
                                }
                            } catch (ConnectionClosedException ex) {
                                // client close and read time out exceptions are expected
                                // when KEEP-AVLIE is enabled
                                s_logger.trace("Client closed connection", ex);
                            } catch (IOException ex) {
                                s_logger.trace("I/O error", ex);
                            } catch (HttpException ex) {
                                s_logger.error("Unrecoverable HTTP protocol violation", ex);
                            } finally {
                                try {
                                    conn.shutdown();
                                } catch (IOException ignore) {
                                    s_logger.error("unexpected exception", ignore);
                                }
                            }
                        }
View Full Code Here

            s_logger.info("ApiServer listening on port " + _serverSocket.getLocalPort());
            while (!Thread.interrupted()) {
                try {
                    // Set up HTTP connection
                    Socket socket = _serverSocket.accept();
                    DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
                    conn.bind(socket, _params);

                    // Execute a new worker task to handle the request
                    _executor.execute(new WorkerTask(_httpService, conn, _workerCount++));
                } catch (InterruptedIOException ex) {
                    break;
View Full Code Here

            s_logger.info("ApiServer listening on port " + _serverSocket.getLocalPort());
            while (!Thread.interrupted()) {
                try {
                    // Set up HTTP connection
                    final Socket socket = _serverSocket.accept();
                    final DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
                    conn.bind(socket, _params);

                    // Execute a new worker task to handle the request
                    s_executor.execute(new WorkerTask(_httpService, conn, s_workerCount++));
                } catch (final InterruptedIOException ex) {
                    break;
View Full Code Here

     * a different implementation of the {@link DefaultHttpServerConnection}.
     *
     * @return DefaultHttpServerConnection.
     */
    protected DefaultHttpServerConnection createHttpServerConnection() {
      return new DefaultHttpServerConnection();
    }
View Full Code Here

        public void run() {
            try {
                while (!interrupted()) {
                    Socket socket = servicedSocket.accept();
                    acceptedConnections.incrementAndGet();
                    DefaultHttpServerConnection conn = createHttpServerConnection();
                    conn.bind(socket, httpservice.getParams());
                    // Start worker thread
                    Worker worker = new Worker(conn);
                    workers.add(worker);
                    worker.setDaemon(true);
                    worker.start();
View Full Code Here

                        outstream.write(tmp);
                        outstream.flush();

                        // do something comletely ugly in order to trigger
                        // MalformedChunkCodingException
                        DefaultHttpServerConnection conn = (DefaultHttpServerConnection)
                            context.getAttribute(ExecutionContext.HTTP_CONNECTION);
                        try {
                            conn.sendResponseHeader(response);
                        } catch (HttpException ignore) {
                        }
                    }

                } ;
View Full Code Here

            System.out.println("Listening on port " + this.serversocket.getLocalPort());
            while (!Thread.interrupted()) {
                try {
                    // Set up HTTP connection
                    Socket socket = this.serversocket.accept();
                    DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
                    System.out.println("Incoming connection from " + socket.getInetAddress());
                    conn.bind(socket, this.params);

                    // Start worker thread
                    Thread t = new WorkerThread(this.httpService, conn);
                    t.setDaemon(true);
                    t.start();
View Full Code Here

        this.expectationVerifier = expectationVerifier;
    }

    private HttpServerConnection acceptConnection() throws IOException {
        Socket socket = this.serversocket.accept();
        DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
        conn.bind(socket, this.params);
        return conn;
    }
View Full Code Here

        this.params = params;
    }
   
    public HttpServerConnection newConnection(final Socket socket)
            throws IOException {
        DefaultHttpServerConnection conn = new DefaultHttpServerConnection();
        conn.bind(socket, this.params);
        return conn;
    }
View Full Code Here

TOP

Related Classes of org.apache.http.impl.DefaultHttpServerConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.