org.apache.http.protocol.ResponseConnControl.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(14.9k)|赞(0)|评价(0)|浏览(63)

本文整理了Java中org.apache.http.protocol.ResponseConnControl.<init>方法的一些代码示例,展示了ResponseConnControl.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResponseConnControl.<init>方法的具体详情如下:
包路径:org.apache.http.protocol.ResponseConnControl
类名称:ResponseConnControl
方法名:<init>

ResponseConnControl.<init>介绍

暂无

代码示例

代码示例来源:origin: marytts/marytts

httpproc.addInterceptor(new ResponseServer());
httpproc.addInterceptor(new ResponseContent());
httpproc.addInterceptor(new ResponseConnControl());

代码示例来源:origin: marytts/marytts

httpproc.addInterceptor(new ResponseServer());
httpproc.addInterceptor(new ResponseContent());
httpproc.addInterceptor(new ResponseConnControl());

代码示例来源:origin: apache/cloudstack

public ListenerThread(HttpRequestHandler requestHandler, int port) {
  _executor = Executors.newCachedThreadPool(new NamedThreadFactory("Cluster-Listener"));
  try {
    _serverSocket = new ServerSocket(port);
  } catch (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
  BasicHttpProcessor httpproc = new BasicHttpProcessor();
  httpproc.addInterceptor(new ResponseDate());
  httpproc.addInterceptor(new ResponseServer());
  httpproc.addInterceptor(new ResponseContent());
  httpproc.addInterceptor(new ResponseConnControl());
  // Set up request handlers
  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);
}

代码示例来源:origin: apache/cloudstack

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);
}

代码示例来源:origin: kingthy/TVRemoteIME

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);
}

代码示例来源:origin: stackoverflow.com

HttpProcessor httpProcessor = HttpProcessorBuilder.create()
     //.addFirst(new RequestTrace())
     .add(new ResponseDate())
     //.add(new ResponseServer("MyServer-HTTP/1.1"))
     .add(new ResponseContent())
     .add(new ResponseConnControl())
     .addLast(new ResposeKeepAliveHeaderMod())
     .build();

代码示例来源:origin: wso2/wso2-synapse

public SourceConfiguration(ConfigurationContext configurationContext,
              TransportInDescription description,
              Scheme scheme,
              WorkerPool pool,
              PassThroughTransportMetricsCollector metrics) {
  super(configurationContext, description, pool, metrics);
  this.inDescription = description;
  this.scheme = scheme;
  httpProcessor = new ImmutableHttpProcessor(
      new HttpResponseInterceptor[]{
          new ResponseDate(),
          new ResponseServer(),
          new ResponseContent(),
          new ResponseConnControl()});
  responseFactory = new DefaultHttpResponseFactory();
  sourceConnections = new SourceConnections();
}

代码示例来源:origin: org.bluestemsoftware.open.eoa.ext/ext-client-test

public HTTPCallbackServer(int port, int readTimeout) throws IOException {
  ServerSocket serverSocket = new ServerSocket(port);
  serverSocket.setReuseAddress(true);
  listener = new Listener(serverSocket);
  listener.setDaemon(false);
  params = new BasicHttpParams();
  params.setIntParameter(HttpConnectionParams.SO_TIMEOUT, readTimeout);
  params.setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024);
  params.setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK, false);
  params.setBooleanParameter(HttpConnectionParams.TCP_NODELAY, true);
  crs = new DefaultConnectionReuseStrategy();
  rf = new DefaultHttpResponseFactory();
  httpProcessor = new BasicHttpProcessor();
  ((BasicHttpProcessor)httpProcessor).addInterceptor(new ResponseConnControl());
  ((BasicHttpProcessor)httpProcessor).addInterceptor(new ResponseServer());
  ((BasicHttpProcessor)httpProcessor).addInterceptor(new ResponseDate());
  ((BasicHttpProcessor)httpProcessor).addInterceptor(new ResponseContent());
  callbacks = new HashMap<String, HTTPCallback>();
  callbacks = Collections.synchronizedMap(callbacks);
}

代码示例来源:origin: wso2/wso2-synapse

/**
 * Return the HttpProcessor for responses
 * @return the HttpProcessor that processes HttpResponses of this server
 */
private HttpProcessor getHttpProcessor() {
  BasicHttpProcessor httpProcessor = new BasicHttpProcessor();
  httpProcessor.addInterceptor(new ResponseDate());
  httpProcessor.addInterceptor(new ResponseServer());
  httpProcessor.addInterceptor(new ResponseContent());
  httpProcessor.addInterceptor(new ResponseConnControl());
  return httpProcessor;
}

代码示例来源:origin: org.apache.camel/camel-jhc

protected static HttpProcessor createDefaultProcessor() {
  BasicHttpProcessor httpproc = new BasicHttpProcessor();
  httpproc.addInterceptor(new ResponseDate());
  httpproc.addInterceptor(new ResponseServer());
  httpproc.addInterceptor(new ResponseContent());
  httpproc.addInterceptor(new ResponseConnControl());
  return httpproc;
}

代码示例来源:origin: sentilo/sentilo

private void registerURLS() {
 final HttpProcessor httpproc = new ImmutableHttpProcessor(new HttpRequestInterceptor[] {new RequestExpectContinue()},
   new HttpResponseInterceptor[] {new ResponseDate(), new ResponseServer(), new ResponseContent(), new ResponseConnControl()});
 final HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
 reqistry.register(getRegisteredURLs(), new SentiloRequestHandler(handlerLocator, authenticationService));
 httpService = new HttpService(httpproc, new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory(), reqistry, params);
}

代码示例来源:origin: espertechinc/esper

public void start(EPRuntimeSPI runtime) throws IOException {
  this.serversocket = new ServerSocket(this.getServiceConfig().getPort());
  this.parameters = new BasicHttpParams();
  this.parameters
    .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 httpproc = new BasicHttpProcessor();
  httpproc.addInterceptor(new ResponseDate());
  httpproc.addInterceptor(new ResponseServer());
  httpproc.addInterceptor(new ResponseContent());
  httpproc.addInterceptor(new ResponseConnControl());
  // Set up request handlers
  HttpRequestHandlerRegistry reqistry = setupRegistry(runtime);
  // Set up the HTTP service
  this.httpService = new HttpService(
    httpproc,
    new DefaultConnectionReuseStrategy(),
    new DefaultHttpResponseFactory());
  this.httpService.setParams(this.parameters);
  this.httpService.setHandlerResolver(reqistry);
  runnable = new EsperHttpServiceClassicRunnable(this.getServiceName(), serversocket, parameters, httpService);
  socketThread = new Thread(runnable);
  socketThread.setDaemon(true);
  socketThread.start();
}

代码示例来源:origin: MissionCriticalCloud/cosmic

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);
}

代码示例来源:origin: espertechinc/esper

httpproc.addInterceptor(new ResponseServer());
httpproc.addInterceptor(new ResponseContent());
httpproc.addInterceptor(new ResponseConnControl());

代码示例来源:origin: TeamFatCat/Easy_Transfer

private void initHttpServer() {
  try {
    serversocket = new ServerSocket(port);
    serversocket.setReuseAddress(true);
    //设置 http 参数
    params = new BasicHttpParams();
    params.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, 8 * 1024)
        .setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5 * 1000)
        .setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK,
            false)
        .setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true)
        .setParameter(CoreProtocolPNames.ORIGIN_SERVER, "HttpComponents/1.1");
    BasicHttpProcessor httpProcessor = new BasicHttpProcessor();//http协议处理器
    httpProcessor.addInterceptor(new ResponseDate());//http协议拦截器,响应日期
    httpProcessor.addInterceptor(new ResponseServer());//响应服务器
    httpProcessor.addInterceptor(new ResponseContent());//响应内容
    httpProcessor.addInterceptor(new ResponseConnControl());//响应连接控制
    //http请求处理程序解析器
    HttpRequestHandlerRegistry registry = new HttpRequestHandlerRegistry();
    //http请求处理程序,HttpFileHandler继承于HttpRequestHandler(http请求处理程序)
    registry.register(Constant.Http.BROWSE, new FileBrowseHandler(webRoot,context));
    httpService = new HttpService(httpProcessor,
        new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory());
    httpService.setParams(params);
    httpService.setHandlerResolver(registry);//为http服务设置注册好的请求处理器。
  } catch (IOException e) {
    e.printStackTrace();
    this.interrupt();
  }
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public RequestListenerThread(final int port) throws IOException {
  logger.info("Starting proxy listener thread on " + port);
  this.serversocket = new ServerSocket(port);
  // Set up HTTP protocol processor for incoming connections
  final HttpProcessor inhttpproc = new ImmutableHttpProcessor(
      new ResponseDate(),
      new ResponseServer("Test/1.1"),
      new ResponseContent(),
      new ResponseConnControl());
  // Set up HTTP protocol processor for outgoing connections
  final HttpProcessor outhttpproc = new ImmutableHttpProcessor(
      new RequestContent(),
      new RequestTargetHost(),
      new RequestConnControl(),
      new RequestUserAgent("Test/1.1"),
      new RequestExpectContinue(true));
  // Set up outgoing request executor
  final HttpRequestExecutor httpexecutor = new HttpRequestExecutor();
  // Set up incoming request handler
  final UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();
  reqistry.register("*", new ProxyHandler(
      outhttpproc,
      httpexecutor));
  // Set up the HTTP service (the listener)
  this.httpService = new HttpService(inhttpproc, reqistry);
}

代码示例来源:origin: apache/axis2-java

public HttpProcessor newHttpProcessor() {
  BasicHttpProcessor httpProcessor = new BasicHttpProcessor();
  httpProcessor.addInterceptor(new RequestSessionCookie());
  httpProcessor.addInterceptor(new ResponseDate());
  httpProcessor.addInterceptor(new ResponseServer());
  httpProcessor.addInterceptor(new ResponseContent());
  httpProcessor.addInterceptor(new ResponseConnControl());
  httpProcessor.addInterceptor(new ResponseSessionCookie());
  return httpProcessor;
}

代码示例来源:origin: org.apache.axis2/axis2-transport-http

public HttpProcessor newHttpProcessor() {
  BasicHttpProcessor httpProcessor = new BasicHttpProcessor();
  httpProcessor.addInterceptor(new RequestSessionCookie());
  httpProcessor.addInterceptor(new ResponseDate());
  httpProcessor.addInterceptor(new ResponseServer());
  httpProcessor.addInterceptor(new ResponseContent());
  httpProcessor.addInterceptor(new ResponseConnControl());
  httpProcessor.addInterceptor(new ResponseSessionCookie());
  return httpProcessor;
}

代码示例来源:origin: org.codehaus.hydra-cache/http-server

public NHttpServiceHandler create() throws Exception {
  BasicHttpProcessor httpproc = new BasicHttpProcessor();
  httpproc.addInterceptor(new ResponseDate());
  httpproc.addInterceptor(new ResponseServer());
  httpproc.addInterceptor(new ResponseContent());
  httpproc.addInterceptor(new ResponseConnControl());
  BufferingHttpServiceHandler handler = new BufferingHttpServiceHandler(
      httpproc, new DefaultHttpResponseFactory(),
      new DefaultConnectionReuseStrategy(), httpParams);
  HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
  reqistry.register("*", requestHandler);
  handler.setHandlerResolver(reqistry);
  handler.setEventListener(protocolEventListener);
  return handler;
}

代码示例来源:origin: com.bbossgroups.rpc/bboss-rpc

protected NHttpServiceHandler createHttpServiceHandler(
     HttpRequestHandler requestHandler,
     HttpExpectationVerifier expectationVerifier,
     EventListener eventListener) {
  BasicHttpProcessor httpproc = new BasicHttpProcessor();
  httpproc.addInterceptor(new ResponseDate());
  httpproc.addInterceptor(new ResponseServer());
  httpproc.addInterceptor(new ResponseContent());
  httpproc.addInterceptor(new ResponseConnControl());
  BufferingHttpServiceHandler serviceHandler = new BufferingHttpServiceHandler(
      httpproc, new DefaultHttpResponseFactory(),
      new DefaultConnectionReuseStrategy(), this.serverParams);
  serviceHandler.setHandlerResolver(new SimpleHttpRequestHandlerResolver(
      requestHandler));
  serviceHandler.setExpectationVerifier(expectationVerifier);
  serviceHandler.setEventListener(eventListener);
  return serviceHandler;
}

相关文章

微信公众号

最新文章

更多

ResponseConnControl类方法