本文整理匯總了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);
}
}