Client and Server Context Handling
All of the JAX-RPC examples that you have seen so far have treated the client application and the service implementation as independent entities that communicate only by passing information as method arguments and return values. In reality, however, it is often useful for the server to have access to additional context information that is supplied by the environment in which it operates or is propagated from the client on each method call. This section looks at the various types of context information that the JAX-RPC runtime makes available to web service implementations.
The web service implementation classes discussed so far have been
self-contained and have confined themselves to implementing the
methods of the service endpoint interface. Resources that might be
required, such as the list of books known to a book service or the
cover images for those books, have been bundled into the WAR file
along with the implementation class, and accessed at runtime using
the Class
getResource( ) and
getResourceAsStream( ) methods. This technique is
acceptable when all of the resources and configuration information
for a web service are known when the service is packaged, but it does
not allow for
configuration to be performed at deployment time. Web containers typically provide some mechanism that allows configuration of this type to be performed, and the servlet environment includes APIs that allow access to this information at runtime. However, there is ...
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