Skip to Content
Java 9: Building Robust Modular Applications
book

Java 9: Building Robust Modular Applications

by Dr. Edward Lavieri, Peter Verhas, Jason Lee
April 2018
Intermediate to advanced content levelIntermediate to advanced
910 pages
33h 21m
English
Packt Publishing
Content preview from Java 9: Building Robust Modular Applications

Adding endpoints to the server

As covered in Chapter 25, Taking Notes with Monumentum, a JAX-RS resource lives in a POJO with certain annotations. To stub out our endpoint class, we can start with this:

    @Path("/") 
    @Produces(MediaType.APPLICATION_JSON) 
    protected class DeskDroidResource { 
    } 

We will also need to register this class with JAX-RS, which we do with this line in startServer():

    config.registerInstances(new DeskDroidResource()); 

Ordinarily, we would pass, say, DeskDroidResource.class, to the ResourceConfig constructor, like we did with JacksonFeature.class. We will be accessing Android resources, and to do that, we're going to need the Service's Context instance. There are a number of resources on the internet that will suggest ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java 9 High Performance

Java 9 High Performance

Mayur Ramgir, Nick Samoylov
Distributed Computing in Java 9

Distributed Computing in Java 9

Raja Malleswara Rao Malleswara Rao Pattamsetti

Publisher Resources

ISBN: 9781788832823Supplemental ContentOtherPurchase LinkErrata Page