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


Java HttpRequestHandlerRegistry类代码示例

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


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

示例1: QSystemHtmlInstance

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的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: HttpTestServer

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的package包/类
/**
 * Creates a new test server.
 *
 * @param proc      the HTTP processors to be used by the server, or
 *                  <code>null</code> to use a
 *                  {@link #newProcessor default} processor
 * @param reuseStrat the connection reuse strategy to be used by the
 *                  server, or <code>null</code> to use
 *                  {@link #newConnectionReuseStrategy() default}
 *                  strategy.
 * @param params    the parameters to be used by the server, or
 *                  <code>null</code> to use
 *                  {@link #newDefaultParams default} parameters
 * @param sslcontext optional SSL context if the server is to leverage
 *                   SSL/TLS transport security
 */
public HttpTestServer(
        final BasicHttpProcessor proc,
        final ConnectionReuseStrategy reuseStrat,
        final HttpResponseFactory responseFactory,
        final HttpExpectationVerifier expectationVerifier,
        final HttpParams params,
        final SSLContext sslcontext) {
    this.handlerRegistry = new HttpRequestHandlerRegistry();
    this.workers = Collections.synchronizedSet(new HashSet<Worker>());
    this.httpservice = new HttpService(
        proc != null ? proc : newProcessor(),
        reuseStrat != null ? reuseStrat : newConnectionReuseStrategy(),
        responseFactory != null ? responseFactory : newHttpResponseFactory(),
        handlerRegistry,
        expectationVerifier,
        params != null ? params : newDefaultParams());
    this.sslcontext = sslcontext;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:35,代码来源:HttpTestServer.java

示例3: RequestListenerThread

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的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: HttpServer

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的package包/类
private HttpServer(WifiManager wifiManager) {
	this.wifiManager = wifiManager;
	this.listenPort = 0;

	this.handlerRegistry = new HttpRequestHandlerRegistry();

	this.params = new BasicHttpParams();
	this.params
			.setParameter(CoreProtocolPNames.ORIGIN_SERVER,
					"4thLineAndroidHttpServer/1.0")
			.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 5000)
			.setIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE,
					8 * 1024)
			.setBooleanParameter(
					CoreConnectionPNames.STALE_CONNECTION_CHECK, false)
			.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, true);

	startServer();
}
 
开发者ID:jasoncn90,项目名称:dlna-for-android,代码行数:20,代码来源:HttpServer.java

示例5: ListenerThread

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的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

示例6: RequestListenerThread

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的package包/类
public RequestListenerThread(int port, final String docroot) throws IOException {
    this.serversocket = new ServerSocket(port);
    this.params = new BasicHttpParams();
    this.params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 1000).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 BasicHttpProcessor();

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

    // Set up the HTTP service
    this.httpService = new HttpService(httpproc, new NoConnectionReuseStrategy(), new DefaultHttpResponseFactory());
    this.httpService.setParams(this.params);
    this.httpService.setHandlerResolver(reqistry);
}
 
开发者ID:YinYanfei,项目名称:CadalWorkspace,代码行数:20,代码来源:Httpd.java

示例7: RequestListenerThread

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的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

示例8: ListenerThread

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的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

示例9: ListenerThread

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的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

示例10: setupRegistry

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的package包/类
protected HttpRequestHandlerRegistry setupRegistry(EPServiceProviderSPI engineSPI) {
    HttpRequestHandlerRegistry registery = new HttpRequestHandlerRegistry();
    for (GetHandler getHandler : getHandlers) {
        log.info("Registering for service '" + serviceName + "' the pattern '" + getHandler.getPattern() + "'");
        registery.register(getHandler.getPattern(), new EsperHttpRequestHandler(engineSPI));
    }
    return registery;
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:9,代码来源:EsperHttpServiceBase.java

示例11: RequestListenerThread

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的package包/类
public RequestListenerThread(int port, String docRoot)
		throws IOException {

	this.docRoot = docRoot;
    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);
    
    this.serversocket.setSoTimeout(3000);
}
 
开发者ID:insweat,项目名称:hssd,代码行数:37,代码来源:RequestListenerThread.java

示例12: WebServer

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的package包/类
public WebServer(Context context){
	super(SERVER_NAME);
	
	this.setContext(context);
	
	serverPort = WebServer.DEFAULT_SERVER_PORT;
	httpproc = new BasicHttpProcessor();
	httpContext = new BasicHttpContext();
	
       httpproc.addInterceptor(new ResponseDate());
       httpproc.addInterceptor(new ResponseServer());
       httpproc.addInterceptor(new ResponseContent());
       httpproc.addInterceptor(new ResponseConnControl());

       httpService = new HttpService(httpproc, 
       									new DefaultConnectionReuseStrategy(),
       									new DefaultHttpResponseFactory());

	
       registry = new HttpRequestHandlerRegistry();
       
       registry.register(ALL_PATTERN, new AssetHandler(context));
       registry.register(HOME_PATTERN, new ListingHandler(context));
       registry.register(NONE_PATTERN, new ListingHandler(context));
       registry.register(DIR_PATTERN, new ListingHandler(context));
       registry.register(FILE_PATTERN, new FileHandler(context));
       registry.register(GETAPK_PATTERN, new GetApkHandler(context));
       registry.register(UPLOAD_PATTERN, new UploadHandler(context));
       registry.register(DOWNLOAD_ALL_PATTERN, new DownloadAllHandler(context));

       httpService.setHandlerResolver(registry);
}
 
开发者ID:TheZ3ro,项目名称:Blackhole,代码行数:33,代码来源:WebServer.java

示例13: ListenerThread

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的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:apache,项目名称:cloudstack,代码行数:32,代码来源:ApiServer.java

示例14: ListenerThread

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

示例15: start

import org.apache.http.protocol.HttpRequestHandlerRegistry; //导入依赖的package包/类
/**
 * Create a server socket on an available port and process the requests.
 */
public void start() throws IOException {
	// Prepare the HTTP server
	this.serverSocket = new ServerSocket(0);
	
	HttpParams httpParams = new BasicHttpParams()
		.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");
	
	BasicHttpProcessor httpProcessor = new BasicHttpProcessor();
	httpProcessor.addInterceptor(new ResponseDate());
	httpProcessor.addInterceptor(new ResponseServer());
	httpProcessor.addInterceptor(new ResponseContent());
	httpProcessor.addInterceptor(new ResponseConnControl());
	
	HttpRequestHandlerRegistry registry = new HttpRequestHandlerRegistry();
	for (Map.Entry<String, HttpRequestHandler> entry : requestHandlerByPattern.entrySet()) {
		registry.register(entry.getKey(), entry.getValue());
	}
	
	HttpService httpService = new HttpService(httpProcessor, new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory());
	httpService.setParams(httpParams);
	httpService.setHandlerResolver(registry);
	
	// Handle incoming connections
	executorService.execute(new RequestListener(this.serverSocket, httpParams, httpService, executorService, exceptionListener));
	}
 
开发者ID:marcplouhinec,项目名称:opentravelmate,代码行数:33,代码来源:HttpServer.java


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