當前位置: 首頁>>代碼示例>>Java>>正文


Java WebAppContext.addFilter方法代碼示例

本文整理匯總了Java中org.eclipse.jetty.webapp.WebAppContext.addFilter方法的典型用法代碼示例。如果您正苦於以下問題:Java WebAppContext.addFilter方法的具體用法?Java WebAppContext.addFilter怎麽用?Java WebAppContext.addFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jetty.webapp.WebAppContext的用法示例。


在下文中一共展示了WebAppContext.addFilter方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onAppStart

import org.eclipse.jetty.webapp.WebAppContext; //導入方法依賴的package包/類
/**
 * onAppStart
 * 
 * @param args
 */
public void onAppStart(Object... args) {

    WebAppContext sc = getWebAppContext(args);

    if (sc == null) {
        return;
    }

    InterceptSupport iSupport = InterceptSupport.instance();
    InterceptContext context = iSupport.createInterceptContext(Event.WEBCONTAINER_STARTED);
    context.put(InterceptConstants.WEBAPPLOADER, sc.getClassLoader());
    context.put(InterceptConstants.WEBWORKDIR, sc.getServletContext().getRealPath(""));
    context.put(InterceptConstants.CONTEXTPATH, sc.getContextPath());
    context.put(InterceptConstants.APPNAME, sc.getDisplayName());

    ServletContext sContext = sc.getServletContext();

    context.put(InterceptConstants.SERVLET_CONTEXT, sContext);

    getBasePath(context, sContext);

    iSupport.doIntercept(context);

    // GlobalFilter
    sc.addFilter("com.creditease.monitor.jee.filters.GlobalFilter", "/*", EnumSet.of(DispatcherType.REQUEST));
}
 
開發者ID:uavorg,項目名稱:uavstack,代碼行數:32,代碼來源:JettyPlusIT.java

示例2: addSecurityFilter

import org.eclipse.jetty.webapp.WebAppContext; //導入方法依賴的package包/類
private void addSecurityFilter(WebAppContext ctx) {
    // The bean name is not arbitrary, but is as expected by Spring
    Filter f = new DelegatingFilterProxy(AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME);

    ctx.addFilter(
            new FilterHolder(f),
            CONFIG.getSpringManagerMapping(),
            EnumSet.allOf(DispatcherType.class)
    );
}
 
開發者ID:RWTH-i5-IDSG,項目名稱:steve-plugsurfing,代碼行數:11,代碼來源:SteveAppContext.java

示例3: startWebSocketServer

import org.eclipse.jetty.webapp.WebAppContext; //導入方法依賴的package包/類
public void startWebSocketServer(final Injector injector) {
  httpServer = new Server();

  List<Connector> connectors = getSelectChannelConnectors(httpAddresses);
  if (connectors.isEmpty()) {
    LOG.severe("No valid http end point address provided!");
  }
  for (Connector connector : connectors) {
    httpServer.addConnector(connector);
  }
  final WebAppContext context = new WebAppContext();

  context.setParentLoaderPriority(true);

  if (jettySessionManager != null) {
    // This disables JSessionIDs in URLs redirects
    // see: http://stackoverflow.com/questions/7727534/how-do-you-disable-jsessionid-for-jetty-running-with-the-eclipse-jetty-maven-plu
    // and: http://jira.codehaus.org/browse/JETTY-467?focusedCommentId=114884&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-114884
    jettySessionManager.setSessionIdPathParameterName(null);

    context.getSessionHandler().setSessionManager(jettySessionManager);
  }
  final ResourceCollection resources = new ResourceCollection(resourceBases);
  context.setBaseResource(resources);

  addWebSocketServlets();

  try {
    final Injector parentInjector = injector;

    final ServletModule servletModule = getServletModule(parentInjector);

    ServletContextListener contextListener = new GuiceServletContextListener() {

      private final Injector childInjector = parentInjector.createChildInjector(servletModule);

      @Override
      protected Injector getInjector() {
        return childInjector;
      }
    };

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

    httpServer.start();
    restoreSessions();

  } catch (Exception e) { // yes, .start() throws "Exception"
    LOG.severe("Fatal error starting http server.", e);
    return;
  }
  LOG.fine("WebSocket server running.");
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:57,代碼來源:ServerRpcProvider.java


注:本文中的org.eclipse.jetty.webapp.WebAppContext.addFilter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。