Java - Rest

Java Conceptuel Diagram


Web Service - Representational State Transfer (REST|RESTful) Web services in Java


  • Jax Rs is an annotated Rest specification



When testing a Rest API (ie when writing a unit test), there is two approach:

  • you create a context object to emulate an incoming request
  • or you start an embedded server and use a client to make http request


public class ServerClientTest {

    private HttpServer server;
    private WebTarget target;

    public void setUp() throws Exception {
        server = Main.startServer();

        Client c = ClientBuilder.newClient();
        target =;

    public void tearDown() throws Exception {

     * Test to see that the message "Got it!" is sent in the response.
    public void testGetIt() {
        String responseMsg = target.path("myresource").request().get(String.class);
        assertEquals("Got it!", responseMsg);


See Javadoc for JaxRs


Discover More
Java Conceptuel Diagram
Java - API for RESTful Web Services (JAX-RS)

is a rest specification. The most known implementation is jaxDoclet...
Java Conceptuel Diagram
Java - Jersey (Rest Framework)

Eclipse Jersey is a REST framework that provides a JAX-RS (JSR-370) implementation and more Java Jersey redirects to
Java Conceptuel Diagram

is a JBoss project that provides various frameworks to help you build RESTful Web Services and RESTful Java applications. It is a fully certified and portable implementation of the JAX-RS 2.0 specification,...
Java Conceptuel Diagram
Vert.x - Rest / Jax-RS

with vertx Many wrapper libraries (Rest, CDI, ...) use a thread-local context so that the user-code method can look them up when executed. In the case of RESTEasy, the context holds this information:...
Web Service - Representational State Transfer (REST|RESTful) Web services

Representational State Transfer (REST) Web services, or “RESTful” Web services describes any simple interface that transmits data over a standardized interface (such as HTTP) without an additional...

Share this page:
Follow us:
Task Runner