Package org.eclipse.jetty.servlet

Examples of org.eclipse.jetty.servlet.DefaultServlet


          context.addServlet(servletHolder,"/db/*");
        }

        // Proxy to media
        {
          ServletHolder servletHolder = new ServletHolder(new DefaultServlet());
          servletHolder.setInitParameter("dirAllowed", "false");
          servletHolder.setInitParameter("gzip", "true");
          servletHolder.setInitParameter("pathInfoOnly", "true");
          servletHolder.setInitParameter("resourceBase", mediaDir.getAbsolutePath());
          context.addServlet(servletHolder,"/media/*");
 
View Full Code Here


        }
       
        /*
         * Add the default jetty servlet
         */
        ServletHolder defaultServlet = new ServletHolder(new DefaultServlet());
        Map<String,String> params = new HashMap<String,String>();
        params.put("dirAllowed", "false");
        params.put("aliases", "true");
        params.put("acceptRanges", "true");
        params.put("welcomeServlets", "false");
View Full Code Here

          context.addServlet(servletHolder,"/db/*");
        }

        // Proxy to media
        {
          ServletHolder servletHolder = new ServletHolder(new DefaultServlet());
          servletHolder.setInitParameter("dirAllowed", "false");
          servletHolder.setInitParameter("gzip", "true");
          servletHolder.setInitParameter("pathInfoOnly", "true");
          servletHolder.setInitParameter("resourceBase", mediaDir.getAbsolutePath());
          context.addServlet(servletHolder,"/media/*");
 
View Full Code Here

            if (resources[0].equals("classpath")) {
                context.setBaseResource(new JettyClassPathResource(getCamelContext().getClassResolver(), resources[1]));
            } else if (resources[0].equals("file")) {
                context.setBaseResource(Resource.newResource(resources[1]));
            }
            DefaultServlet defaultServlet = new DefaultServlet();
            ServletHolder holder = new ServletHolder(defaultServlet);

            // avoid file locking on windows
            // http://stackoverflow.com/questions/184312/how-to-make-jetty-dynamically-load-static-pages
            holder.setInitParameter("useFileMappedBuffer", "false");
View Full Code Here

    private static void startJetty() throws Exception {
        Server server = new Server(3128);
        ServletContextHandler servletContextHandler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
        servletContextHandler.setContextPath("/");
        servletContextHandler.setResourceBase("src/ru/yandex/strictweb/example/www-root/");
        servletContextHandler.addServlet(new ServletHolder(new DefaultServlet()),"/*");

        AjaxService ajaxService = new AjaxService();
        ajaxService.setBeanProvider(new BeanProvider() {
            public Object getBeanInstance(String beanName) {
                try {
View Full Code Here

            if (resources[0].equals("classpath")) {
                context.setBaseResource(new JettyClassPathResource(getCamelContext().getClassResolver(), resources[1]));
            } else if (resources[0].equals("file")) {
                context.setBaseResource(Resource.newResource(resources[1]));
            }
            DefaultServlet defaultServlet = new DefaultServlet();
            ServletHolder holder = new ServletHolder(defaultServlet);

            // avoid file locking on windows
            // http://stackoverflow.com/questions/184312/how-to-make-jetty-dynamically-load-static-pages
            holder.setInitParameter("useFileMappedBuffer", "false");
View Full Code Here

                URL url = this.getCamelContext().getClassResolver().loadResourceAsURL(resources[1]);
                context.setBaseResource(Resource.newResource(url));
            } else if (resources[0].equals("file")) {
                context.setBaseResource(Resource.newResource(resources[1]));
            }
            DefaultServlet defaultServlet = new DefaultServlet();
            ServletHolder holder = new ServletHolder(defaultServlet);

            // avoid file locking on windows
            // http://stackoverflow.com/questions/184312/how-to-make-jetty-dynamically-load-static-pages
            holder.setInitParameter("useFileMappedBuffer", "false");
View Full Code Here

                URL url = this.getCamelContext().getClassResolver().loadResourceAsURL(resources[1]);
                context.setBaseResource(Resource.newResource(url));
            } else if (resources[0].equals("file")) {
                context.setBaseResource(Resource.newResource(resources[1]));
            }
            DefaultServlet defaultServlet = new DefaultServlet();
            ServletHolder holder = new ServletHolder(defaultServlet);

            // avoid file locking on windows
            // http://stackoverflow.com/questions/184312/how-to-make-jetty-dynamically-load-static-pages
            holder.setInitParameter("useFileMappedBuffer", "false");
View Full Code Here

        server.addConnector(connector) ;
        return server ;
    }

    private static void addContent(ServletContextHandler context, String pathSpec, String pages) {
        DefaultServlet staticServlet = new DefaultServlet() ;
        ServletHolder staticContent = new ServletHolder(staticServlet) ;
        staticContent.setInitParameter("resourceBase", pages) ;

        // Note we set GZip to false for static content because the Jetty
        // DefaultServlet has
View Full Code Here

    );
    queries.addFilter(AsyncGzipFilter.class, "/druid/v2/*", null);
    queries.addFilter(GuiceFilter.class, "/status/*", null);

    final ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS);
    root.addServlet(new ServletHolder(new DefaultServlet()), "/*");
    root.addFilter(GuiceFilter.class, "/*", null);

    final HandlerList handlerList = new HandlerList();
    handlerList.setHandlers(new Handler[]{queries, root, new DefaultHandler()});
    server.setHandler(handlerList);
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.servlet.DefaultServlet

Copyright © 2018 www.massapicom. 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.