當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。