Package org.apache.http.protocol

Examples of org.apache.http.protocol.HttpRequestHandlerRegistry


*/
public class HandlerUtils {

    public static HttpRequestHandlerRegistry initRegistry(final IBeeEventListener listener) {
        final Map<String, Object> handlers = HttpConfiguration.getInstance().getHandlers();
        final HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();

        if (!CollectionUtils.isEmpty(handlers)) {
            final Set<String> keys = handlers.keySet();
            final Map<String, Class<? extends AbstractHttpHandler>> classes = HandlerFactory.getHandlers();
            if (!CollectionUtils.isEmpty(classes)) {
                for (final String key : keys) {
                    final Object value = handlers.get(key);
                    final String[] tokens = CollectionUtils.delimitedListToStringArray(value.toString(), ":");
                    if (tokens.length == 2 && "true".equalsIgnoreCase(tokens[0])) {
                        final HttpRequestHandler handler = getHandler(listener,
                                classes.get(key));
                        if (null != handler) {
                            final String regKey = getRegistryPattern(tokens[1]);
                            reqistry.register(regKey, handler);
                            logHandler(regKey, handler.getClass());
                        }
                    }
                }
            }
View Full Code Here


        componentsXML, getClass().getClassLoader());

    HostRequestHandlerResolver hostResolver = new HostRequestHandlerResolver();
    HostServiceConfig hostConfig = new ServiceConfigParser(serverConfig).getConfig();
    for (String host : hostConfig.getHosts()) {
      HttpRequestHandlerRegistry registry = new HttpRequestHandlerRegistry();
      ServiceConfig serviceConfig = hostConfig.getServiceConfig(host);
      for (ServiceUrl serviceUrl : serviceConfig.getServiceUrlList()) {
        HttpHandler handler = factory.getHttpHandler(serviceUrl);
        if (handler != null) {
          LOG.info(serviceUrl.getPath() + " - " + handler.getClass().getName());
          registry.register(serviceUrl.getPath() + "*", handler);
        } else {
          LOG.warn(serviceUrl.getPath() + " HttpHandler is not found.");
        }
      }
      hostResolver.setHostRequestHandlerResolver(host, registry);
View Full Code Here

        this.httpproc.addInterceptor(new ResponseServer());
        this.httpproc.addInterceptor(new ResponseContent());
        this.httpproc.addInterceptor(new ResponseConnControl());
        this.connStrategy = new DefaultConnectionReuseStrategy();
        this.responseFactory = new DefaultHttpResponseFactory();
        this.reqistry = new HttpRequestHandlerRegistry();
        this.serversocket = new ServerSocket(0);
    }
View Full Code Here

            .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024)
            .setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK, false)
            .setBooleanParameter(HttpConnectionParams.TCP_NODELAY, true)
            .setParameter(HttpProtocolParams.ORIGIN_SERVER, "TEST-SSL-SERVER/1.1");
       
        this.reqistry = new HttpRequestHandlerRegistry();
        this.ioReactor = new DefaultListeningIOReactor(2, this.params);
        this.mutex = new Object();
    }
View Full Code Here

            .setIntParameter(HttpConnectionParams.SOCKET_BUFFER_SIZE, 8 * 1024)
            .setBooleanParameter(HttpConnectionParams.STALE_CONNECTION_CHECK, false)
            .setBooleanParameter(HttpConnectionParams.TCP_NODELAY, true)
            .setParameter(HttpProtocolParams.ORIGIN_SERVER, "TEST-SERVER/1.1");
       
        this.reqistry = new HttpRequestHandlerRegistry();
        this.ioReactor = new DefaultListeningIOReactor(2, this.params);
        this.mutex = new Object();
    }
View Full Code Here

                        new ResponseContent(),
                        new ResponseConnControl()
                });
        this.connStrategy = new DefaultConnectionReuseStrategy();
        this.responseFactory = new DefaultHttpResponseFactory();
        this.reqistry = new HttpRequestHandlerRegistry();
        this.serversocket = new ServerSocket(0);
    }
View Full Code Here

                new ResponseServer(),
                new ResponseContent(),
                new ResponseConnControl()
        });
       
        HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
        reqistry.register("/rnd", new RandomDataHandler());
       
        HttpService httpservice = new HttpService(
                httpproc,
                new DefaultConnectionReuseStrategy(),
                new DefaultHttpResponseFactory(),
View Full Code Here

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

            // Set up request handlers
            HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
            reqistry.register("*", new PasHttpFileHandler(docroot, decryptPwd, log, xsdFile));

            // Set up the HTTP service
            this.httpService = new HttpService(httpproc,
                    new DefaultConnectionReuseStrategy(),
                    new DefaultHttpResponseFactory());
View Full Code Here

                    httpproc.addInterceptor(new ResponseServer());
                    httpproc.addInterceptor(new ResponseContent());
                    httpproc.addInterceptor(new ResponseConnControl());
                   
                    // Set up request handlers
                    HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
                    reqistry.register("*", new HttpFileHandler(this.docRoot));
                   
                    // Set up the HTTP service
                    HttpService httpService = new HttpService(
                            httpproc,
                            new DefaultConnectionReuseStrategy(),
View Full Code Here

                new DefaultHttpResponseFactory(),
                new DefaultConnectionReuseStrategy(),
                params);
       
        // Set up request handlers
        HttpRequestHandlerRegistry reqistry = new HttpRequestHandlerRegistry();
        reqistry.register("*", new HttpFileHandler(args[0]));
       
        handler.setHandlerResolver(reqistry);
       
        // Provide an event logger
        handler.setEventListener(new EventLogger());
View Full Code Here

TOP

Related Classes of org.apache.http.protocol.HttpRequestHandlerRegistry

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.