Simplest Possible REST Endpoint

The following GET-request:


invokes the method whatever:


public class MessageResource {
    public String whatever() {
        return "hey, duke!";

from a WAR with th name hello-rest and configured application path:


public class JAXRSConfiguration extends Application {}

You only need a single dependency to compile the sample:


  1. No further configuration is required
  2. No XML is involved (web.xml is not needed)
  3. The size of the hello-rest.war is 3.2 kB
  4. Deployment takes milliseconds
Optional speedup: Java EE 7 essential archetype would create an empty maven project for you.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home:

NEW MUC Airport Workshop: Migrating Java Client (Swing / Java FX) to Web Standards

Airport MUC workshops: Web (SPA, PWAs, Offline, Desktop, Mobile) Applications Essentials and Effective Web Applications. No migrations. #usetheplatform

Podcast: and newsletter:

A book about rethinking Java EE Patterns


Post a Comment:
  • HTML Syntax: NOT allowed
Online Workshops
...the last 150 posts
...the last 10 comments