jersey and jax-rs RI2 - missing HttpServerFactory

前端 未结 3 893
日久生厌
日久生厌 2021-02-05 23:16

I have a simple project to test JAX-RS services. Yesterday I downloaded jersey-1.7.1 and used com.sun.jersey.api.container.httpserver.HttpServerFactory and com.sun.net.httpserve

3条回答
  •  盖世英雄少女心
    2021-02-06 00:04

    You could use the JdkHttpServerFactory, which is available in the jersey-container-jdk-http-2.0.jar:

    ResourceConfig rc = new ResourceConfig(HelloWorldResource.class);
    HttpServer server = JdkHttpServerFactory.createHttpServer(baseUri, rc);
    

    No need to call server.start()!

提交回复
热议问题