To provide additional details about how to access the REST
service, you declare a variable in the requester. That variable is
based on the Interface part.
For example, here is a declaration that is based on the Interface
part
WeatherForecast:
myService WeatherForcast {@RESTBinding {baseURI="http://www.ibm.com/gateway"}};
In that declaration, you can specify either of two properties,
each of which gives you a way to specify the following details:
The two properties are @RESTBinding and @BindService.
You can use @RESTBinding to specify the
base URI and session-cookie ID directly in your code; this option
is simple but inflexible. You can use @BindService to
specify those details in a deployment descriptor, and you can make
changes at configuration time.
The two properties are mutually exclusive:
- @RESTBinding
- Use this property to specify, in your code, the base URI in the
code, the session cookie ID, or both. @RESTBinding
includes the following fields:
- baseURI
- A string that identifies the first qualifiers in the URI that
is being used to access the service. The default value of baseURI is
an empty string.
- sessionCookieID
- The name of a session cookie. The default value is JSESSIONID,
which is always the session ID when your application runs on Apache
Tomcat.
If your application runs on IBM WebSphere® Application
Server,
you can override the value that is specified in sessionCookieID by
setting a value for the defaultSessionCookieID build
descriptor option.
- @BindService
- Use this property to use a deployment-descriptor entry to identify
the base URI, the cookie-session-ID, or both. The property has one
field:
- bindingKey
- Identifies the deployment-descriptor entry that includes the two
details.
You can specify
@BindService without
specifying the
bindingKey field, in which
case the property identifies the deployment-descriptor entry that
has the same name as the Interface part. Here is an example of that
usage, which refers to the deployment-descriptor entry named WeatherForecast:
MyService WeatherForecast {@BindService{}}
For
keystroke details about adding a REST binding, see “Adding a REST
binding to the deployment descriptor.”