Package org.mortbay.jetty.servlet

Examples of org.mortbay.jetty.servlet.WebApplicationContext


   * @param servletClass The servlet class
   */
  public <T extends HttpServlet>
  void addServlet(String name, String pathSpec,
                  Class<T> servletClass) {
    WebApplicationContext context = webAppContext;
    try {
      if (name == null) {
        context.addServlet(pathSpec, servletClass.getName());
      } else {
        context.addServlet(name, pathSpec, servletClass.getName());
      }
    } catch (ClassNotFoundException ex) {
      throw makeRuntimeException("Problem instantiating class", ex);
    } catch (InstantiationException ex) {
      throw makeRuntimeException("Problem instantiating class", ex);
View Full Code Here


        if (webContextDir == null) webContextDir = appDir + "/WEB-INF/railo";
        if (adminContextDir == null) adminContextDir = appDir + "/WEB-INF/lib/railo-server";
        System.out.println("appdir:" + appDir);
        System.out.println("webcontext:" + webContextDir);
        System.out.println("servercontext:" + adminContextDir);
        WebApplicationContext context = new WebApplicationContext(appDir);
        context.setContextPath(strContext);

      if ( host != null && !host.isEmpty() )
          context.addVirtualHost(host);

        server.addContext(context);
        appDir += path;
        context.addHandler(new ResourceHandler());
    }
View Full Code Here

            server.addListener(socketListener);

            NCSARequestLog log = new NCSARequestLog();
            server.setRequestLog(log);

            WebApplicationContext context = server.addWebApplication(_contextPath, warPath);

            context.setDefaultsDescriptor(webDefaults);

            server.start();

            return server;
        }
View Full Code Here

            File warPath = new File(_warPath);
            if (!warPath.exists()) {
                _warPath = new File("tapestry-framework", _warPath).getPath();
            }
           
            WebApplicationContext context = server.addWebApplication(_contextPath, _warPath);
           
            File descPath = new File(DEFAULTS_DESCRIPTOR);
            String descriptorPath = descPath.getPath();
           
            if (!descPath.exists()) {
                descriptorPath = new File("tapestry-framework", DEFAULTS_DESCRIPTOR).getPath();
            }
           
            context.setDefaultsDescriptor(descriptorPath);

            server.start();

            return server;
        }
View Full Code Here

   */
  public <T extends HttpServlet>
   void addServlet(String name, String pathSpec,
                   Class<T> servletClass) {
  
    WebApplicationContext context = webAppContext;
    try {
      if (name == null) {
        context.addServlet(pathSpec, servletClass.getName());
      } else {
        context.addServlet(name, pathSpec, servletClass.getName());
      }
    } catch (ClassNotFoundException ex) {
      throw makeRuntimeException("Problem instantiating class", ex);
    } catch (InstantiationException ex) {
      throw makeRuntimeException("Problem instantiating class", ex);
View Full Code Here

        server = new Server();
        SocketListener listener = new SocketListener();
        listener.setPort(port);
        server.addListener(listener);

        WebApplicationContext context = new WebApplicationContext(pathToWebApp);
        context.setContextPath("/");

        // This will load classes from primordial classloader first.
        // Avoids having to copy classes into WEB-INF/classes when running from the IDE.
        context.setClassLoaderJava2Compliant(true);

        server.addContext(null, context);
    }
View Full Code Here

                            if (!location.endsWith("/")) {
                                location = location + "/";
                            }

                            // load the application
                            WebApplicationContext ctx = server.addWebApplication(appInfo.mountPoint, location);
                            ctx.setAttribute("_serverId", appInfo.server);

                            // set the session manager
                            SessionManager sm = new HashSessionManager();
                            ctx.getWebApplicationHandler().setSessionManager(sm);
                           
                            // set the virtual hosts
                            Iterator vh = virtualHosts.iterator();
                            while (vh.hasNext()) {
                                ctx.addVirtualHost((String)vh.next());
                            }

                            // set the init parameters
                            Iterator ip = initParameters.keySet().iterator();
                            while (ip.hasNext()) {
                                String paramName = (String) ip.next();
                                ctx.setInitParameter(paramName, (String) initParameters.get(paramName));
                            }

                        } catch (IOException e) {
                            Debug.logError(e, "Problem mounting application [" + appInfo.name + " / " + appInfo.location + "]", module);
                        }
View Full Code Here

            }

            NCSARequestLog log = new NCSARequestLog();
            server.setRequestLog(log);

            WebApplicationContext context = server.addWebApplication(contextPath, warPath);

            context.setDefaultsDescriptor(webDefaults);

            server.start();

            return server;
        }
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.servlet.WebApplicationContext

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.