本文整理汇总了Java中com.sun.net.httpserver.spi.HttpServerProvider类的典型用法代码示例。如果您正苦于以下问题:Java HttpServerProvider类的具体用法?Java HttpServerProvider怎么用?Java HttpServerProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HttpServerProvider类属于com.sun.net.httpserver.spi包,在下文中一共展示了HttpServerProvider类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startServer
import com.sun.net.httpserver.spi.HttpServerProvider; //导入依赖的package包/类
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();
}
示例2: createAuxiliaryArchive
import com.sun.net.httpserver.spi.HttpServerProvider; //导入依赖的package包/类
@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;
}
示例3: httpserverService
import com.sun.net.httpserver.spi.HttpServerProvider; //导入依赖的package包/类
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");
}
示例4: create
import com.sun.net.httpserver.spi.HttpServerProvider; //导入依赖的package包/类
/**
* 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);
}