Examples of FilterHolder


Examples of org.mortbay.jetty.servlet.FilterHolder

        assertTrue(TestServlet.__maxSleepers<=MAX_QOS);
    }

    public void testQosFilter() throws Exception
    {   
        FilterHolder holder = new FilterHolder(QoSFilter2.class);
        holder.setInitParameter(QoSFilter.MAX_REQUESTS_INIT_PARAM, ""+MAX_QOS);
        _tester.getContext().getServletHandler().addFilterWithMapping(holder,"/*",Handler.REQUEST);
       
        for(int i = 0; i < NUM_CONNECTIONS; ++i )
        {
            new Thread(new Worker2(i)).start();
View Full Code Here

Examples of org.mortbay.jetty.servlet.FilterHolder

        DebugHandler debug = new DebugHandler();
        debug.setOutputStream(System.err);
        server.setHandler(debug);
       
        Context context = new Context(debug,"/",Context.SESSIONS);
        FilterHolder gzip=context.addFilter(IncludableGzipFilter.class,"/*",0);
        gzip.setInitParameter("uncheckedPrintWriter","true");
        context.addServlet(new ServletHolder(new Dump()), "/*");
       
        server.start();
        server.join();
    }
View Full Code Here

Examples of org.mortbay.jetty.servlet.FilterHolder

        _port=uri.getPort();
       
        _tester.setContextPath("/ctx");
        _tester.addServlet(TestServlet.class, "/*");
       
        FilterHolder dos=_tester.addFilter(DoSFilter2.class,"/dos/*",0);
        dos.setInitParameter("maxRequestsPerSec","4");
        dos.setInitParameter("delayMs","200");
        dos.setInitParameter("throttledRequests","1");
        dos.setInitParameter("waitMs","10");
        dos.setInitParameter("throttleMs","4000");
        dos.setInitParameter("remotePort", "false");
        dos.setInitParameter("insertHeaders", "true");
       
        FilterHolder quickTimeout = _tester.addFilter(DoSFilter2.class,"/timeout/*",0);
        quickTimeout.setInitParameter("maxRequestsPerSec","4");
        quickTimeout.setInitParameter("delayMs","200");
        quickTimeout.setInitParameter("throttledRequests","1");
        quickTimeout.setInitParameter("waitMs","10");
        quickTimeout.setInitParameter("throttleMs","4000");
        quickTimeout.setInitParameter("remotePort", "false");
        quickTimeout.setInitParameter("insertHeaders", "true");
        quickTimeout.setInitParameter("maxRequestMs", _maxRequestMs + "");

        _tester.start();

    }
View Full Code Here

Examples of org.mortbay.jetty.servlet.FilterHolder

       
        //look thru _filters
        itor = LazyList.iterator(_filters);
        while (itor.hasNext())
        {
            FilterHolder holder = (FilterHolder)itor.next();
            Class filter = getWebAppContext().loadClass(holder.getClassName());
            AnnotationParser.parseAnnotations(getWebAppContext(), filter, null, _injections, _callbacks);
        }
       
        //look thru _listeners
        itor = LazyList.iterator(_listeners);
View Full Code Here

Examples of org.mortbay.jetty.servlet.FilterHolder

   * Define a filter for a context and set up default url mappings.
   */
  protected void defineFilter(Context ctx, String name,
      String classname, Map<String,String> parameters, String[] urls) {

    FilterHolder holder = new FilterHolder();
    holder.setName(name);
    holder.setClassName(classname);
    holder.setInitParameters(parameters);
    FilterMapping fmap = new FilterMapping();
    fmap.setPathSpecs(urls);
    fmap.setDispatches(Handler.ALL);
    fmap.setFilterName(name);
    ServletHandler handler = ctx.getServletHandler();
View Full Code Here

Examples of org.mortbay.jetty.servlet.FilterHolder

   * Define a filter for a context and set up default url mappings.
   */
  public static void defineFilter(Context ctx, String name,
      String classname, Map<String,String> parameters, String[] urls) {

    FilterHolder holder = new FilterHolder();
    holder.setName(name);
    holder.setClassName(classname);
    holder.setInitParameters(parameters);
    FilterMapping fmap = new FilterMapping();
    fmap.setPathSpecs(urls);
    fmap.setDispatches(Handler.ALL);
    fmap.setFilterName(name);
    ServletHandler handler = ctx.getServletHandler();
View Full Code Here

Examples of org.mortbay.jetty.servlet.FilterHolder

   * Define a filter for a context and set up default url mappings.
   */
  public void defineFilter(Context ctx, String name,
      String classname, Map<String,String> parameters, String[] urls) {

    FilterHolder holder = new FilterHolder();
    holder.setName(name);
    holder.setClassName(classname);
    holder.setInitParameters(parameters);
    FilterMapping fmap = new FilterMapping();
    fmap.setPathSpecs(urls);
    fmap.setDispatches(Handler.ALL);
    fmap.setFilterName(name);
    ServletHandler handler = ctx.getServletHandler();
View Full Code Here

Examples of org.mortbay.jetty.servlet.FilterHolder

   * Define a filter for a context and set up default url mappings.
   */
  protected void defineFilter(Context ctx, String name, String classname,
      Map<String, String> parameters, String[] urls) {

    FilterHolder holder = new FilterHolder();
    holder.setName(name);
    holder.setClassName(classname);
    holder.setInitParameters(parameters);
    FilterMapping fmap = new FilterMapping();
    fmap.setPathSpecs(urls);
    fmap.setDispatches(Handler.ALL);
    fmap.setFilterName(name);
    ServletHandler handler = ctx.getServletHandler();
View Full Code Here

Examples of org.mortbay.jetty.servlet.FilterHolder

    /* ------------------------------------------------------------ */
    protected void initFilter(XmlParser.Node node)
    {
        String name=node.getString("filter-name",false,true);
        FilterHolder holder= _servletHandler.getFilter(name);
        if (holder==null)
        {
            holder=_servletHandler.newFilterHolder();
            holder.setName(name);
            _filters=LazyList.add(_filters,holder);
        }
       
        String filter_class=node.getString("filter-class",false,true);
        if (filter_class!=null)
            holder.setClassName(filter_class);

        Iterator iter=node.iterator("init-param");
        while(iter.hasNext())
        {
            XmlParser.Node paramNode=(XmlParser.Node)iter.next();
            String pname=paramNode.getString("param-name",false,true);
            String pvalue=paramNode.getString("param-value",false,true);
            holder.setInitParameter(pname, pvalue);
        }
       
    }
View Full Code Here

Examples of org.mortbay.jetty.servlet.FilterHolder

  protected void start() throws Exception {
    server = new Server(0);
    context = new Context();
    context.setContextPath("/foo");
    server.setHandler(context);
    context.addFilter(new FilterHolder(TestFilter.class), "/*", 0);
    context.addServlet(new ServletHolder(TestServlet.class), "/bar");
    host = "localhost";
    ServerSocket ss = new ServerSocket(0);
    port = ss.getLocalPort();
    ss.close();
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.