Package org.eclipse.jetty.webapp

Examples of org.eclipse.jetty.webapp.WebAppContext.addFilter()


        // slows down specified paths
        if (serverArgs.containsKey("slowdown")) {
            String[] paths = serverArgs.get("slowdown").split(",");
            for (String p : paths) {
                System.out.println("Slowing down: " + p);
                webappcontext.addFilter(SlowFilter.class, p,
                        EnumSet.of(DispatcherType.REQUEST));
            }
        }
        // --cache=/run/APP/PUBLISHED/*,/other/path/asd.jpg
        // caches specified paths
View Full Code Here


        // caches specified paths
        if (serverArgs.containsKey("cache")) {
            String[] paths = serverArgs.get("cache").split(",");
            for (String p : paths) {
                System.out.println("Enabling cache for: " + p);
                webappcontext.addFilter(CacheFilter.class, p,
                        EnumSet.of(DispatcherType.REQUEST));
            }
        }

        // --autoreload=all --autoreload=WebContent/classes,other/path
View Full Code Here

      context.setWar(war.getAbsolutePath());
      context.setContextPath(contextPath);

      context.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");

      context.addFilter(GwtCacheHeaderFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));

      contexts.addHandler(context);
    }

    server.setHandler(contexts);
View Full Code Here

          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();
View Full Code Here

        }
      };

      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();

View Full Code Here

    webContext.getInitParams().put("org.eclipse.jetty.servlet.Default.useFileMappedBuffer", "false");
   
    server.setHandler(webContext);
    if (addDevelopmentComponents)
    {
      webContext.addFilter(DeclarativeUIFilter.class, "*.html", EnumSet.allOf(DispatcherType.class));
      webContext.addServlet(ViewTester.class, "/viewTester/*");
      if (!webContext.getInitParams().containsKey(DevModeInitializerListener.OUTPUT_CHARSET))
      {
        webContext.setInitParameter(DevModeInitializerListener.OUTPUT_CHARSET, pageOutputCharset);
      }
View Full Code Here

    EnumSet<DispatcherType> all = EnumSet.allOf(DispatcherType.class);
    FilterHolder gzipFilter = new FilterHolder(new GzipFilter());
    gzipFilter.setInitParameter("mimeTypes", "text/html,text/xhtml,text/plain,text/xml,text/javascript,"
      + "application/xhtml+xml,application/xml,application/javascript,application/json");
    gzipFilter.setInitParameter("minGzipSize", "860");
    webAppContext.addFilter(gzipFilter, "/*", all);


    contexts.addHandler(webAppContext);
      } catch (Exception e) {
    String msg = "Error Configuring Webapp:\n" + e.getClass().getSimpleName() + "\n" + Arrays.toString(e.getStackTrace()).replaceAll(",", "\n");
View Full Code Here

        webApp.setDefaultsDescriptor("webdefault-nojsp.xml");

        // Fixes serving static resources correctly. Without this, no charset is set in the Content-Type header and
        // 'good' browsers do a terrible job at guessing. Does not affect Java resources, which must specify
        // their own @Produces (usually by extending BaseJsonResource).
        webApp.addFilter(new StaticResourceUTF8CharEncodingFilterHolder(), "/*", EnumSet.allOf(DispatcherType.class));


        ////////////////////
        // Prepare jersey

View Full Code Here

        for (Map.Entry<String, String> initParam : addtionalInitParams.entrySet()) {
            // must iterate because jerseyFilter.setInitParameters replaces everything
            jerseyFilter.setInitParameter(initParam.getKey(), initParam.getValue());
        }

        webApp.addFilter(jerseyFilter, "/*", EnumSet.allOf(DispatcherType.class));


        ////////////////////////////////////////
        // prepare static resources locations

View Full Code Here

        return Guice.createInjector(new CrawljaxWebModule(outputFolder, pluginsFolder));
      }

    });

    webAppContext.addFilter(GuiceFilter.class, "/*", null);
    return webAppContext;
  }

  private WebAppContext setupOutputContext(final File outputFolder) {
    WebAppContext webAppContext = new WebAppContext();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.