Creates the handler
@return The built handler
430543
public ResourceHandler build() {
        if (resourceProviderFactory == null) {
            throw new IllegalStateException("No resourceProviderFactory has been set");
        }
        return new ResourceHandler(resourceProviderFactory, pathToServeFrom, defaultFile, extensionToResourceType);
    }
207478
public Handler addHandler(Handler handler) throws JettyBootstrapException {
        JettyHandler jettyHandler = new JettyHandler();
        jettyHandler.setHandler(handler);

        handlers.addHandler(handler);

        return handler;
    }
1316046
@Override
    public ProxyHandler createProxyHandler() {
        final HttpProxyHandler handler;

        // For reasons that are not immediately clear, HttpProxyHandler doesn't allow null usernames/passwords if
        // specified. If we want them to be null, we have to use the constructor that doesn't take a username/password
        // at all.
        if (this.username != null && this.password != null) {
            handler = new HttpProxyHandler(this.proxyAddress, this.username, this.password);
        } else {
            handler = new HttpProxyHandler(this.proxyAddress);
        }

        return handler;
    }
335809
public static ModelControllerClient createAndAdd(final ManagementChannelHandler handler) {
        final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler);
        handler.addHandlerFactory(client);
        return client;
    }
1357333
public static <E> BeanHandler<E> create(Class<E> beanType) {
		return new BeanHandler<E>(beanType);
	}
536494
public final ProxyHandler newProxyHandler() {
		InetSocketAddress proxyAddr = this.address.get();
		String username = this.username;
		String password = Objects.nonNull(username) && Objects.nonNull(this.password) ?
				this.password.apply(username) : null;

		switch (this.type) {
			case HTTP:
				return Objects.nonNull(username) && Objects.nonNull(password) ?
						new HttpProxyHandler(proxyAddr, username, password, this.httpHeaders.get()) :
						new HttpProxyHandler(proxyAddr, this.httpHeaders.get());
			case SOCKS4:
				return Objects.nonNull(username) ? new Socks4ProxyHandler(proxyAddr, username) :
						new Socks4ProxyHandler(proxyAddr);
			case SOCKS5:
				return Objects.nonNull(username) && Objects.nonNull(password) ?
						new Socks5ProxyHandler(proxyAddr, username, password) :
						new Socks5ProxyHandler(proxyAddr);
		}
		throw new IllegalArgumentException("Proxy type unsupported : " + this.type);
	}
1076870
public synchronized ServletHandler getServletHandler()
    {
        if (_servletHandler==null)
            _servletHandler=(ServletHandler) getHandler(ServletHandler.class);
        if (_servletHandler==null)
        {
            _servletHandler=new ServletHandler();
            addHandler(_servletHandler);
        }
        return _servletHandler;
    }
522002
public AutoCloseable registerErrorHandler(final EventHandler<Exception> theHandler) {
    this.transport.registerErrorHandler(theHandler);
    return new SubscriptionHandler<>(
        new Exception("Token for finding the error handler subscription"), this.unsubscribeException);
  }
404336
public TagHandler createSkipHandler() {
        return new TagHandler() {
            @Override
            public void handle(Tag tag, InputStream input) throws IOException, ConverterException {
                log.debug("Going to skip tag: " + tag.getName());
                long size = tag.getSize();
                while (size > 0) {
                    size -= input.skip(size);
                }
            }
        };
    }
1057130
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ String.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return String.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
                                  (ContentHandle<C>) new StringHandle() : null;
        return handle;
      }
    };
  }
612909
public CompletionHandler createAsyncHandler() {
        return Utility.createAsyncHandler((v, a) -> {
            finish(v);
        }, (t, a) -> {
            context.getLogger().log(Level.WARNING, "Servlet occur, force to close channel. request = " + request + ", result is CompletionHandler", (Throwable) t);
            finish(500, null);
        });
    }
1374214
def _create_handler(self, handler_class, level):
        """"""
        if handler_class == logging.StreamHandler:
            handler = handler_class()
            handler.setLevel(level)
        elif handler_class == logging.handlers.SysLogHandler:
            handler = handler_class(address='/dev/log')
            handler.setLevel(level)
        elif handler_class == logging.handlers.TimedRotatingFileHandler:
            handler = handler_class(self.filename, when='midnight')
            handler.setLevel(level)
        elif handler_class == AlkiviEmailHandler:
            handler = handler_class(mailhost='127.0.0.1',
                                    fromaddr="%s@%s" % (USER, HOST),
                                    toaddrs=self.emails,
                                    level=self.min_log_level_to_mail)
            # Needed, we want all logs to go there
            handler.setLevel(0)

        formatter = self.get_formatter(handler)
        handler.setFormatter(formatter)
        self.handlers.append(handler)
        self.logger.addHandler(handler)
308151
static public ContentHandleFactory newFactory() {
    return new ContentHandleFactory() {
      @Override
      public Class<?>[] getHandledClasses() {
        return new Class<?>[]{ JsonElement.class };
      }
      @Override
      public boolean isHandled(Class<?> type) {
        return JsonElement.class.isAssignableFrom(type);
      }
      @Override
      public <C> ContentHandle<C> newHandle(Class<C> type) {
        @SuppressWarnings("unchecked")
        ContentHandle<C> handle = isHandled(type) ?
          (ContentHandle<C>) new GSONHandle() : null;
        return handle;
      }
    };
  }
253031
public function getRequestHandler()
    {
        if (isset($this->requestHandler))
            return $this->requestHandler;

        // now instantiating handler from config
        $handlerClass = "\\" . ltrim($this->handlerClass, "\\");
        if (!class_exists($handlerClass))
            throw new RuntimeException("Unable to create HTTP Handler instance with class: " . var_export($handlerClass, true));

        $this->requestHandler = new $handlerClass();
        return $this->requestHandler;
    }
661884
private BuildLogger createLogger() {
        BuildLogger logger;
        if (args.loggerClassname != null) {
            try {
                logger = ClasspathUtils.newInstance(args.loggerClassname, Main.class.getClassLoader(),
                        BuildLogger.class);
            } catch (final BuildException e) {
                printErrorMessage("The specified logger class " + args.loggerClassname + " could not be used because "
                        + e.getMessage());
                throw new RuntimeException();
            }
        } else {
            logger = new DefaultLogger();
            ((DefaultLogger) logger).useColor(args.useColor);
        }

        logger.setMessageOutputLevel(args.msgOutputLevel);
        logger.setOutputPrintStream(out);
        logger.setErrorPrintStream(err);
        logger.setEmacsMode(args.emacsMode);

        return logger;
    }
1291738
public static ContentHandler create( ContentHandler[] handlers ) {
		if(handlers.length==0)
			throw new IllegalArgumentException();
		
		ContentHandler result = handlers[0];
		for( int i=1; i<handlers.length; i++ )
			result = new ForkContentHandler( result, handlers[i] );
		return result;
	}
	
	
	private final ContentHandler lhs,rhs;
	
	public void setDocumentLocator (Locator locator) {
		lhs.setDocumentLocator(locator);
		rhs.setDocumentLocator(locator);
	}
	
	public void startDocument() throws SAXException {
		lhs.startDocument();
		rhs.startDocument();
	}
		
	public void endDocument () throws SAXException {
		lhs.endDocument();
		rhs.endDocument();
	}

	public void startPrefixMapping (String prefix, String uri) throws SAXException {
		lhs.startPrefixMapping(prefix,uri);
		rhs.startPrefixMapping(prefix,uri);
	}

	public void endPrefixMapping (String prefix) throws SAXException {
		lhs.endPrefixMapping(prefix);
		rhs.endPrefixMapping(prefix);
	}
	    
	public void startElement (String uri, String localName, String qName, Attributes attributes) throws SAXException {
		lhs.startElement(uri,localName,qName,attributes);
		rhs.startElement(uri,localName,qName,attributes);
	}
	    
	public void endElement (String uri, String localName, String qName) throws SAXException {
		lhs.endElement(uri,localName,qName);
		rhs.endElement(uri,localName,qName);
	}
	    
	public void characters (char ch[], int start, int length) throws SAXException {
		lhs.characters(ch,start,length);
		rhs.characters(ch,start,length);
	}
	    
	public void ignorableWhitespace (char ch[], int start, int length) throws SAXException {
		lhs.ignorableWhitespace(ch,start,length);
		rhs.ignorableWhitespace(ch,start,length);
	}
	    
	public void processingInstruction (String target, String data) throws SAXException {
		lhs.processingInstruction(target,data);
		rhs.processingInstruction(target,data);
	}

	public void skippedEntity (String name) throws SAXException {
		lhs.skippedEntity(name);
		rhs.skippedEntity(name);
	}
	
}
1146508
public ServiceRefHandlerChainType<ServiceRefHandlerChainsType<T>> getOrCreateHandlerChain()
   {
      List<Node> nodeList = childNode.get("handler-chain");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new ServiceRefHandlerChainTypeImpl<ServiceRefHandlerChainsType<T>>(this, "handler-chain", childNode, nodeList.get(0));
      }
      return createHandlerChain();
   }