Package org.mortbay.jetty.webapp

Examples of org.mortbay.jetty.webapp.WebAppContext


    shardServer.setMaxRecordsPerRowFetchRequest(configuration.getInt(BLUR_MAX_RECORDS_PER_ROW_FETCH_REQUEST, 1000));
    shardServer.init();

    Iface iface = BlurUtil.recordMethodCallsAndAverageTimes(shardServer, Iface.class, false);
    if (httpServer != null) {
      WebAppContext context = httpServer.getContext();
      context.addServlet(new ServletHolder(new TServlet(new Blur.Processor<Blur.Iface>(iface),
          new TJSONProtocol.Factory())), "/blur");
      context.addServlet(new ServletHolder(new JSONReporterServlet()), "/livemetrics");
      if (enableJsonReporter) {
        JSONReporter.enable("json-reporter", 1, TimeUnit.SECONDS, 60);
      }
    }
View Full Code Here


    System.setProperty("baseGuiShardPort", baseGuiShardPort + "");
    System.setProperty("baseGuiControllerPort", baseGuiControllerPort + "");
    System.setProperty("blur.gui.mode", base);
    LOG.info("System props:" + System.getProperties().toString());

    context = new WebAppContext();
    String warPath = getWarFolder();
    context.setWar(warPath);
    context.setContextPath("/");
    context.setParentLoaderPriority(true);
    // context.addServlet(new ServletHolder(new LiveMetricsServlet()),
View Full Code Here

        JettyHTTPDestination jhd = (JettyHTTPDestination) si.getDestination();
        JettyHTTPServerEngine e = (JettyHTTPServerEngine) jhd.getEngine();
        org.mortbay.jetty.Server jettyServer = e.getServer();

        Handler[] contexts = jettyServer.getChildHandlersByClass(WebAppContext.class);
        WebAppContext servletContext = null;
        for (Handler h : contexts) {
            WebAppContext wac = (WebAppContext) h;
            if (wac.getContextPath().equals("/jsunit")) {
                servletContext = wac;
                break;
            }
        }
        servletContext.addServlet("org.mortbay.jetty.servlet.DefaultServlet", "/bloop");
View Full Code Here

            }

            List<Handler> handlers = new ArrayList<Handler>();
            for ( WebApp w : webApps )
            {
                WebAppContext webapp = new WebAppContext();
                webapp.setWar( w.getWarFile() );
                webapp.setContextPath( w.getContextPath() );
                handlers.add( webapp );

                webapp.setParentLoaderPriority( true );
            }

            // add web apps from the webapps directory inside directory service's working directory
            // the exploded or archived wars
            File webAppDir = new File( dirService.getInstanceLayout().getInstanceDirectory(), "webapps" );

            FilenameFilter webAppFilter = new FilenameFilter()
            {

                public boolean accept( File dir, String name )
                {
                    return name.endsWith( ".war" );
                }
            };

            if ( webAppDir.exists() )
            {
                File[] appList = webAppDir.listFiles( webAppFilter );
                for ( File app : appList )
                {
                    WebAppContext webapp = new WebAppContext();
                    webapp.setWar( app.getAbsolutePath() );
                    String ctxName = app.getName();
                    int pos = ctxName.indexOf( '.' );
                    if ( pos > 0 )
                    {
                        ctxName = ctxName.substring( 0, pos );
                    }

                    webapp.setContextPath( "/" + ctxName );
                    handlers.add( webapp );

                    webapp.setParentLoaderPriority( true );
                }
            }

            jetty.setHandlers( handlers.toArray( new Handler[handlers.size()] ) );
View Full Code Here

                        String mountPoint = webappInfo.mountPoint;
                        if (mountPoint.endsWith("/*")) {
                            mountPoint = mountPoint.substring(0, mountPoint.lastIndexOf("/"));
                        }

                        WebAppContext context = new WebAppContext(location, mountPoint);
                        context.setAttribute("_serverId", webappInfo.server);
                        context.setLogUrlOnStart(true);

                         // set the session manager
                        HashSessionManager sm = new HashSessionManager();
                        context.setSessionHandler(new SessionHandler(sm));

                        // set the virtual hosts
                        if (virtualHosts != null && !virtualHosts.isEmpty()) {
                            context.setVirtualHosts((String[]) virtualHosts.toArray());
                        }

                        // set the init parameters
                        if (initParameters != null && !initParameters.isEmpty()) {
                            context.setInitParams(initParameters);
                        }

                        server.addHandler(context);
                    }
                }
View Full Code Here

        realm.addUserToRole( "longuser", "allowed" );

        sh.setUserRealm( realm );
        sh.setConstraintMappings( new ConstraintMapping[]{ cm } );

        WebAppContext ctx = new WebAppContext();
        ctx.setContextPath( "/" );

        File base = getBase();
        ctx.setWar( base.getAbsolutePath() );
        ctx.addHandler( sh );

        ctx.getServletHandler().addServletWithMapping( TimingServlet.class, "/slow/*" );
        ctx.getServletHandler().addServletWithMapping( InfiniteRedirectionServlet.class, "/redirect-trap/*" );

        SessionHandler sessionHandler = ctx.getSessionHandler();
        ( (AbstractSessionManager) sessionHandler.getSessionManager() ).setUsingCookies( false );

        HandlerCollection handlers = new HandlerCollection();
        handlers.setHandlers( new Handler[]{ ctx, new DefaultHandler() } );

View Full Code Here

        JettyHTTPDestination jhd = (JettyHTTPDestination) si.getDestination();
        JettyHTTPServerEngine e = (JettyHTTPServerEngine) jhd.getEngine();
        org.mortbay.jetty.Server jettyServer = e.getServer();

        Handler[] contexts = jettyServer.getChildHandlersByClass(WebAppContext.class);
        WebAppContext servletContext = null;
        for (Handler h : contexts) {
            WebAppContext wac = (WebAppContext) h;
            if (wac.getContextPath().equals("/jsunit")) {
                servletContext = wac;
                break;
            }
        }
        servletContext.addServlet("org.mortbay.jetty.servlet.DefaultServlet", "/bloop");
View Full Code Here

            securityHandler.init(policyContextID, defaultPrincipal, checkedPermissions, excludedPermissions, classLoader);
        }

        ServletHandler servletHandler = new ServletHandler();

        webAppContext = new WebAppContext(securityHandler, sessionHandler, servletHandler, null);

        //wrap the web app context with the jndi handler
        GeronimoUserTransaction userTransaction = new GeronimoUserTransaction(transactionManager);
        this.componentContext = EnterpriseNamingContext.createEnterpriseNamingContext(componentContext, userTransaction, kernel, classLoader);
        contextHandler = new ComponentContextHandler(webAppContext, this.componentContext);
View Full Code Here

        "false");
    try {
      System.setProperty("org.mortbay.xml.XmlParser.Validating", "false");
      WebXmlConfiguration wxc = new WebXmlConfiguration();
      ServletHandler myServletHandler = new ServletHandler();
      wxc.setWebAppContext(new WebAppContext(null, null, myServletHandler, null));
      wxc.configure(webXmlUrlString);
      ServletMapping[] mappings = myServletHandler.getServletMappings();
      ServletHolder[] servlets = myServletHandler.getServlets();
      Map<String, String> servletNameToClassName = new HashMap<String, String>();
      Map<String, Set<String>> classNameToPaths = new HashMap<String, Set<String>>();
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    @Override
    protected WebAppContext createWebAppContext(TreeLogger logger,
        File appRootDir) {
      return new WebAppContext(appRootDir.getAbsolutePath(), "/") {
        {
          // Prevent file locking on Windows; pick up file changes.
          getInitParams().put(
              "org.mortbay.jetty.servlet.Default.useFileMappedBuffer", "false");

View Full Code Here

TOP

Related Classes of org.mortbay.jetty.webapp.WebAppContext

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.