Following the instructions here I have this code:
private static URI getBaseURI() { return UriBuilder.fromUri("http://localhost/").port(9998).build(); } public static final URI BASE_URI = getBaseURI(); protected static HttpServer startServer() throws IOException { System.out.println("Starting grizzly..."); final ResourceConfig rc = new PackagesResourceConfig("amplify.api.resources"); return GrizzlyServerFactory.createHttpServer(BASE_URI, rc); } public static void main(final String[] args) throws IOException { final HttpServer httpServer = startServer(); System.out.println(String.format("Jersey app started with WADL available at " + "%sapplication.wadl\nTry out %shelloworld\nHit enter to stop it...", BASE_URI, BASE_URI)); System.in.read(); httpServer.stop(); }
Next, I want to enable JSON POJO support, as described here , but the problem is that I want to do this programmatically, and not through the .xml web interface (I do not have the web.xml file!).
How to change the code above to enable the JSON POJO mapping function?
source share