当前位置: 首页>>代码示例>>Java>>正文


Java ResponseConnControl类代码示例

本文整理汇总了Java中org.apache.http.protocol.ResponseConnControl的典型用法代码示例。如果您正苦于以下问题:Java ResponseConnControl类的具体用法?Java ResponseConnControl怎么用?Java ResponseConnControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResponseConnControl类属于org.apache.http.protocol包,在下文中一共展示了ResponseConnControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: QSystemHtmlInstance

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
private QSystemHtmlInstance() {
    this.params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000).
        setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024).
        setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false).
        setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true).
        setParameter(CoreProtocolPNames.ORIGIN_SERVER, "QSystemReportHttpServer/1.1");

    // Set up the HTTP protocol processor
    final BasicHttpProcessor httpproc = new BasicHttpProcessor();
    httpproc.addInterceptor(new ResponseDate());
    httpproc.addInterceptor(new ResponseServer());
    httpproc.addInterceptor(new ResponseContent());
    httpproc.addInterceptor(new ResponseConnControl());

    // Set up request handlers
    final HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
    reqistry.register("*", new HttpQSystemReportsHandler());

    // Set up the HTTP service
    this.httpService = new HttpService(
        httpproc,
        new DefaultConnectionReuseStrategy(),
        new DefaultHttpResponseFactory(), reqistry, this.params);
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:25,代码来源:QSystemHtmlInstance.java

示例2: RequestListenerThread

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
public RequestListenerThread(Context context) throws IOException, BindException {
	serversocket = new ServerSocket(PORT);
	params = new BasicHttpParams();
	params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000).setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
			.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
			.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true).setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");

	// Set up the HTTP protocol processor
	BasicHttpProcessor httpProcessor = new BasicHttpProcessor();
	httpProcessor.addInterceptor(new ResponseDate());
	httpProcessor.addInterceptor(new ResponseServer());
	httpProcessor.addInterceptor(new ResponseContent());
	httpProcessor.addInterceptor(new ResponseConnControl());

	// Set up the HTTP service
	this.httpService = new YaaccHttpService(httpProcessor, new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory(), context);

}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:19,代码来源:YaaccUpnpServerService.java

示例3: RequestListenerThread

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
public RequestListenerThread(int port, final String docroot) throws IOException {
    this.serversocket = new ServerSocket(port);
    this.params = new SyncBasicHttpParams();
    this.params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000).setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024).setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false).setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true).setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");

    // Set up the HTTP protocol processor
    HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[]{
        new ResponseDate(),
        new ResponseServer(),
        new ResponseContent(),
        new ResponseConnControl()
    });

    // Set up request handlers
    HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
    reqistry.register("*", new HttpFileHandler());

    // Set up the HTTP service
    this.httpService = new HttpService(
            httpproc,
            new DefaultConnectionReuseStrategy(),
            new DefaultHttpResponseFactory(),
            reqistry,
            this.params);
}
 
开发者ID:Torridity,项目名称:dsworkbench,代码行数:26,代码来源:ReportServer.java

示例4: LocalTestServer

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
public LocalTestServer(HttpRequestHandler handler) {
    try {
        setUp();
        HttpProcessor httpproc = HttpProcessorBuilder.create()
            .add(new ResponseDate())
            .add(new ResponseServer(LocalServerTestBase.ORIGIN))
            .add(new ResponseContent())
            .add(new ResponseConnControl())
            .add(new RequestBasicAuth())
            .add(new ResponseBasicUnauthorized()).build();
        this.serverBootstrap.setHttpProcessor(httpproc);
        this.serverBootstrap.registerHandler("*", handler);
        host = start();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:yahoo,项目名称:gondola,代码行数:18,代码来源:LocalTestServer.java

示例5: HttpServerConnectionUpnpStream

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
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);
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:25,代码来源:HttpServerConnectionUpnpStream.java

示例6: ListenerThread

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
public ListenerThread(InetAddress address, int port, HttpParams params,
		HttpRequestHandlerRegistry handlerRegistry) throws IOException {
	this.params = params;
	this.serverSocket = new ServerSocket(port, 0, address);

	BasicHttpProcessor httpproc = new BasicHttpProcessor();
	httpproc.addInterceptor(new ResponseDate());
	httpproc.addInterceptor(new ResponseServer());
	httpproc.addInterceptor(new ResponseContent());
	httpproc.addInterceptor(new ResponseConnControl());

	this.httpService = new HttpService(httpproc,
			new DefaultConnectionReuseStrategy(),
			new DefaultHttpResponseFactory());
	this.httpService.setParams(params);
	this.httpService.setHandlerResolver(handlerRegistry);
}
 
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:18,代码来源:HttpServer.java

示例7: getHttpProcessor

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
private HttpProcessor getHttpProcessor() {
  if (null == _httpProcessor) {
    final HttpProcessorBuilder httpProcessorBuilder = HttpProcessorBuilder.create();

    httpProcessorBuilder.add(new ResponseDate());
    httpProcessorBuilder.add(new ResponseServer(getOriginServer()));
    httpProcessorBuilder.add(new ResponseContent());
    httpProcessorBuilder.add(new ResponseConnControl());
    httpProcessorBuilder.add(getRequestInterceptorService());
    httpProcessorBuilder.add(getResponseInterceptorService());

    _httpProcessor = httpProcessorBuilder.build();
  }

  return _httpProcessor;
}
 
开发者ID:Sabadios,项目名称:Cherry,代码行数:17,代码来源:WebEngine.java

示例8: start

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
public void start() throws Exception {
	// Create HTTP protocol basic processing chain
	HttpProcessor httpProcessor = HttpProcessorBuilder.create()
			.add(new ResponseDate()).add(new ResponseContent())
			.add(new ResponseConnControl()).build();
	// Create server
	HttpAsyncService protocolHandler = new HttpAsyncService(httpProcessor,
			uriMapper);
	NHttpConnectionFactory<DefaultNHttpServerConnection> connFactory = new DefaultNHttpServerConnectionFactory();
	IOEventDispatch ioEventDispatch = new DefaultHttpServerIODispatch(
			protocolHandler, connFactory);
	IOReactorConfig config = IOReactorConfig.custom()
			.setIoThreadCount(threads).setSoReuseAddress(true).build();
	ListeningIOReactor ioReactor = new DefaultListeningIOReactor(config);
	// Start server
	ioReactor.listen(new InetSocketAddress(port));
	ioReactor.execute(ioEventDispatch);
}
 
开发者ID:fxbonnet,项目名称:nio-benchmark,代码行数:19,代码来源:AsyncServer.java

示例9: main

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	int port = 8080;
	String docRoot = "D:\\svn_file\\TEST2\\150503\\web-customer";

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

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

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

	Thread t = new RequestListenerThread(port, httpService, null);
	t.setDaemon(false);
	t.start();
}
 
开发者ID:haogrgr,项目名称:haogrgr-test,代码行数:21,代码来源:HttpSrvMain.java

示例10: RequestListenerThread

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
/**
 * Default constructor which specifies the <code>port</code> to listen to
 * for requests and the <code>handlers</code>, which specify how to handle
 * the request.
 * 
 * @param port
 *            the port to listen to
 * @param handlers
 *            the handlers, which specify how to handle the different
 *            requests
 * 
 * @throws IOException
 *             if some IO operation fails
 */
public RequestListenerThread(final int port,
		final Map<String, IHandler> handlers) throws IOException {
	super(port);

	// Set up the HTTP protocol processor
	final HttpProcessor httpproc = new ImmutableHttpProcessor(
			new HttpResponseInterceptor[] { new ResponseDate(),
					new ResponseServer(), new ResponseContent(),
					new ResponseConnControl() });

	// Set up request handlers
	UriHttpRequestHandlerMapper registry = new UriHttpRequestHandlerMapper();
	for (final Entry<String, IHandler> entry : handlers.entrySet()) {
		registry.register(entry.getKey(), entry.getValue());
	}

	// Set up the HTTP service
	httpService = new HttpService(httpproc, registry);
	connFactory = DefaultBHttpServerConnectionFactory.INSTANCE;
}
 
开发者ID:pmeisen,项目名称:gen-server-http-listener,代码行数:35,代码来源:RequestListenerThread.java

示例11: test

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
@Test
public void test() throws ExecutionException, InterruptedException {


    HttpHost target = new HttpHost("localhost");
    BasicConnPool connpool = new BasicConnPool();
    connpool.setMaxTotal(200);
    connpool.setDefaultMaxPerRoute(10);
    connpool.setMaxPerRoute(target, 20);
    Future<BasicPoolEntry> future = connpool.lease(target, null);
    BasicPoolEntry poolEntry = future.get();
    HttpClientConnection conn = poolEntry.getConnection();

    HttpProcessor httpproc = HttpProcessorBuilder.create()
            .add(new ResponseDate())
            .add(new ResponseServer("MyServer-HTTP/1.1"))
            .add(new ResponseContent())
            .add(new ResponseConnControl())
            .build();

    HttpRequestHandler myRequestHandler = new HttpRequestHandler() {

        public void handle(
                HttpRequest request,
                HttpResponse response,
                HttpContext context) throws HttpException, IOException {
            response.setStatusCode(HttpStatus.SC_OK);
            response.setEntity(
                    new StringEntity("some important message",
                            ContentType.TEXT_PLAIN));
        }

    };

    UriHttpRequestHandlerMapper handlerMapper = new UriHttpRequestHandlerMapper();
    handlerMapper.register("/service/*", myRequestHandler);
    HttpService httpService = new HttpService(httpproc, handlerMapper);
}
 
开发者ID:daishicheng,项目名称:outcomes,代码行数:39,代码来源:TestHttpCore.java

示例12: RequestListenerThread

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
public RequestListenerThread(int port, final String docroot) throws IOException {
    this.serversocket = new ServerSocket(port);
    this.params = new SyncBasicHttpParams();
    this.params
        .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
        .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
        .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
        .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
        .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");

    // Set up the HTTP protocol processor
    HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpResponseInterceptor[] {
            new ResponseDate(),
            new ResponseServer(),
            new ResponseContent(),
            new ResponseConnControl()
    });
    
    // Set up request handlers
    HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
    reqistry.register("*", new HttpFileHandler(docroot));
    
    // Set up the HTTP service
    this.httpService = new HttpService(
            httpproc, 
            new DefaultConnectionReuseStrategy(), 
            new DefaultHttpResponseFactory(),
            reqistry,
            this.params);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:31,代码来源:ElementalHttpServer.java

示例13: ListenerThread

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
public ListenerThread(final ApiServer requestHandler, final int port) {
    try {
        _serverSocket = new ServerSocket(port);
    } catch (final IOException ioex) {
        s_logger.error("error initializing api server", ioex);
        return;
    }

    _params = new BasicHttpParams();
    _params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 30000)
           .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
           .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
           .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
           .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");

    // Set up the HTTP protocol processor
    final BasicHttpProcessor httpproc = new BasicHttpProcessor();
    httpproc.addInterceptor(new ResponseDate());
    httpproc.addInterceptor(new ResponseServer());
    httpproc.addInterceptor(new ResponseContent());
    httpproc.addInterceptor(new ResponseConnControl());

    // Set up request handlers
    final HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
    reqistry.register("*", requestHandler);

    // Set up the HTTP service
    _httpService = new HttpService(httpproc, new NoConnectionReuseStrategy(), new DefaultHttpResponseFactory());
    _httpService.setParams(_params);
    _httpService.setHandlerResolver(reqistry);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:32,代码来源:ApiServer.java

示例14: ListenerThread

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
public ListenerThread(final HttpRequestHandler requestHandler, final int port) {
    _executor = Executors.newCachedThreadPool(new NamedThreadFactory("Cluster-Listener"));

    try {
        _serverSocket = new ServerSocket(port);
    } catch (final IOException ioex) {
        s_logger.error("error initializing cluster service servlet container", ioex);
        return;
    }

    _params = new BasicHttpParams();
    _params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
           .setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
           .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
           .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
           .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");

    // Set up the HTTP protocol processor
    final BasicHttpProcessor httpproc = new BasicHttpProcessor();
    httpproc.addInterceptor(new ResponseDate());
    httpproc.addInterceptor(new ResponseServer());
    httpproc.addInterceptor(new ResponseContent());
    httpproc.addInterceptor(new ResponseConnControl());

    // Set up request handlers
    final HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
    reqistry.register("/clusterservice", requestHandler);

    // Set up the HTTP service
    _httpService = new HttpService(httpproc, new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory());
    _httpService.setParams(_params);
    _httpService.setHandlerResolver(reqistry);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:34,代码来源:ClusterServiceServletContainer.java

示例15: RequestListenerThread

import org.apache.http.protocol.ResponseConnControl; //导入依赖的package包/类
public RequestListenerThread(final int port, final HttpHost target) throws IOException {
    this.target = target;
    this.serversocket = new ServerSocket(port);

    // Set up HTTP protocol processor for incoming connections
    final HttpProcessor inhttpproc = new ImmutableHttpProcessor(
            new HttpRequestInterceptor[] {
                    new RequestContent(),
                    new RequestTargetHost(),
                    new RequestConnControl(),
                    new RequestUserAgent("Test/1.1"),
                    new RequestExpectContinue(true)
     });

    // Set up HTTP protocol processor for outgoing connections
    final HttpProcessor outhttpproc = new ImmutableHttpProcessor(
            new HttpResponseInterceptor[] {
                    new ResponseDate(),
                    new ResponseServer("Test/1.1"),
                    new ResponseContent(),
                    new ResponseConnControl()
    });

    // Set up outgoing request executor
    final HttpRequestExecutor httpexecutor = new HttpRequestExecutor();

    // Set up incoming request handler
    final UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();
    reqistry.register("*", new ProxyHandler(
            this.target,
            outhttpproc,
            httpexecutor));

    // Set up the HTTP service
    this.httpService = new HttpService(inhttpproc, reqistry);
}
 
开发者ID:netmackan,项目名称:java-binrepo-proxy,代码行数:37,代码来源:ElementalReverseProxy.java


注:本文中的org.apache.http.protocol.ResponseConnControl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。