This article describes how to create a simple rest web service without using a web container (stand alone).It uses the Java BuiltIn HttpServer and JAX-RS.

Used technologies

JDK 1.8
Maven 3.2
Maven dependencies: jersey 1.18.4

1. pom.xml


2. Resource: HelloWorld

package com.wstutorial.rest;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

public class HelloWorldResource {
	public String message() {
		return "hello World! ";

3. Rest Starter

package com.wstutorial.rest;

import com.sun.jersey.api.container.httpserver.HttpServerFactory;
import com.sun.net.httpserver.HttpServer;

public class StartRestServer {
	public static void main(String[] args) {
		HttpServer server;
		try {
			server = HttpServerFactory.create( "http://localhost:10080/api" );
		}catch (Exception e) {
			System.out.println("Errormessage : " + e.getMessage());


4. Call the url


5. Show the WADL

Hit the url: http://localhost:10080/api/application.wadl
Since Jersey 2.5.1 the WADL generated by default is WADL in shorter form without additional extension resources (OPTIONS methods, WADL resource). In order to get full WADL use the query parameter detail=true


  • Jersey wadl