当前位置: 首页>>代码示例>>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;未经允许,请勿转载。