當前位置: 首頁>>代碼示例>>Java>>正文


Java Handler.handle方法代碼示例

本文整理匯總了Java中org.eclipse.jetty.server.Handler.handle方法的典型用法代碼示例。如果您正苦於以下問題:Java Handler.handle方法的具體用法?Java Handler.handle怎麽用?Java Handler.handle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jetty.server.Handler的用法示例。


在下文中一共展示了Handler.handle方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handle

import org.eclipse.jetty.server.Handler; //導入方法依賴的package包/類
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    Handler[] handlers = getHandlers();
    if (handlers!=null && isStarted())
    {

        if (target.startsWith("/api/") && !AppsCallAggregator.canHandle(target, request)) {
            boolean isLocalRestRequest = target.startsWith("/api/v1/runners") || target.startsWith("/api/v1/system");
            Handler h = isLocalRestRequest ? restService : reverseProxy;
            h.handle(target, baseRequest, request, response);
            if (baseRequest.isHandled()) {
                return;
            }
        }

        for (Handler handler : handlers) {
            handler.handle(target, baseRequest, request, response);
            if (baseRequest.isHandled()) {
                return;
            }
        }

    }
}
 
開發者ID:danielflower,項目名稱:app-runner-router,代碼行數:25,代碼來源:RouterHandlerList.java

示例2: add

import org.eclipse.jetty.server.Handler; //導入方法依賴的package包/類
@Override
public WebAppContext add(String war, List<String> hostList) throws Exception {
	if (true) {
		if (contextMap.containsKey(war)) {
			throw new RuntimeException("webapp[" + war + "]已添加.");
		}
	}

	Handler handlerList = null;// this.getHandlerList(hostList);

	MyJettyWebAppContext webapp = new MyJettyWebAppContext(hostList, war) {
		@Override
		public void doScope(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
			// System.out.println("WebappDaoImpl doScope start target:" + target + " serverName:" + request.getServerName() + " isHandled:" + baseRequest.isHandled() + " handler:" + handler
			// + " hostList:" + hostList);
			if (handlerList != null) {
				handlerList.handle(target, baseRequest, request, response);
				if (response.isCommitted() || baseRequest.isHandled()) {
					return;
				}
			}
			// System.out.println("WebappDaoImpl doScope end target:" + target + " serverName:" + request.getServerName() + " isHandled:" + baseRequest.isHandled() + " handler:" + handler
			// + " hostList:" + hostList);
			super.doScope(target, baseRequest, request, response);
		}
	};

	// WebAppContext webapp = new WebAppContext();

	if (true) {
		LeopardWebAppClassLoader classLoader = new LeopardWebAppClassLoader(webapp);
		webapp.setClassLoader(classLoader);
		webapp.setParentLoaderPriority(false);
		logger.info("classLoader:" + classLoader + " hashCode:" + classLoader.hashCode());
	}
	// contextHandlerCollection.addHandler(webapp);
	contextMap.put(war, webapp);
	// webapp.start();
	return webapp;
}
 
開發者ID:tanhaichao,項目名稱:leopard,代碼行數:41,代碼來源:WebappDaoImpl.java

示例3: handle

import org.eclipse.jetty.server.Handler; //導入方法依賴的package包/類
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

    Handler handler = HttpServer.this.handlers.poll();
    if (handler == null) {
        response.sendError(500, "No handler enqueued");
        response.getOutputStream().flush();
        response.getOutputStream().close();

    } else {
        handler.handle(target, baseRequest, request, response);
    }
}
 
開發者ID:amaralDaniel,項目名稱:megaphone,代碼行數:14,代碼來源:HttpServer.java


注:本文中的org.eclipse.jetty.server.Handler.handle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。