Package org.apache.http.impl

Examples of org.apache.http.impl.DefaultBHttpServerConnection


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


        public void run() {
            try {
                while (!interrupted()) {
                    final Socket socket = servicedSocket.accept();
                    acceptedConnections.incrementAndGet();
                    final DefaultBHttpServerConnection conn = createHttpServerConnection();
                    conn.bind(socket);
                    conn.setSocketTimeout(timeout);
                    // Start worker thread
                    final 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
                        final DefaultBHttpServerConnection conn = (DefaultBHttpServerConnection)
                            context.getAttribute(ExecutionContext.HTTP_CONNECTION);
                        try {
                            conn.sendResponseHeader(response);
                        } catch (final HttpException ignore) {
                        }
                    }

                } ;
View Full Code Here

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

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

        this.reqistry.register(pattern, handler);
    }

    private HttpServerConnection acceptConnection() throws IOException {
        final Socket socket = this.serversocket.accept();
        final DefaultBHttpServerConnection conn = new DefaultBHttpServerConnection(8 * 1024);
        conn.bind(socket);
        return conn;
    }
View Full Code Here

        this.socket = socket;
        this.content = content;
    }
   
    public void run() {
        DefaultBHttpServerConnection conn = new DefaultBHttpServerConnection(8 * 1024);
        try {
            conn.bind(socket);
            try {
                boolean keepAlive = true;
                while( keepAlive && !socket.isClosed() ) {
                    // fully read the request, whatever it is
                    HttpRequest request = conn.receiveRequestHeader();
                    logger.log(FINE, "Received request: {0}", request);
                    keepAlive = isKeepAlive(request);
                   
                    if (request instanceof HttpEntityEnclosingRequest) {
                        conn.receiveRequestEntity((HttpEntityEnclosingRequest) request);
                        HttpEntity entity = ((HttpEntityEnclosingRequest) request)
                                .getEntity();
                        if (entity != null) {
                            // consume all content to allow reuse
                            EntityUtils.consume(entity);
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();
                    DefaultBHttpServerConnection conn = new DefaultBHttpServerConnection(8 * 1024);
                    System.out.println("Incoming connection from " + socket.getInetAddress());
                    conn.bind(socket);

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

            while (!Thread.interrupted()) {
                try {
                    final int bufsize = 8 * 1024;
                    // Set up incoming HTTP connection
                    final Socket insocket = this.serversocket.accept();
                    final DefaultBHttpServerConnection inconn = new DefaultBHttpServerConnection(bufsize);
                    System.out.println("Incoming connection from " + insocket.getInetAddress());
                    inconn.bind(insocket);

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

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

TOP

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

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.