uCosminexus Application Server, Web Service Development Guide

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

11.4.3 Setting properties and features

The Client object contains a changeable property map that stores properties and features.

Hereafter, the term property is used collectively for both, property and features.

Organization of this subsection
(1) Initializing the property map
(2) Structure of a changeable property map

(1) Initializing the property map

A changeable property map is initialized when creating a Client object. You can use any of the following methods to initialize a property:

Method 1
Create a Client object by specifying the DefaultClientConfig object in the parameter and then call the create (ClientConfig cc) static method of the Client class. Here, the changeable property map of the Client object is initialized# by the property contained in the DefaultClientConfig object.
#
If the DefaultClientConfig object contains a property, the changeable property map is initialized with the value of that property. If the DefaultClientConfig object is without a property, the changeable property map is initialized with the settings mentioned in the action definition file.
[Figure]

Method 2
Create a Client object by using the create() static method of the Client class. Here, a changeable property map of the client object is initialized by the action definition file.
[Figure]

For details on an action definition file, see 13.1 Action definition file.

(2) Structure of a changeable property map

With the four properties related to the HttpURLConnection class, you can change the property map acquired with the getProperties() method of the Client class, and set the property map by using the setter method corresponding to each property.

Only the four properties related to HttpURLConnection have corresponding setter methods. When setting a property, change the property map acquired with the getProperties() method of the Client class.

The following figure shows the structure of a changeable property map.

For the list of supported properties, see 25.1.1 Supported properties and features.

Figure 11-3 Structure of a changeable property map

[Figure]

Prior to the HTTP communication, the JAX-RS engine directly copies the values of the four properties related to the HttpURLConnection class, shown in the figure, to HttpURLConnection (however, does not verify the values). If the values are invalid, the HttpURLConnection class might throw an exception before or during the HTTP communication. When the values specified are null, those are not copied and are ignored.

The ClientRequest class also contains a changeable property map of the same format. For this reason, when establishing an HTTP communication by using the handle() method of the Client class, a user program can also set the property through the ClientRequest object. The following figure shows the mechanism.

Figure 11-4 Mechanism of copying the changeable property map

[Figure]

The JAX-RS engine copies the property included in the property map of the ClientRequest object to the property map of the client object only when the property map of the Client object does not contain the same property.