Returns the instance of the next handler, rather then calling handleRequest
on it.

@param httpServerExchange
The current requests server exchange.
@return The HttpHandler that should be executed next.
431352
public static HttpHandler getNext(HttpServerExchange httpServerExchange) {
		String chainId = httpServerExchange.getAttachment(CHAIN_ID);
		List<HttpHandler> handlersForId = handlerListById.get(chainId);
		Integer nextIndex = httpServerExchange.getAttachment(CHAIN_SEQ);
		// Check if we've reached the end of the chain.
		if (nextIndex < handlersForId.size()) {
			httpServerExchange.putAttachment(CHAIN_SEQ, nextIndex + 1);
			return handlersForId.get(nextIndex);
		}
		return null;
	}
683485
def get_handler(preferred_handler_name = nil)
      servers = %w(puma mongrel thin webrick)
      servers.unshift(preferred_handler_name) if preferred_handler_name

      handler, server_name = detect_valid_handler(servers)

      if preferred_handler_name && server_name != preferred_handler_name
        puts "Handler '#{preferred_handler_name}' not found, using fallback ('#{handler.inspect}')."
      end
      handler
    end
128237
protected TranWrapper getCurrentTranWrapper() throws ResourceException {

        final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();

        if (isTracingEnabled && tc.isEntryEnabled()) {
            Tr.entry(this, tc, "getCurrentTranWrapper");
        }

        // If the MCWrapper has not been completely initialized and we are working with an RA
        // that supports deferred enlistment of transactions, then let's re-initialize for the
        // UOW which we are already involved with.
        // This was a special fix that was put in for JMS Managed Sessions, but it
        // could apply to other internal connection types that might require this support.
        if ((state == STATE_ACTIVE_INUSE) && (gConfigProps.isDynamicEnlistmentSupported())) {
            if (isTracingEnabled && tc.isDebugEnabled()) {
                Tr.debug(this, tc, "State is STATE_ACTIVE_INUSE, calling initializeForUOW()...");
            }
            cm.initializeForUOW(this, true); // second parm indicates source of call is deferred enlistment.
        }

        if ((state != STATE_TRAN_WRAPPER_INUSE) && (state != STATE_ACTIVE_INUSE)) {
            IllegalStateException e = new IllegalStateException("getCurrentTranWrapper: illegal state exception. State = " + getStateString() + " MCW = "
                                                                + mcWrapperObject_hexString);
            Object[] parms = new Object[] { "getCurrentTranWrapper", e };
            Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
            throw e;
        }

        TranWrapper tranWrapper = null;
        switch (tranWrapperInUse) {
            case XATXWRAPPER:
                tranWrapper = xaTranWrapper;
                break;
            case LOCALTXWRAPPER:
                tranWrapper = localTranWrapper;
                break;
            case NOTXWRAPPER:
                tranWrapper = noTranWrapper;
                break;
            case RRSGLOBALTXWRAPPER:
                tranWrapper = rrsGlobalTranWrapper;
                break;
            case RRSLOCALTXWRAPPER:
                tranWrapper = rrsLocalTranWrapper;
                break;
            default:
                // Need RAS and Trace here.
                IllegalStateException e = new IllegalStateException("getCurrentTranWrapper: illegal transaction state exception. State = "
                                                                    + getTranWrapperString());
                Object[] parms = new Object[] { "getCurrentTranWrapper", e };
                Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
                throw e;
        }

        if (isTracingEnabled && tc.isEntryEnabled()) {
            Tr.exit(this, tc, "getCurrentTranWrapper", getTranWrapperString());
        }

        return tranWrapper;
    }
1289197
public URLStreamHandler getHandler() throws Exception {
        String handlerString = getSSLProtocolPackageHandler() + ".https.Handler";
        URLStreamHandler streamHandler = null;

        try {
            ClassLoader cl = AccessController.doPrivileged(getCtxClassLoader);
            if (cl != null) {
                streamHandler = (URLStreamHandler) cl.loadClass(handlerString).newInstance();
            } else {
                streamHandler = (URLStreamHandler) Class.forName(handlerString).newInstance();
            }
            return streamHandler;
        } catch (Exception e) {
            FFDCFilter.processException(e, getClass().getName(), "getHandler", this);
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "Exception loading https stream handler.", new Object[] { e });
            Tr.error(tc, "ssl.load.https.stream.handler.CWPKI0025E", new Object[] { handlerString, e.getMessage() });
            throw e;
        }
    }
103516
@Override
	protected Object getHandler(String serviceName) {
		Object handler = handlerMap.get(serviceName);
		if (handler == null) {
			logger.error("Service '{}' is not registered in this multi-server", serviceName);
			throw new RuntimeException("Service '" + serviceName + "' does not exist");
		}
		return handler;
	}
1053604
public static URLStreamHandler getURLStreamHandler()
   {

      if (handler != null)
         return handler;

      // use Class#forName(), instead created by 'new' to be sure handler
      // was started and set required system property.
      // Usually this job must be done by java.net.URL, but it does
      // not work in web container. Under tomcat class of handler can't be found in
      // $CATALINA_HOME/lib/*.jar. Probably the same problem can be under AS.
      String packagePrefixList = PrivilegedSystemHelper.getProperty("java.protocol.handler.pkgs");

      if (packagePrefixList == null)
         return null;

      StringTokenizer packagePrefixIter = new StringTokenizer(packagePrefixList, "|");

      while (handler == null && packagePrefixIter.hasMoreTokens())
      {
         String packagePrefix = packagePrefixIter.nextToken().trim();
         try
         {
            String clsName = packagePrefix + "." + JCR_SCHEME + ".Handler";
            Class<?> cls = ClassLoading.forName(clsName, UnifiedNodeReference.class);
            if (cls != null)
            {
               handler = (URLStreamHandler)cls.newInstance();
            }
         }
         catch (ExceptionInInitializerError e)
         {
            // exceptions can get thrown here if class not be loaded y system ClassLoader
            // or if class can't be instantiated.
            if (LOG.isTraceEnabled())
            {
               LOG.trace("An exception occurred: " + e.getMessage());
            }
         }
         catch (SecurityException e)
         {
            // exceptions can get thrown here if class not be loaded y system ClassLoader
            // or if class can't be instantiated.
            if (LOG.isTraceEnabled())
            {
               LOG.trace("An exception occurred: " + e.getMessage());
            }
         }
         catch (ClassNotFoundException e)
         {
            // exceptions can get thrown here if class not be loaded y system ClassLoader
            // or if class can't be instantiated.
            if (LOG.isTraceEnabled())
            {
               LOG.trace("An exception occurred: " + e.getMessage());
            }
         }
         catch (InstantiationException e)
         {
            // exceptions can get thrown here if class not be loaded y system ClassLoader
            // or if class can't be instantiated.
            if (LOG.isTraceEnabled())
            {
               LOG.trace("An exception occurred: " + e.getMessage());
            }
         }
         catch (IllegalAccessException e)
         {
            // exceptions can get thrown here if class not be loaded y system ClassLoader
            // or if class can't be instantiated.
            if (LOG.isTraceEnabled())
            {
               LOG.trace("An exception occurred: " + e.getMessage());
            }
         }
      }
      return handler;
   }
973775
@Override
    public HandlerRegistration addChangeHandler(final ChangeHandler handler) {
        return getRangeInputElement().addDomHandler(handler, ChangeEvent.getType());
    }
364050
private NettyServerHandler createHandler(
      ServerTransportListener transportListener, ChannelPromise channelUnused) {
    return NettyServerHandler.newHandler(
        transportListener,
        channelUnused,
        streamTracerFactories,
        transportTracer,
        maxStreams,
        flowControlWindow,
        maxHeaderListSize,
        maxMessageSize,
        keepAliveTimeInNanos,
        keepAliveTimeoutInNanos,
        maxConnectionIdleInNanos,
        maxConnectionAgeInNanos,
        maxConnectionAgeGraceInNanos,
        permitKeepAliveWithoutCalls,
        permitKeepAliveTimeInNanos);
  }
475624
public MultiMEProxyHandler getProxyHandler() {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled()) {
            SibTr.entry(tc, "getProxyHandler");
            SibTr.exit(tc, "getProxyHandler", _multiMEProxyHandler);
        }

        return _multiMEProxyHandler;
    }
150991
@Override
    public <T> Handler<AsyncResult<T>> toHandler(Resolver<T> resolver) {
        return result -> {
            if (result.succeeded()) {
                resolver.resolve(result.result());
            } else {
                resolver.reject(result.cause());
            }
        };
    }
29011
public SIMPMessageHandlerControllable getMessageHandler()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getMessageHandler");
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "getMessageHandler", handlerControl);

    return handlerControl ;      
  }
29654
protected void handleRegularRequest(HttpServerExchange exchange, HttpObjectSocket httpObjectSocket, Object[] received, StreamSinkChannel sinkchannel) {
        ArrayList<IPromise> futures = new ArrayList<>();
        httpObjectSocket.getSink().receiveObject(received, futures, exchange.getRequestHeaders().getFirst("JWT") );

        Runnable reply = () -> {
            // piggy back outstanding lp messages, outstanding lp request is untouched
            Pair<byte[], Integer> nextQueuedMessage = httpObjectSocket.getNextQueuedMessage();
            byte response[] = nextQueuedMessage.getFirst();
            exchange.setResponseContentLength(response.length);
            if (response.length == 0) {
                exchange.endExchange();
            } else {
                httpObjectSocket.storeLPMessage(nextQueuedMessage.cdr(), response);

                //FIXME: ASYNC !!!
                long tim = System.nanoTime();
                ByteBuffer responseBuf = ByteBuffer.wrap(response);
                try {
                    while (responseBuf.remaining()>0) {
                        sinkchannel.write(responseBuf);
                    }
                } catch (IOException e) {
                    Log.Warn(this,e);
                }
//                System.out.println("syncwrite time micros:"+(System.nanoTime()-tim)/1000);
                exchange.endExchange();
            }
        };
        if ( futures == null || futures.size() == 0 ) {
            reply.run();
        } else {
            Actors.all((List) futures).timeoutIn(REQUEST_RESULTING_FUTURE_TIMEOUT).then( () -> {
                reply.run();
            }).onTimeout( () -> reply.run() );
            sinkchannel.resumeWrites();
        }
    }
45300
public static boolean handleIfNoneMatch(final HttpServerExchange exchange, final List<ETag> etags, boolean allowWeak) {
        return handleIfNoneMatch(exchange.getRequestHeaders().getFirst(Headers.IF_NONE_MATCH), etags, allowWeak);
    }
229120
private URLStreamHandler getURLStreamHandler(final String protocol) {
        try {
            final Method method = URL.class.getDeclaredMethod("getURLStreamHandler", String.class);
            method.setAccessible(true);
            return (URLStreamHandler) method.invoke(null, protocol);
        } catch (final Exception e) {
            if (logger.isWarnEnabled()) {
                logger.warn("could not access URL.getUrlStreamHandler");
            }
            return null;
        }
    }
142019
public static RequestLimitingHandler requestLimitingHandler(final int maxRequest, final int queueSize, HttpHandler next) {
        return new RequestLimitingHandler(maxRequest, queueSize, next);
    }
153769
@Override
    public void handleRequest(final HttpServerExchange exchange) throws Exception {

        // handle request header
        Map<String, Object> requestHeaderMap = (Map<String, Object>)config.get(REQUEST);
        if(requestHeaderMap != null) {
            List<String> requestHeaderRemove = (List<String>)requestHeaderMap.get(REMOVE);
            if(requestHeaderRemove != null) {
                requestHeaderRemove.forEach(s -> exchange.getRequestHeaders().remove(s));
            }
            Map<String, String> requestHeaderUpdate = (Map<String, String>)requestHeaderMap.get(UPDATE);
            if(requestHeaderUpdate != null) {
                requestHeaderUpdate.forEach((k, v) -> exchange.getRequestHeaders().put(new HttpString(k), v));
            }
        }

        // handle response header
        Map<String, Object> responseHeaderMap = (Map<String, Object>)config.get(RESPONSE);
        if(responseHeaderMap != null) {
            List<String> responseHeaderRemove = (List<String>)responseHeaderMap.get(REMOVE);
            if(responseHeaderRemove != null) {
                responseHeaderRemove.forEach(s -> exchange.getResponseHeaders().remove(s));
            }
            Map<String, String> responseHeaderUpdate = (Map<String, String>)responseHeaderMap.get(UPDATE);
            if(responseHeaderUpdate != null) {
                responseHeaderUpdate.forEach((k, v) -> exchange.getResponseHeaders().put(new HttpString(k), v));
            }
        }
        Handler.next(exchange, next);
    }
894265
public URLStreamHandler createURLStreamHandler (String protocol)
    {
        Class<? extends URLStreamHandler> handler = _handlers.get(protocol.toLowerCase());
        if (handler != null) {
            try {
                return handler.newInstance();
            } catch (Exception e) {
                log.warning("Unable to instantiate URLStreamHandler", "protocol", protocol,
                            "cause", e);
            }
        }
        return null;
    }