uCosminexus Application Server, Web Service Development Guide

[Contents][Glossary][Index][Back][Next]

13.2.1 Discovery and dispatch

This subsection describes the discovery and dispatch operations of a Web resource, and also the mapping of the faults and the exception class.

Organization of this subsection
(1) Discovery
(2) Dispatching HTTP messages

(1) Discovery

In the discovery operation, a request class is mapped based on the URL requested in an HTTP request. The example here explains the details on the mapping done when the following URL is requested:

http://example.org/sample/rootA

If you consider sample as the context root, "/rootA" (the underlined part) after the context root indicates the path information. The resource class is mapped based on this path information.

The following is an example of mapping with the path information. Note that the following example uses only the root resource class and not the sub-resource class as the resource class. Also, each root resource class consists of only a resource method.

Figure 13-1 Discovery

[Figure]

Among the deployed root resource classes, the JAX-RS engine calls a root resource class in which the value of the Path annotation is equal to the path information.

The correspondence between the path information and the called root resource class is as follows:

Note that if a sub-resource class has been deployed and the Path annotation value of the corresponding sub-resource locator is equal to the path information, that sub-resource class is called.

(2) Dispatching HTTP messages

The JAX-RS engine calls and executes a resource method depending on the content of the received HTTP message (HTTP Content-Type header) and the acceptable media type (HTTP Accept header). The dispatch operation is executed based on the media types specified in the Consumes and Produces annotations.

Note that if the resource class contains the sub-resource method, the discovery and dispatch operations are concurrently determined.