Package org.mortbay.jetty.servlet

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


        super.setUp();
       
        httpServer = new Server(8191);
       
       
        Context context = new Context(httpServer,"/",Context.SESSIONS);
       
       
       
        ServletHolder servlet = new ServletHolder(new XFireServlet());
       
        context.addServlet(servlet, "/*");
        SecurityHandler sh = new SecurityHandler();
        context.addHandler(sh);
       
        HashUserRealm userRealm = new HashUserRealm();
        userRealm.put("user", "pass");
        userRealm.addUserToRole("user", "role");

        assertNotNull(userRealm.authenticate("user", "pass", null));
       
        sh.setUserRealm(userRealm);
       
        Constraint constraint = new Constraint();
        constraint.setName(Constraint.__BASIC_AUTH);;
        constraint.setRoles(new String[]{"role"});
        constraint.setAuthenticate(true);
       
       
        ConstraintMapping cm = new ConstraintMapping();
        cm.setConstraint(constraint);
        cm.setPathSpec("/*");
       
        context.setAttribute(XFireServlet.XFIRE_INSTANCE, getXFire());
       
        httpServer.start();
       
        service = getServiceFactory().create(Echo.class);
        service.setProperty(ObjectInvoker.SERVICE_IMPL_CLASS, EchoImpl.class);
View Full Code Here


        // Create the server
        server = new Server(8391);
        ServletHandler handler = new ServletHandler ();
       
        Context context = new Context(server,"/",Context.SESSIONS);
       
        ServletHolder servlet = new ServletHolder(new XFireServlet());
        handler.addServlet(servlet);
       
        context.addServlet(servlet, "/*");
       
        context.addFilter("com.planetj.servlet.filter.compression.CompressingFilter", "/*", 0);
       
       
        String home = System.getProperty("jetty.home",".");
        context.setResourceBase(home);
       
        context.setAttribute(XFireServlet.XFIRE_INSTANCE, getXFire());
       
        // Start the http server
        server.start ();
    }
View Full Code Here

        _resolver = new YadisResolver(new HttpFetcherFactory());

        _server = new Server(_servletPort);

        Context context = new Context(_server, "/", Context.SESSIONS);
        context.addServlet(new ServletHolder(new YadisTestServlet()), "/*");

        _server.start();

    }
View Full Code Here

    {
        super(testName);
        int servletPort = Integer.parseInt(System.getProperty("SERVLET_PORT", "8989"));
        _server = new Server(servletPort);

        Context context = new Context(_server, "/", Context.SESSIONS);
        _baseUrl = "http://localhost:" + servletPort; // +
        // context.getContextPath();

        SampleConsumer consumer = new SampleConsumer(_baseUrl + "/loginCallback");
        context.addServlet(new ServletHolder(new LoginServlet(consumer)), "/login");
        context.addServlet(new ServletHolder(new LoginCallbackServlet(consumer)), "/loginCallback");

        context.addServlet(new ServletHolder(new UserInfoServlet()), "/user");

        SampleServer server = new SampleServer(_baseUrl + "/provider")
        {
            protected List userInteraction(ParameterList request) throws ServerException
            {
                List back = new ArrayList();
                back.add("userSelectedClaimedId"); // userSelectedClaimedId
                back.add(Boolean.TRUE); // authenticatedAndApproved
                back.add("user@example.com"); // email
                return back;
            }
        };
        context.addServlet(new ServletHolder(new ProviderServlet(server)), "/provider");
    }
View Full Code Here

  }


  public void start() throws Exception {
    jettyServer = new Server(0);
    Context rootCtx = new Context(jettyServer, context);
    rootCtx.setSessionHandler(new SessionHandler(new HashSessionManager()));
    ServletHolder servletHolder = new ServletHolder(servlet);
    rootCtx.addServlet(servletHolder, servletPath + "/*");
    jettyServer.start();
   
    port = jettyServer.getConnectors()[0].getLocalPort();
  }
View Full Code Here

        SelectChannelConnector connector = new SelectChannelConnector();
        connector.setPort(9966);
        server.addConnector(connector);
       
        Context rootCtx = new Context(server, "");
        ServletHolder servletHolder = new ServletHolder(new ForeverFrameJettyServlet());
        rootCtx.addServlet(servletHolder, "/*");
        server.start();
       
       
    }
View Full Code Here

        int port = org.atmosphere.tests.BaseTest.TestHelper.getEnvVariable("ATMOSPHERE_HTTP_PORT", findFreePort());
        urlTarget = "http://127.0.0.1:" + port + "/invoke";

        server = new Server(port);
        root = new Context(server, "/", Context.SESSIONS);
        atmoServlet = new MeteorServlet();
        atmoServlet.addInitParameter("org.atmosphere.servlet", Meteor1.class.getName());
        configureCometSupport();
        root.addServlet(new ServletHolder(atmoServlet), ROOT);
        server.start();
View Full Code Here

        int port = TestHelper.getEnvVariable("ATMOSPHERE_HTTP_PORT", findFreePort());
        urlTarget = "http://127.0.0.1:" + port + "/invoke";

        server = new Server();
        root = new Context(server, "/", Context.SESSIONS);
        atmoServlet = new AtmosphereServlet();
        configureCometSupport();
        setConnector(port);
        root.addServlet(new ServletHolder(atmoServlet), ROOT);
        server.start();
View Full Code Here

public class Jetty6JerseyTest extends BlockingIOJerseyTest {

    @Override
    public void startServer() throws Exception {
        server = new Server(port);
        root = new Context(server, "/", Context.SESSIONS);
        root.addServlet(new ServletHolder(atmoServlet), ROOT);

        Connector listener = new SelectChannelConnector();

        listener.setHost("127.0.0.1");
View Full Code Here

        int port = BaseTest.TestHelper.getEnvVariable("ATMOSPHERE_HTTP_PORT", findFreePort());
        urlTarget = "http://127.0.0.1:" + port + "/invoke";

        server = new Server(port);
        root = new Context(server, "/", Context.SESSIONS);
        atmoServlet = new MeteorServlet();
        atmoServlet.addInitParameter("org.atmosphere.servlet", Meteor1.class.getName());
        configureCometSupport();
        root.addServlet(new ServletHolder(atmoServlet), ROOT);
        server.start();
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.