本文整理汇总了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;
}
}
}
}
示例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;
}
示例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);
}
}