Java 类org.apache.http.HttpServerConnection 实例源码

项目:DroidDLNA    文件:HttpServerConnectionUpnpStream.java   
protected HttpServerConnectionUpnpStream(ProtocolFactory protocolFactory,
                                         HttpServerConnection connection,
                                         final HttpParams params) {
    super(protocolFactory);
    this.connection = connection;
    this.params = params;

    // The Date header is recommended in UDA, need to document the requirement in StreamServer interface?
    httpProcessor.addInterceptor(new ResponseDate());

    // The Server header is only required for Control so callers have to add it to UPnPMessage
    // httpProcessor.addInterceptor(new ResponseServer());

    httpProcessor.addInterceptor(new ResponseContent());
    httpProcessor.addInterceptor(new ResponseConnControl());

    httpService =
            new UpnpHttpService(
                    httpProcessor,
                    new DefaultConnectionReuseStrategy(),
                    new DefaultHttpResponseFactory()
            );
    httpService.setParams(params);
}
项目:Cherry    文件:MetricsService.java   
public void examine(final HttpServerConnection connection) {
  if (null != connection &&
      log.isDebugEnabled() &&
      !connection.isOpen()) {
    log.debug("Connection [{}] closed. Capturing metrics.", connection);

    final HttpConnectionMetrics metrics = connection.getMetrics();

    final WeakReference<StringBuilder> sb = new WeakReference<StringBuilder>(new StringBuilder("{'connection_metrics':{'requests':'"));

    sb.get().append(metrics.getRequestCount()).append("','responses':'").append(metrics.getResponseCount())
        .append("', 'received_bytes':'").append(metrics.getReceivedBytesCount()).append("', 'sent_bytes':'").append(metrics.getSentBytesCount()).append("'}}");

    log.debug("[{}]", sb.get().toString());
  }
}
项目:OpsDev    文件:ElementalHttpServer.java   
public void run() {
    System.out.println("Listening on port " + serversocket.getLocalPort());
    ConsoleFactory.printToConsole("Listening on port " + serversocket.getLocalPort(),true);
    while (isRun && !Thread.interrupted()) {
        try {
            // Set up HTTP connection
            Socket socket = serversocket.accept();
            System.out.println("Incoming connection from " + socket.getInetAddress());
            ConsoleFactory.printToConsole("Incoming connection from " + socket.getInetAddress(),true);
            HttpServerConnection conn = this.connFactory.createConnection(socket);

            // Start worker thread
            Thread t = new WorkerThread(this.httpService, conn);
            t.setDaemon(true);
            t.start();
        } catch (InterruptedIOException ex) {
            break;
        } catch (IOException e) {
            System.err.println("I/O error initialising connection thread: "
                    + e.getMessage());
            break;
        }
    }

}
项目:haogrgr-test    文件:HttpSrvMain.java   
@Override
public void run() {
    System.out.println("Listening on port " + this.serversocket.getLocalPort());
    while (!Thread.interrupted()) {
        try {
            // Set up HTTP connection
            Socket socket = this.serversocket.accept();
            System.out.println("Incoming connection from " + socket.getInetAddress());
            HttpServerConnection conn = this.connFactory.createConnection(socket);

            // Start worker thread
            Thread t = new WorkerThread(this.httpService, conn);
            t.setDaemon(true);
            t.start();
        }
        catch (InterruptedIOException ex) {
            break;
        }
        catch (IOException e) {
            System.err.println("I/O error initialising connection thread: "
                    + e.getMessage());
            break;
        }
    }
}
项目:PhET    文件:ElementalHttpServer.java   
public WorkerThread(
        final HttpService httpservice, 
        final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:PhET    文件:ElementalReverseProxy.java   
public ProxyThread(
        final HttpService httpservice, 
        final HttpServerConnection inconn,
        final HttpClientConnection outconn) {
    super();
    this.httpservice = httpservice;
    this.inconn = inconn;
    this.outconn = outconn;
}
项目:java-binrepo-proxy    文件:ElementalReverseProxy.java   
public ProxyThread(
        final HttpService httpservice,
        final HttpServerConnection inconn,
        final HttpClientConnection outconn) {
    super();
    this.httpservice = httpservice;
    this.inconn = inconn;
    this.outconn = outconn;
}
项目:Android_CCTV    文件:TinyHttpServer.java   
public WorkerThread(
        final org.apache.http.protocol.HttpService httpservice, 
        final HttpServerConnection conn,
        final Socket socket) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
    this.socket = socket;
}
项目:dsworkbench    文件:ReportServer.java   
public WorkerThread(
        final HttpService httpservice,
        final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:hssd    文件:WorkerThread.java   
public WorkerThread(
        final HttpService httpservice,
        final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:OpsDev    文件:ElementalHttpServer.java   
public WorkerThread(
        final HttpService httpservice,
        final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:SparrowWorker    文件:ConnectionHandlerThread.java   
ConnectionHandlerThread(
        final HttpService httpservice,
        final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:SparrowWorker    文件:RequestListenerThread.java   
@Override
public void run() {
    System.out.println("Listening on port " + this.serversocket.getLocalPort());
    while (!Thread.interrupted()) {
        try {
            // Set up HTTP connection
            Socket socket = this.serversocket.accept();
            //System.out.println("Incoming connection from " + socket.getInetAddress());
            HttpServerConnection conn = this.connFactory.createConnection(socket);

            //Thread t = new TaskExecutorThread(this.httpService, conn);
            // Initialize the pool
            Thread connectionHandler = new ConnectionHandlerThread(this.httpService, conn);             

            connectionHandler.setDaemon(false);
            //System.out.println("print #2");
            connectionHandlerExecutor.execute(connectionHandler);
            //connectionHandler.start();
            //System.out.println("\tConnection Handler Thread created");
            //t.start();
        } catch (InterruptedIOException ex) {
            break;
        } catch (IOException e) {
            System.err.println("I/O error initialising connection thread: "
                    + e.getMessage());
            break;
        }
    }
    // when the listener is interupted shutdown the pool
    // and wait for any Connection Handler threads still running
    connectionHandlerExecutor.shutdown();
    while (!connectionHandlerExecutor.isTerminated()) {
    }
    System.out.println("Finished all connection handler threads");
}
项目:SparrowScheduler    文件:ConnectionHandlerThread.java   
ConnectionHandlerThread(
        final HttpService httpservice,
        final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:cim    文件:WorkerThread.java   
public WorkerThread(HttpService httpservice, HttpServerConnection conn,
        OnWebServListener listener) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
    this.listener = listener;
}
项目:gen-server-http-listener    文件:RequestListenerThread.java   
@Override
protected Thread createWorkerThread(final Socket socket) throws IOException {

    // create the connection
    final HttpServerConnection conn = connFactory.createConnection(socket);

    return new WorkerThread(httpService, conn, socket);
}
项目:spydroid-ipcamera    文件:TinyHttpServer.java   
public WorkerThread(
        final org.apache.http.protocol.HttpService httpservice, 
        final HttpServerConnection conn,
        final Socket socket) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
    this.socket = socket;
}
项目:ecg_over_rtp    文件:TinyHttpServer.java   
public WorkerThread(
        final org.apache.http.protocol.HttpService httpservice, 
        final HttpServerConnection conn,
        final Socket socket) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
    this.socket = socket;
}
项目:dcl    文件:WorkerThread.java   
public WorkerThread(
        final HttpService httpservice,
        final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:Megapode    文件:HttpServer.java   
@Override
public void run() {
    System.out.println("Listening on port "
            + this.serversocket.getLocalPort());
    while (!Thread.interrupted()) {
        try {
            // Set up HTTP connection

            /**
             * TODO: Change this to use an executor service
             */
            Socket socket = this.serversocket.accept();
            System.out.println("Incoming connection from "
                    + socket.getInetAddress());
            HttpServerConnection conn = this.connFactory
                    .createConnection(socket);

            // Start worker thread
            Thread t = new WorkerThread(this.httpService, conn);
            t.setDaemon(true);
            // executor.submit(t);
            t.start();
        } catch (InterruptedIOException ex) {
            break;
        } catch (IOException e) {
            System.err
                    .println("I/O error initialising connection thread: "
                            + e.getMessage());
            break;
        }
    }
}
项目:AndroidWebServ    文件:WorkerThread.java   
public WorkerThread(HttpService httpservice, HttpServerConnection conn,
        OnWebServListener listener) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
    this.listener = listener;
}
项目:tunebot    文件:WebServer.java   
public WorkerThread(
        final HttpService httpservice,
        final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:yaacc-code    文件:YaaccUpnpServerService.java   
public WorkerThread(final HttpService httpservice, final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:cosmic    文件:ApiServer.java   
public WorkerTask(final HttpService httpService, final HttpServerConnection conn, final int count) {
    _httpService = httpService;
    _conn = conn;
}
项目:Camel    文件:HttpTestServer.java   
Worker(final HttpServerConnection conn) {
    this.conn = conn;
}
项目:esper    文件:WorkerThread.java   
public WorkerThread(HttpService httpservice, HttpServerConnection conn, EsperHttpServiceClassicRunnable runnable) {
    this.httpservice = httpservice;
    this.conn = conn;
    this.runnable = runnable;
}
项目:DroidDLNA    文件:HttpServerConnectionUpnpStream.java   
public HttpServerConnection getConnection() {
    return connection;
}
项目:dlna-for-android    文件:HttpServer.java   
public WorkerThread(final HttpService httpservice,
        final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:Cherry    文件:RequestWorker.java   
private HttpServerConnection getHttpServerConnection() {
  return _httpServerConnection;
}
项目:Cherry    文件:RequestWorker.java   
RequestWorker(final HttpService httpService, final HttpServerConnection connection) {
  super();

  _httpService = httpService;
  _httpServerConnection = connection;
}
项目:carbon-platform-integration    文件:SimpleHttpServer.java   
public ServerWorker(HttpServerConnection conn) {
    this.conn = conn;
}
项目:MiniWeb    文件:RemoteConnection.java   
public RemoteConnection(InetAddress remoteAddress, HttpServerConnection connection) {
    this.remoteAddress = remoteAddress;
    this.connection = connection;
}
项目:haogrgr-test    文件:HttpSrvMain.java   
public WorkerThread(final HttpService httpservice, final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:cloudstack    文件:ApiServer.java   
public WorkerTask(final HttpService httpService, final HttpServerConnection conn, final int count) {
    _httpService = httpService;
    _conn = conn;
}
项目:dcl    文件:SimpleHttpServer.java   
public SimpleHttpServer(int port, ConnectedAddressesProvider connectedAddressesProvider){
    this.connFactory = DefaultBHttpServerConnectionFactory.INSTANCE;

    // Set up the HTTP protocol processor
    HttpProcessor httpproc = HttpProcessorBuilder.create()
            .add(new ResponseDate())
            .add(new ResponseServer("Test/1.1"))
            .add(new ResponseContent())
            .add(new ResponseConnControl()).build();

    // Set up request handlers
    UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();
    reqistry.register("*", new HttpRequestHandlerNew(connectedAddressesProvider));

    // Set up the HTTP service
    httpService = new HttpService(httpproc, reqistry);

    try {
        serversocket = new ServerSocket(port, 1, InetAddress.getByName("127.0.0.1"));

    System.out.println("Listening on port " + serversocket.getLocalPort());
    while (!Thread.interrupted()) {
        try {
            // Set up HTTP connection
            Socket socket = serversocket.accept();
            System.out.println("Incoming connection from " + socket.getInetAddress());
            HttpServerConnection conn = connFactory.createConnection(socket);

            // Start worker thread
            Thread t = new WorkerThread(httpService, conn);
            t.setDaemon(true);
            t.start();
        } catch (InterruptedIOException ex) {
            break;
        } catch (IOException e) {
            System.err.println("I/O error initialising connection thread: "
                    + e.getMessage());
            break;
        }
    }
    } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
}
项目:Megapode    文件:HttpServer.java   
public WorkerThread(final HttpService httpservice,
        final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:CadalWorkspace    文件:Httpd.java   
public WorkerThread(final HttpService httpservice, final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:CadalWorkspace    文件:Httpd.java   
public WorkerThread(final HttpService httpservice, final HttpServerConnection conn) {
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:Calico    文件:AdminWorkerThread.java   
public AdminWorkerThread(final HttpService httpservice, final HttpServerConnection conn)
{
    super();
    this.httpservice = httpservice;
    this.conn = conn;
}
项目:Cherry    文件:WebEngineManager.java   
HttpServerConnection getHttpServerConnection() throws IOException {
  final Socket socket = getSocket();

  if (null == socket)
    throw new IllegalStateException(new IllegalArgumentException(new NullPointerException("Undefined 'java.net.Socket' returned by underlying framework!")));

  debug("Incoming connection from [{}]", socket.getInetAddress());

  return getHttpConnectionFactory().createConnection(socket);
}