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