org.eclipse.jetty.server.Server.insertHandler()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.eclipse.jetty.server.Server.insertHandler()方法的一些代码示例,展示了Server.insertHandler()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.insertHandler()方法的具体详情如下:
包路径:org.eclipse.jetty.server.Server
类名称:Server
方法名:insertHandler

Server.insertHandler介绍

暂无

代码示例

代码示例来源:origin: emc-mongoose/mongoose

final RewriteHandler addCorsHeaderHandler = new RewriteHandler();
addCorsHeaderHandler.addRule(new AddCorsHeadersRule());
server.insertHandler(addCorsHeaderHandler);
context.addServlet(new ServletHolder(new ConfigServlet(fullDefaultConfig)), "/config/*");
context.addServlet(new ServletHolder(new LogServlet()), "/logs/*");

代码示例来源:origin: apache/incubator-dubbo-rpc-jsonrpc

public JettyHttpServer(URL url, final HttpHandler handler) {
  super(url, handler);
  DispatcherServlet.addHttpHandler(url.getPort(), handler);
  int threads = url.getParameter(Constants.THREADS_KEY, Constants.DEFAULT_THREADS);
  QueuedThreadPool threadPool = new QueuedThreadPool();
  threadPool.setDaemon(true);
  threadPool.setMaxThreads(threads);
  threadPool.setMinThreads(threads);
  server = new Server(threadPool);
  // HTTP connector
  ServerConnector connector = new ServerConnector(server);
  if (!url.isAnyHost() && NetUtils.isValidLocalHost(url.getHost())) {
    connector.setHost(url.getHost());
  }
  connector.setPort(url.getPort());
  // connector.setIdleTimeout(30000);
  server.addConnector(connector);
  ServletHandler servletHandler = new ServletHandler();
  ServletHolder servletHolder = servletHandler.addServletWithMapping(DispatcherServlet.class, "/*");
  servletHolder.setInitOrder(2);
  server.insertHandler(servletHandler);
  try {
    server.start();
  } catch (Exception e) {
    throw new IllegalStateException("Failed to start jetty server on " + url.getAddress() + ", cause: "
        + e.getMessage(), e);
  }
}

代码示例来源:origin: apache/felix

gzipHandler.addExcludedMimeTypes(this.config.getGzipExcludedMimeTypes());
this.server.insertHandler(gzipHandler);

相关文章