Examples of SocketConnector


Examples of org.mortbay.jetty.bio.SocketConnector

public class StartFullCalendarExamples {

  public static void main(String[] args) throws Exception {
    Server server = new Server();
    SocketConnector connector = new SocketConnector();

    // Set some timeout options to make debugging easier.
    connector.setMaxIdleTime(1000 * 60 * 60);
    connector.setSoLingerTime(-1);
    connector.setPort(8080);
    server.setConnectors(new Connector[] { connector });

    WebAppContext bb = new WebAppContext();
    bb.setServer(server);
    bb.setContextPath("/");
View Full Code Here

Examples of org.mortbay.jetty.bio.SocketConnector

public class Start {

  public static void main(String[] args) throws Exception {
    Server server = new Server();
    SocketConnector connector = new SocketConnector();
   
    // Set some timeout options to make debugging easier.
    connector.setMaxIdleTime(1000 * 60 * 60);
    connector.setSoLingerTime(-1);
    connector.setPort(8080);
    server.setConnectors(new Connector[] { connector });

    WebAppContext bb = new WebAppContext();
    bb.setServer(server);
    bb.setContextPath("/lottery");
View Full Code Here

Examples of org.mortbay.jetty.bio.SocketConnector

        server.setHandler(contexts);

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

        SocketConnector connector = new SocketConnector();
        server.addConnector(connector);
        server.start();

        localPort = connector.getLocalPort();
    }
View Full Code Here

Examples of org.mortbay.jetty.bio.SocketConnector

            // this is only needed on Windows because of the file
            // locking issue as described in JENKINS-12647
            context.setCopyWebDir(true);
        }

        SocketConnector connector = new SocketConnector();
        connector.setHeaderBufferSize(12*1024); // use a bigger buffer as Stapler traces can get pretty large on deeply nested URL

        server.setThreadPool(new ThreadPoolImpl(new ThreadPoolExecutor(10, 10, 10L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),new ThreadFactory() {
            public Thread newThread(Runnable r) {
                Thread t = new Thread(r);
                t.setName("Jetty Thread Pool");
                return t;
            }
        })));
        server.addConnector(connector);
        server.addUserRealm(configureUserRealm());
        server.start();

        localPort = connector.getLocalPort();

        return context.getServletContext();
    }
View Full Code Here

Examples of org.mortbay.jetty.bio.SocketConnector

  }

  static final public void main(String args[]) {
    String port;
    Server server;
    SocketConnector connector;
    CommandLine cmd = null;
    CommandLineParser parser = new PosixParser();
    Options o = new Options();

    BasicConfigurator.configure();

    o.addOption("p", true, "port");
    try {
      cmd = parser.parse(o, args);
    }
    catch (ParseException exp ) {
      System.err.println( "Parsing failed.  Reason: " + exp.getMessage() );
      System.exit(-1);
    }

    port = cmd.getOptionValue("p");
    if(port == null) port = "8083";
    connector = new SocketConnector();
    connector.setPort(new Integer(port));
    connector.setHost("127.0.0.1");
    server = new Server();
    server.addConnector(connector);
    Context root = new Context(server, "/", Context.SESSIONS);
    root.addServlet(new ServletHolder(new JezebelResmon()), "/resmon");
    root.addServlet(new ServletHolder(new JezebelDispatch()), "/dispatch/*");
 
View Full Code Here

Examples of org.mortbay.jetty.bio.SocketConnector

            server = null;
        }
       
        // Create a Jetty server with a simple servlet that returns immediately
        server = new Server();
        SocketConnector connector = new SocketConnector();
        connector.setHost("127.0.0.1");
      
        if (_PORT == 0)
        {
          connector.setPort( 0 );
        }
        else
        {
          connector.setPort( _PORT );
        }
       
        server.addConnector(connector);
        Context context = new Context(server, "", Context.NO_SECURITY | Context.NO_SESSIONS);
        ServletHolder h = new ServletHolder(new HttpServlet() {
            private static final long serialVersionUID = 1L;

            @Override
            protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws IOException {
                resp.setContentType("text/plain");
                resp.setStatus(HttpServletResponse.SC_OK);
                resp.getWriter().write("ok\n");
            }

            @Override
            protected void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws IOException {
                resp.setContentType("text/plain");
                resp.setStatus(HttpServletResponse.SC_OK);
                resp.getWriter().write("ok\n");
            }

        });
        context.addServlet(h, "/ping");
        server.start();
        _PORT = connector.getLocalPort();
        _url = String.format("http://localhost:%d/ping", _PORT);
    }
View Full Code Here

Examples of org.mortbay.jetty.bio.SocketConnector

    public static void main(String[] args)
        throws Exception
    {
        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();
View Full Code Here

Examples of org.mortbay.jetty.bio.SocketConnector

                }
            } else if ("connector".equals(props.value)) {

                if ("http".equals(props.getProperty("type").value)) {

                    AbstractConnector connector = new SocketConnector();
                    setConnectorOptions(connector, props);
                    server.addConnector(connector);

                } else if ("https".equals(props.getProperty("type").value)) {

                    SslSocketConnector connector = new SslSocketConnector();
                    setConnectorOptions(connector, props);

                    if (props.getProperty("keystore") != null) {
                        connector.setKeystore(props.getProperty("keystore").value);
                    }
                    if (props.getProperty("password") != null) {
                        connector.setPassword(props.getProperty("password").value);
                    }
                    if (props.getProperty("key-password") != null) {
                        connector.setKeyPassword(props.getProperty("key-password").value);
                    }
                    if (props.getProperty("client-auth") != null) {
                        if ("need".equals(props.getProperty("client-auth").value)) {
                            connector.setNeedClientAuth(true);
                        } else if ("want".equals(props.getProperty("client-auth").value)) {
                            connector.setWantClientAuth(true);
                        }
                    }

                    server.addConnector(connector);

                } else if ("nio-http".equals(props.getProperty("type").value)) {

                    AbstractConnector connector = new SelectChannelConnector();
                    setConnectorOptions(connector, props);
                    server.addConnector(connector);

                } else if ("nio-https".equals(props.getProperty("type").value)) {

                    SslSelectChannelConnector connector = new SslSelectChannelConnector();
                    setConnectorOptions(connector, props);

                    if (props.getProperty("keystore") != null) {
                        connector.setKeystore(props.getProperty("keystore").value);
                    }
                    if (props.getProperty("password") != null) {
                        connector.setPassword(props.getProperty("password").value);
                    }
                    if (props.getProperty("key-password") != null) {
                        connector.setKeyPassword(props.getProperty("key-password").value);
                    }
                    if (props.getProperty("need-client-auth") != null) {
                        boolean needClientAuth = "true".equalsIgnoreCase(props.getProperty("need-client-auth").value);
                        connector.setNeedClientAuth(needClientAuth);
                    }

                    server.addConnector(connector);

                } else if ("ajp13".equals(props.getProperty("type").value)) {
View Full Code Here

Examples of org.mortbay.jetty.bio.SocketConnector

    entry.addProperty("server", "http://localhost:8888/");
    JsonArray gatewayConfig = new JsonArray();
    gatewayConfig.add(entry);
    final HttpServer client = new HttpServer(new NullStopWatch());
    client.postJson("http://localhost:4224/jstd/gateway", gatewayConfig);
    SocketConnector connector = new SocketConnector();
    connector.setPort(8888);
    org.mortbay.jetty.Server dummy = new org.mortbay.jetty.Server();
    dummy.addConnector(connector);
    Context context = new Context(dummy, "/", Context.SESSIONS);
    DummyServlet servlet = new DummyServlet();
    context.addServlet(new ServletHolder(servlet), "/");
View Full Code Here

Examples of org.mortbay.jetty.bio.SocketConnector

     */
    public Server(int port)
    {
        setServer(this);

        Connector connector=new SocketConnector();
        connector.setPort(port);
        setConnectors(new Connector[]{connector});
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.