[Jersey] Integrating jersey with nanoHTTPD

From: Daniel Santos <>
Date: Wed, 18 May 2016 09:52:54 +0100


I am trying to pass HTTP requests from a nano HTTP web server to a Jersey
ApplicationHandler. The way I create the application handler is shown below

ResourceConfig app = new ResourceConfig();
ApplicationHandler newHandler = new ApplicationHandler(app);

Where instances is an array of POJO's annotated with the jersey annotations
representing resources.

On each request received by the webserver I am calling the following code :

ContainerRequest request = new ContainerRequest(new URI(contextPath),
new URI(relativePath), session.getMethod().toString(), secContext,
Future<ContainerResponse> responseFuture = handler.apply(request);
ContainerResponse response = responseFuture.get();
Object entity = response.getEntity();

This code always results in a NotFound. I have stepped into it and can see
that the only routings available are for the application.wadl urls

What am I missing ?