public void startServer() throws Exception { executeUpgrader(); Authenticator auth = new MyAuthenticator(config); server = HttpServerProvider.provider().createHttpServer( new InetSocketAddress(config.getManagerDetails().getManagerPort()), 50); AjaxState ajaxState = new AjaxStateImpl(); createContext(server, "/", new WebRootHandler()); //$NON-NLS-1$ createContext(server, "/pages/", new PagesHandler(config), auth); //$NON-NLS-1$ createContext(server, "/server/", new ServerHandler(config), auth); //$NON-NLS-1$ createContext(server, "/deploy/", new DeployHandler(config, ajaxState), auth); //$NON-NLS-1$ createContext(server, "/ajax/", new AjaxProgressHandler(ajaxState)); //$NON-NLS-1$ createContext(server, "/upload/", new UploadHandler(config)); //$NON-NLS-1$ server.start(); }
@Override public Archive<?> createAuxiliaryArchive() { JavaArchive arquillianPactConsumer = null; arquillianPactConsumer = ShrinkWrap.create(JavaArchive.class, "arquillian-pact-consumer.jar") // Add Core classes required in container part .addClasses(AbstractConsumerPactTest.class, RemoteConsumerPactTest.class, PactConsumerConfiguration.class, MockProviderConfigCreator.class, PactConsumerConfigurator.class, PactConsumerRemoteExtension.class, PactFilesCommand.class, ConsumerProviderPair.class, PactMismatchesException.class, ConsumerPactRunnerKt.class, HttpHandler.class, HttpServer.class, HttpServerProvider.class, ResolveClassAnnotation.class, StubServer.class, StubServerEnricher.class, HttpsServer.class, HttpContext.class) .addPackages(true, Pact.class.getPackage()) .addAsServiceProvider(RemoteLoadableExtension.class, PactConsumerRemoteExtension.class); arquillianPactConsumer = addSunHttpServer(arquillianPactConsumer); final Properties properties = pactConsumerConfigurationInstance.get().asProperties(); String configuration = toString(properties); arquillianPactConsumer.add(new StringAsset(configuration), "/pact-consumer-configuration.properties"); final JavaArchive[] pactConsumerDeps = Maven.resolver() .resolve("au.com.dius:pact-jvm-consumer_2.11:" + getVersion()) .withTransitivity().as(JavaArchive.class); final JavaArchive merge = merge(arquillianPactConsumer, pactConsumerDeps); return merge; }
public static void httpserverService() throws IOException { HttpServerProvider provider = HttpServerProvider.provider(); HttpServer httpserver =provider.createHttpServer(new InetSocketAddress(6666), 100);//�����˿�6666,��ͬʱ�� ��100������ httpserver.createContext("/yns3_hdfs", new MyHttpHandler()); httpserver.setExecutor(null); httpserver.start(); System.out.println("server started"); }
/** * Create a <code>HttpServer</code> instance which will bind to the * specified {@link java.net.InetSocketAddress} (IP address and port number) * * A maximum backlog can also be specified. This is the maximum number of * queued incoming connections to allow on the listening socket. * Queued TCP connections exceeding this limit may be rejected by the TCP implementation. * The HttpServer is acquired from the currently installed {@link HttpServerProvider} * * @param addr the address to listen on, if <code>null</code> then bind() must be called * to set the address * @param backlog the socket backlog. If this value is less than or equal to zero, * then a system default value is used. * @throws BindException if the server cannot bind to the requested address, * or if the server is already bound. * @throws IOException */ public static HttpServer create ( InetSocketAddress addr, int backlog ) throws IOException { HttpServerProvider provider = HttpServerProvider.provider(); return provider.createHttpServer (addr, backlog); }