What’s Next?
RESTful services are rich enough to warrant two dedicated chapters. Accordingly, the next chapter focuses on the service side by exploring options for implementing and publishing RESTful services. The web service APIs include:
-
HttpServletand its equivalents (e.g., JSP scripts) - JAX-RS, which has various implementations
- Restlet, which is similar in style to JAX-RS
-
JAX-WS
@WebServiceProvider, which is a relatively low-level API
Web services using any of these APIs can be published with a production-grade web server such as Tomcat or Jetty; there are even command-line options for such publication, although these options vary significantly in ease of use. There are trade-offs among the APIs, and the next chapter highlights the pluses and minuses of each API.
The servlet approach represents a base-level API in that servlets have been a part of Java
since the late 1990s, and they remain the foundation for websites written in Java. The servlet API is close to the HTTP metal in that, for example,
an HttpServletRequest is a thin but likewise convenient wrapper around an HTTP request; in similar fashion, an HttpServletResponse
is a thin and equally convenient wrapper around an HTTP response. At the same time, servlets provide high-level filtering of HTTP requests,
and a data structure such as the HttpServletRequest collapses the distinction between the key/value pairs in a query string of a GET or DELETE request and the key/value pairs in the body of a POST or PUT request. ...
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.
Read now
Unlock full access