org.eclipse.jetty.webapp.WebAppContext.addFilter()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(140)

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

WebAppContext.addFilter介绍

暂无

代码示例

代码示例来源:origin: gocd/gocd

private void addDefaultServlet(WebAppContext wac) {
  wac.addFilter(BreakpointFriendlyFilter.class, "*", EnumSet.of(DispatcherType.REQUEST));
}

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

private void performInjectionForContentViewerUis(final Collection<WebAppContext> contentViewerWebContexts,
                         final FilterHolder securityFilter) {
  if (CollectionUtils.isNotEmpty(contentViewerWebContexts)) {
    for (final WebAppContext contentViewerContext : contentViewerWebContexts) {
      // add the security filter to any content viewer  wars
      if (securityFilter != null) {
        contentViewerContext.addFilter(securityFilter, "/*", EnumSet.allOf(DispatcherType.class));
      }
    }
  }
}

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

private void performInjectionForComponentUis(final Collection<WebAppContext> componentUiExtensionWebContexts,
                       final NiFiWebConfigurationContext configurationContext, final FilterHolder securityFilter) {
  if (CollectionUtils.isNotEmpty(componentUiExtensionWebContexts)) {
    for (final WebAppContext customUiContext : componentUiExtensionWebContexts) {
      // set the NiFi context in each custom ui servlet context
      final ServletContext customUiServletContext = customUiContext.getServletHandler().getServletContext();
      customUiServletContext.setAttribute("nifi-web-configuration-context", configurationContext);
      // add the security filter to any ui extensions wars
      if (securityFilter != null) {
        customUiContext.addFilter(securityFilter, "/*", EnumSet.allOf(DispatcherType.class));
      }
    }
  }
}

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

webappContext.addFilter(new FilterHolder(FRAME_OPTIONS_FILTER), "/*", EnumSet.allOf(DispatcherType.class));
webappContext.addFilter(cspFilter, "/*", EnumSet.allOf(DispatcherType.class));

代码示例来源:origin: stackoverflow.com

Server server = new Server();
 // Note: if you don't want control over type of connector, etc. you can simply 
 // call new Server(<port>);
 ServerConnector connector = new ServerConnector(server);
 connector.setHost("0.0.0.0");
 connector.setPort(8085);
 // Setting the name allows you to serve different app contexts from different connectors.
 connector.setName("main");
 server.addConnector(connector);
 WebAppContext context = new WebAppContext();
 context.setContextPath("/");
 // For development within an IDE like Eclipse, you can directly point to the web.xml
 context.setWar("src/main/webapp");
 context.addFilter(MyFilter.class, "/", 1);
 HandlerCollection collection = new HandlerCollection();
 RequestLogHandler rlh = new RequestLogHandler();
 // Slf4j - who uses anything else?
 Slf4jRequestLog requestLog = new Slf4jRequestLog();
 requestLog.setExtended(false);
 rlh.setRequestLog(requestLog);
 collection.setHandlers(new Handler[] { context, rlh });
 server.setHandler(collection);
 try {
   server.start();
   server.join();
 } catch (Exception e) {
   // Google guava way
   throw Throwables.propagate(e);
 }

代码示例来源:origin: neo4j/neo4j

staticContext.addFilter( new FilterHolder( new StaticContentFilter() ), "/*",
    EnumSet.of( DispatcherType.REQUEST, DispatcherType.FORWARD ) );

代码示例来源:origin: stackoverflow.com

webapp.addFilter(MyFilter.class, "/test", 1); // Will serve request to /test.

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

webContentViewerContext.addFilter(securityFilter, "/*", EnumSet.allOf(DispatcherType.class));

代码示例来源:origin: kumuluz/kumuluzee

@Override
public void registerFilter(Class<? extends Filter> filterClass, String pathSpec, EnumSet<DispatcherType> dispatches, Map<String,
    String> parameters) {
  if (server == null)
    throw new IllegalStateException("Jetty has to be initialized before adding a servlet ");
  if (server.isStarted() || server.isStarting())
    throw new IllegalStateException("Jetty cannot be started before adding a servlet");
  FilterHolder holder = new FilterHolder(filterClass);
  if (parameters != null) {
    parameters.forEach(holder::setInitParameter);
  }
  appContext.addFilter(holder, pathSpec, dispatches);
}

代码示例来源:origin: stackoverflow.com

webapp.addFilter(...);

代码示例来源:origin: apache/incubator-wave

context.addFilter(GuiceFilter.class, "/*", EnumSet.allOf(DispatcherType.class));
context.addFilter(GzipFilter.class, "/webclient/*", EnumSet.allOf(DispatcherType.class));
httpServer.setHandler(context);

代码示例来源:origin: org.neo4j.app/neo4j-server

staticContext.addFilter( new FilterHolder( new StaticContentFilter() ), "/*",
    EnumSet.of( DispatcherType.REQUEST, DispatcherType.FORWARD ) );

代码示例来源:origin: io.brooklyn/brooklyn-launcher

rootContext.addFilter(securityFilterClazz, "/*", EnumSet.allOf(DispatcherType.class));

代码示例来源:origin: hammock-project/hammock

EnumSet<DispatcherType> dispatcherTypes = EnumSet.copyOf(Arrays.asList(dispatcherTypesArr));
for(String pattern : filterDescriptor.urlPatterns()) {
  context.addFilter(filterDescriptor.getClazz(), pattern, dispatcherTypes);

代码示例来源:origin: nutzam/nutz-web

wac.addFilter(new FilterHolder(new WebAllowFilter(allowPaths)), "/*", EnumSet.of(DispatcherType.REQUEST));

代码示例来源:origin: tcplugins/tcWebHooks

ctx.addServlet(new ServletHolder(new TestingServlet(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, this)), "/auth/500");
ctx.addFilter(new FilterHolder(new ResponseCodeFilter(this)), "/*" , EnumSet.of(DispatcherType.REQUEST));

代码示例来源:origin: bioinformatics-ua/dicoogle

webpages.setWelcomeFiles(new String[]{"index.html"});
webpages.addServlet(new ServletHolder(new SearchHolderServlet()), "/search/holders");
webpages.addFilter(GzipFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));

相关文章

微信公众号

最新文章

更多

WebAppContext类方法