Chapter 33. Embedded Containers

Resteasy has a few different plugins for different embedabble HTTP and/or Servlet containers if use Resteasy in
a test environment, or within an environment where you do not want a Servlet engine dependency.

33.1. Sun JDK HTTP Server

The Sun JDK comes with a simple HTTP server implementation (com.sun.net.httpserver.HttpServer) which you
can run Resteasy on top of.

Create your HttpServer the way you want then use the org.jboss.resteasy.plugins.server.sun.http.HttpContextBuilder to initialize Resteasy
and bind it to an HttpContext. The HttpContext attributes are available by injecting in a org.jboss.resteasy.spi.ResteasyConfiguration
interface using @Context within your provider and resource classes.

From the distribution, move the jars in resteasy-jaxrs.war/WEB-INF/lib into your classpath. You must both programmatically register your JAX-RS beans using the embedded server's Registry. Here's an example:

The server can either host non-encrypted or SSL based resources, but not both. See the Javadoc for TJWSEmbeddedJaxrsServer as well as its superclass TJWSServletServer. The TJWS website is also a good place for information.

If you want to use Spring, see the SpringBeanProcessor. Here's a pseudo-code example