Package org.mortbay.jetty.servlet

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


        // Set the location and server
        this.location = "http://" + servername + ":" + port;
        this.server = new Server(port);

        final Context context = new Context(this.server, "/", Context.SESSIONS);
        final DwrServlet servlet = new DwrServlet();
        final ServletHolder servletholder = new ServletHolder(servlet);

        servletholder.setInitParameter("debug", "true");
        servletholder.setInitParameter("activeReverseAjaxEnabled", "true");
        servletholder.setInitParameter("initApplicationScopeCreatorsAtStartup", "true");
        servletholder.setInitParameter("jsonRpcEnabled", "true");
        servletholder.setInitParameter("jsonpEnabled", "true");
        servletholder.setInitParameter("preferDataUrlSchema", "false");
        servletholder.setInitParameter("maxWaitAfterWrite", "-1");
        servletholder.setInitParameter("jsonpEnabled", "true");
        servletholder.setInitParameter("allowScriptTagRemoting", "true");
        servletholder.setInitParameter("crossDomainSessionSecurity", "false");
        servletholder.setInitParameter("overridePath", this.location);
        servletholder.setInitParameter("allowGetForSafariButMakeForgeryEasier", "true");

        context.addServlet(servletholder, "/*");

        try {
            this.server.start();
        } catch (final Exception e) {
            e.printStackTrace();
View Full Code Here


        Server proxy = new Server();
        //SelectChannelConnector connector = new SelectChannelConnector();
        Connector connector = new SocketConnector();
        connector.setPort(8888);
        proxy.addConnector(connector);
        Context context = new Context(proxy,"/",0);
        context.addServlet(new ServletHolder(new AsyncProxyServlet.Transparent("","www.google.com",80)), "/");

        proxy.start();
        proxy.join();
    }
View Full Code Here

                                                    DatabaseDescriptor.getRpcMaxThreads()));
        try
        {
            // see CASSANDRA-1440
            ResponderServlet servlet = new ResponderServlet(responder);
            new Context(server, "/").addServlet(new ServletHolder(servlet), "/*");

            server.start();
        }
        catch (Exception e)
        {
View Full Code Here

    Server server = new Server(port);
    server.setSendServerVersion(false);
    server.setSendDateHeader(false);
    server.setStopAtShutdown(true);
      // set up context
    Context context = new Context(server, "/", Context.SESSIONS);
    context.addServlet(sh, "/*");

    server.start();
    server.join();
  }
View Full Code Here

        try {
            httpServer = new Server(Integer.parseInt(PORT));
            ContextHandlerCollection contexts = new ContextHandlerCollection();
            httpServer.setHandler(contexts);

            Context root = new Context(contexts, "/", Context.SESSIONS);

            CXFNonSpringServlet cxf = new CXFNonSpringServlet();
            ServletHolder servlet = new ServletHolder(cxf);
            servlet.setName("soap");
            servlet.setForcedPath("soap");
            root.addServlet(servlet, "/soap/*");

            httpServer.start();

            Bus bus = cxf.getBus();
            setBus(bus);
View Full Code Here

    // set up Jetty and run the embedded server
    server = new Server(0);
    server.setSendServerVersion(false);
    server.setSendDateHeader(false);
      // set up context
    Context context = new Context(server, "/", Context.SESSIONS);
    context.addServlet(sh, "/*");
    context.addFilter(GzipFilter.class, "/*", 0);
    HttpServerUtil.constrainHttpMethods(context);
      // start the server
    server.start();
      // get the port
    testServletPort = server.getConnectors()[0].getLocalPort();
View Full Code Here

    private Server createServer() throws Exception {
        setCamelServlet(new CamelServlet());

        Server server = new Server();
        Context context = new Context(Context.NO_SECURITY | Context.NO_SESSIONS);

        context.setContextPath("/");
        ServletHolder holder = new ServletHolder();
        holder.setServlet(getCamelServlet());
        context.addServlet(holder, "/*");
        server.setHandler(context);

        server.start();
        return server;
    }
View Full Code Here

    server.setSendServerVersion(false);
    server.setSendDateHeader(false);
    server.setStopAtShutdown(true);
      // set up context
    Context context = new Context(server, "/", Context.SESSIONS);
    context.addServlet(shPojoMap, "/status/cluster");
    context.addServlet(sh, "/*");
    if (authFilter != null) {
      context.addFilter(authFilter, "/*", 1);
    }

    // Load filters from configuration.
    String[] filterClasses = servlet.getConfiguration().getStrings(FILTER_CLASSES,
      ArrayUtils.EMPTY_STRING_ARRAY);
    for (String filter : filterClasses) {
      filter = filter.trim();
      context.addFilter(Class.forName(filter), "/*", 0);
    }

    // Put up info server.
    int port = conf.getInt("hbase.rest.info.port", 8085);
    if (port >= 0) {
View Full Code Here

    ResourceHandler resources = new ResourceHandler();
    URL resource = EndToEndTest.class.getResource("/endtoend");
    resources.setBaseResource(Resource.newResource(resource));
    newServer.addHandler(resources);

    Context context = new Context(newServer, "/", Context.SESSIONS);
    context.addEventListener(new GuiceServletContextListener());

    Map<String, String> initParams = Maps.newHashMap();
    String modules = Joiner.on(":")
        .join(SocialApiGuiceModule.class.getName(),
              SampleModule.class.getName(),
              GadgetAdminModule.class.getName(),
              DefaultGuiceModule.class.getName(),
              PropertiesModule.class.getName(),
              OAuthModule.class.getName(),
              OAuth2Module.class.getName(),
              OAuth2PersistenceModule.class.getName(),
              OAuth2MessageModule.class.getName(),
              OAuth2HandlerModule.class.getName()
             );

    initParams.put(GuiceServletContextListener.MODULES_ATTRIBUTE, modules);
    context.setInitParams(initParams);

    // Attach the gadget rendering servlet
    ServletHolder gadgetServletHolder = new ServletHolder(new GadgetRenderingServlet());
    context.addServlet(gadgetServletHolder, GADGET_BASE);

    // Attach DataServiceServlet, wrapped in a proxy to fake errors
    ServletHolder restServletHolder = new ServletHolder(new ForceErrorServlet(
        new DataServiceServlet()));
    restServletHolder.setInitParameter("handlers", "org.apache.shindig.handlers");
    context.addServlet(restServletHolder, SOCIAL_REST_BASE);
    context.addFilter(AuthenticationServletFilter.class, SOCIAL_REST_BASE, 0);

    // Attach JsonRpcServlet, wrapped in a proxy to fake errors
    ServletHolder rpcServletHolder = new ServletHolder(new ForceErrorServlet(new JsonRpcServlet()));
    rpcServletHolder.setInitParameter("handlers", "org.apache.shindig.handlers");
    context.addServlet(rpcServletHolder, SOCIAL_RPC_BASE);
    context.addFilter(AuthenticationServletFilter.class, SOCIAL_RPC_BASE, 0);
    context.addServlet(rpcServletHolder, GADGET_RPC_BASE);
    context.addFilter(AuthenticationServletFilter.class, GADGET_RPC_BASE, 0);
    context.addServlet(rpcServletHolder, RPC_BASE);
    context.addFilter(AuthenticationServletFilter.class, RPC_BASE, 0);

    // Attach the ConcatProxyServlet - needed for rewritten JS
    ServletHolder concatHolder = new ServletHolder(new ConcatProxyServlet());
    context.addServlet(concatHolder, CONCAT_BASE);

    // Attach the JsServlet - needed for rewritten JS
    ServletHolder jsHolder = new ServletHolder(new JsServlet());
    context.addServlet(jsHolder, JS_BASE);

    // Attach MakeRequestServlet
    ServletHolder makeRequestHolder = new ServletHolder(new MakeRequestServlet());
    context.addServlet(makeRequestHolder, MAKE_REQUEST_BASE);

    // Attach an EchoServlet, used to test proxied rendering
    ServletHolder echoHolder = new ServletHolder(new EchoServlet());
    context.addServlet(echoHolder, "/echo");

    return newServer;
  }
View Full Code Here

    server.setSendServerVersion(false);
    server.setSendDateHeader(false);
    server.setStopAtShutdown(true);

    // set up context
    Context context = new Context(server, "/", Context.SESSIONS);
    context.addServlet(shPojoMap, "/status/cluster");
    context.addServlet(sh, "/*");
    context.addFilter(GzipFilter.class, "/*", 0);
    HttpServerUtil.constrainHttpMethods(context);

    // Put up info server.
    int port = conf.getInt("hbase.rest.info.port", 8085);
    if (port >= 0) {
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.