Package org.mortbay.jetty.servlet

Examples of org.mortbay.jetty.servlet.Context$SContext


    @Test
    public void testContextClose() throws Exception {
        MessageFactory messageFactory = MessageFactory.newInstance();
        int port = FreePortScanner.getFreePort();
        Server jettyServer = new Server(port);
        Context jettyContext = new Context(jettyServer, "/");
        jettyContext.addServlet(new ServletHolder(new EchoServlet()), "/");
        jettyServer.start();
        WebServiceConnection connection = null;
        try {

            StaticApplicationContext appContext = new StaticApplicationContext();
View Full Code Here


    @Test
    public void testContextClose() throws Exception {
        MessageFactory messageFactory = MessageFactory.newInstance();
        int port = FreePortScanner.getFreePort();
        Server jettyServer = new Server(port);
        Context jettyContext = new Context(jettyServer, "/");
        jettyContext.addServlet(new ServletHolder(new EchoServlet()), "/");
        jettyServer.start();
        WebServiceConnection connection = null;
        try {

            StaticApplicationContext appContext = new StaticApplicationContext();
View Full Code Here

    @BeforeClass
    public static void startJetty() throws Exception {
        int port = FreePortScanner.getFreePort();
        url = "http://localhost:" + port;
        jettyServer = new Server(port);
        Context jettyContext = new Context(jettyServer, "/");
        String resourceBase =
                new File(MessageDispatcherServletIntegrationTest.class.getResource("WEB-INF").toURI()).getParent();
        jettyContext.setResourceBase(resourceBase);
        ServletHolder servletHolder = new ServletHolder(new MessageDispatcherServlet());
        servletHolder.setName("sws");
        jettyContext.addServlet(servletHolder, "/");
        jettyServer.start();
    }
View Full Code Here

    }

    protected void createContext( Server server, File repositoryDirectory )
        throws IOException
    {
        Context root = new Context( server, "/", Context.SESSIONS );
        root.setResourceBase( repositoryDirectory.getAbsolutePath() );
        ServletHolder servletHolder = new ServletHolder( new DefaultServlet() );
        root.addServlet( servletHolder, "/*" );
    }
View Full Code Here

        throws Exception
    {
        Server server = new Server( getTestRepositoryPort() );

        String localRepositoryPath = FileTestUtils.getTestOutputDir().toString();
        Context root = new Context( server, "/", Context.SESSIONS );
        root.setResourceBase( localRepositoryPath );
        ServletHolder servletHolder = new ServletHolder( new DefaultServlet() );
        servletHolder.setInitParameter( "gzip", "true" );
        root.addServlet( servletHolder, "/*" );
        addConnectors( server );
        server.start();

        try
        {
View Full Code Here

    {
        Server server = new Server( 0 );

        SecurityHandler sh = createSecurityHandler();

        Context root = new Context( Context.SESSIONS );
        root.setContextPath( "/" );
        root.addHandler( sh );
        root.setResourceBase( localRepositoryPath );
        ServletHolder servletHolder = new ServletHolder( new DefaultServlet() );
        root.addServlet( servletHolder, "/*" );

        server.setHandler( root );
        addConnectors( server );
        return server;
    }
View Full Code Here

    testServletPort = conf.getInt("test.stargate.port", DEFAULT_TEST_PORT);
    server = new Server(testServletPort);
    server.setSendServerVersion(false);
    server.setSendDateHeader(false);
      // set up context
    Context context = new Context(server, "/", Context.SESSIONS);
    context.addServlet(sh, "/*");
      // start the server
    server.start();

    LOG.info("started " + server.getClass().getName() + " on port " +
      testServletPort);
View Full Code Here

  protected void addDefaultApps(ContextHandlerCollection parent,
      final String appDir) throws IOException {
    // set up the context for "/logs/" if "hadoop.log.dir" property is defined.
    String logDir = System.getProperty("hadoop.log.dir");
    if (logDir != null) {
      Context logContext = new Context(parent, "/logs");
      logContext.setResourceBase(logDir);
      logContext.addServlet(DefaultServlet.class, "/");
      defaultContexts.put(logContext, true);
    }
    // set up the context for "/static/*"
    Context staticContext = new Context(parent, "/static");
    staticContext.setResourceBase(appDir + "/static");
    staticContext.addServlet(DefaultServlet.class, "/*");
    defaultContexts.put(staticContext, true);
  }
View Full Code Here

    final String[] USER_FACING_URLS = { "*.html", "*.jsp" };
    defineFilter(webAppContext, name, classname, parameters, USER_FACING_URLS);
    final String[] ALL_URLS = { "/*" };
    for (Map.Entry<Context, Boolean> e : defaultContexts.entrySet()) {
      if (e.getValue()) {
        Context ctx = e.getKey();
        defineFilter(ctx, name, classname, parameters, ALL_URLS);
        LOG.info("Added filter " + name + " (class=" + classname
            + ") to context " + ctx.getDisplayName());
      }
    }
    filterNames.add(name);
  }
View Full Code Here

        System.setProperty( "DEBUG", "" );
        System.setProperty( "org.mortbay.log.class", "org.slf4j.impl.SimpleLogger" );

        server = new Server( PORT );
        Context rootJettyContext = new Context( server, "/", Context.SESSIONS );

        rootJettyContext.setContextPath( "/" );
        rootJettyContext.setAttribute( PlexusConstants.PLEXUS_KEY, getContainer() );

        ServletHandler servletHandler = rootJettyContext.getServletHandler();

        ServletHolder holder = servletHandler.addServletWithMapping( BasicWebDavServlet.class, CONTEXT + "/*" );

        holder.setInitParameter( BasicWebDavServlet.INIT_ROOT_DIRECTORY, serverRepoDir.getAbsolutePath() );
        holder.setInitParameter( BasicWebDavServlet.INIT_USE_INDEX_HTML, "true" );
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.servlet.Context$SContext

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.