当前位置: 首页>>代码示例>>Java>>正文


Java FilterHolder.getFilter方法代码示例

本文整理汇总了Java中org.eclipse.jetty.servlet.FilterHolder.getFilter方法的典型用法代码示例。如果您正苦于以下问题:Java FilterHolder.getFilter方法的具体用法?Java FilterHolder.getFilter怎么用?Java FilterHolder.getFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jetty.servlet.FilterHolder的用法示例。


在下文中一共展示了FilterHolder.getFilter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCrossOriginFilterAddedWhenOn

import org.eclipse.jetty.servlet.FilterHolder; //导入方法依赖的package包/类
@Test
public void testCrossOriginFilterAddedWhenOn() throws Exception {
    // setup
    CometdComponent component = context.getComponent("cometd", CometdComponent.class);
    Server server = new Server();

    when(endpoint.isCrossOriginFilterOn()).thenReturn(true);
    when(endpoint.getFilterPath()).thenReturn(FILTER_PATH);
    when(endpoint.getAllowedOrigins()).thenReturn(ALLOWED_ORIGINS);

    // act
    component.createServletForConnector(server, connector, endpoint);

    // assert
    ServletContextHandler handler = (ServletContextHandler) server.getHandler();
    assertEquals(1, handler.getServletHandler().getFilters().length);

    FilterHolder filterHolder = handler.getServletHandler().getFilters()[0];
    Filter filter = filterHolder.getFilter();
    assertTrue(filter instanceof CrossOriginFilter);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:22,代码来源:CometdCrossOriginConsumerTest.java

示例2: stopJettySolrRunner

import org.eclipse.jetty.servlet.FilterHolder; //导入方法依赖的package包/类
private static void stopJettySolrRunner(JettySolrRunner jetty) throws Exception {
  assert(jetty != null);
  monkeyLog("stop shard! " + jetty.getLocalPort());
  // get a clean shutdown so that no dirs are left open...
  FilterHolder fh = jetty.getDispatchFilter();
  if (fh != null) {
    SolrDispatchFilter sdf = (SolrDispatchFilter) fh.getFilter();
    if (sdf != null) {
      sdf.destroy();
    }
  }
  jetty.stop();
  
  if (!jetty.isStopped()) {
    throw new RuntimeException("could not stop jetty");
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:ChaosMonkey.java

示例3: kill

import org.eclipse.jetty.servlet.FilterHolder; //导入方法依赖的package包/类
public static void kill(JettySolrRunner jetty) throws Exception {
  FilterHolder filterHolder = jetty.getDispatchFilter();
  if (filterHolder != null) {
    Filter filter = filterHolder.getFilter();
    if (filter != null) {
      CoreContainer cores = ((SolrDispatchFilter) filter).getCores();
      if (cores != null) {
        int zklocalport = ((InetSocketAddress) cores.getZkController()
            .getZkClient().getSolrZooKeeper().getSocketAddress()).getPort();
        IpTables.blockPort(zklocalport);
      }
    }
  }

  IpTables.blockPort(jetty.getLocalPort());
  
  monkeyLog("kill shard! " + jetty.getLocalPort());
  
  jetty.stop();
  
  stop(jetty);
  
  if (!jetty.isStopped()) {
    throw new RuntimeException("could not kill jetty");
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:27,代码来源:ChaosMonkey.java

示例4: start

import org.eclipse.jetty.servlet.FilterHolder; //导入方法依赖的package包/类
public static boolean start(JettySolrRunner jetty) throws Exception {

    IpTables.unblockPort(jetty.getLocalPort());
    try {
      jetty.start();
    } catch (Exception e) {
      jetty.stop();
      Thread.sleep(3000);
      try {
        jetty.start();
      } catch (Exception e2) {
        jetty.stop();
        Thread.sleep(10000);
        try {
          jetty.start();
        } catch (Exception e3) {
          jetty.stop();
          Thread.sleep(30000);
          try {
            jetty.start();
          } catch (Exception e4) {
            log.error("Could not get the port to start jetty again", e4);
            // we coud not get the port
            jetty.stop();
            return false;
          }
        }
      }
    }
    FilterHolder filterHolder = jetty.getDispatchFilter();
    if (filterHolder != null) {
      Filter filter = filterHolder.getFilter();
      if (filter != null) {
        CoreContainer cores = ((SolrDispatchFilter) filter).getCores();
        if (cores != null) {
          int zklocalport = ((InetSocketAddress) cores.getZkController()
              .getZkClient().getSolrZooKeeper().getSocketAddress()).getPort();
          IpTables.unblockPort(zklocalport);
        }
      }
    }
    return true;
  }
 
开发者ID:europeana,项目名称:search,代码行数:44,代码来源:ChaosMonkey.java


注:本文中的org.eclipse.jetty.servlet.FilterHolder.getFilter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。