I want to code a RESTful web service with JAX-RS, and I want publish it on localhost like http://localhost:[port]
. I read the following in this answer:
The Java SE 7 (JSR 336) and the Java SE 8 (JSR 337) specifications don't incorporate the JAX-RS component. However, JAX-RS applications can be published in Java SE environments (using
RuntimeDelegate
) and JAX-RS implementations also may support publication via JAX-WS.
The RuntimeDelegate
is mentioned. How can I use it? If there are good examples on how to achieve it task, please share them with me.
To deploy a JAX-RS application in a Java SE environment, you could use
RuntimeDelegate
and a HTTP server supported by your JAX-RS implementation. A servlet container is not required.The JSR 339 states the following:
Jersey, the JAX-RS reference implementation, supports a range of HTTP servers which you can use to deploy JAX-RS applications in Java SE.
For example, with Grizzly and
RuntimeDelegate
, you can have the following:The application will be available at
http://localhost:8080/greetings
.The following dependencies are required for the example shown above:
Other supported implementations include:
Jersey documentation also describes other deployment alternatives for a Java SE environment without
RuntimeDelegate
.