...
Registration and Configuration
Apache Wink provides several methods for registering resources and providers. This chapter describes registration methods and Wink configuration options.
...
The path to a simple application file is configured via the symphony.applicationConfigLocation init-param in the web.xml file. It is possible to specify multiple files by separating them with a semicolon.
Code Block | ||||
---|---|---|---|---|
| ||||
<servlet>
<servlet-name>restSdkService</servlet-name>
<servlet-class>
com.hp.symphony.server.internal.servlet.RestServlet
</servlet-class>
<init-param>
<param-name>symphony.applicationConfigLocation</param-name>
<param-value>/WEB-INF/providers;/WEB-INF/resources</param-value>
</init-param>
</servlet
|
...
A Dynamic Resource is useful for situations where a resource class must be bound to multiple paths, for example, a sorting resource:
Code Block | ||||
---|---|---|---|---|
| ||||
public class SortingResource<E extends Comparable<? super E>> {
private List<E> list;
@POST
public void sort() {
Collections.sort(list);
}
public void setList(List<E> list) {
this.list = list;
}
public List<E> getList() {
return list;
}
}
|
...
In this example, the SortingResource class can sort any list. If the application manages a library of books and exposes the following resource paths, then the SortingResource class can be used for the implementation of all these resource paths, assuming that it could be bound to more than one path.
Code Block | ||||
---|---|---|---|---|
| ||||
/sort-books
/sort-authors
/sort-titles
|
...
Property Name | Description | Default Value | Reference |
---|---|---|---|
wink.http.uri | URI that is used by the Link Builders in case of HTTP | Use the URI from the request | Chapter TBD |
wink.https.uri | URI used by the Link Builders in case of HTTPS | Use the URI from the request | Chapter TBD |
wink.context.uri | Context path used by the Link Builders | Use the context path from the request | Chapter TBD |
wink.defaultUrisRelative | Indicates if URIs generated by the Link Builders are absolute or relative, valid values: true or false | true – - links are relative | Chapter TBD |
wink.addAltParam | Indicates if the "alt" query parameter should be added to URIs generated by the Link Builders. Valid values are: true, false | true – - add the alt query parameter | Chapter TBD |
wink.searchPolicyContinuedSearch | Indicates if continues search is enabled. Valid values: true, false | true – - continued search is enabled | Chapter TBD |
wink.rootResource | ndicates if a root resource with Service Document generation capabilities should be added. | atom+html --atom and html Service Document generation capabilities | Chapter TBD |
wink.serviceDocumentCssPath | Defines path to a css file that is used in the html Service Document generation. Relevant only if html Service Document is defined | No css file defined | Chapter TBD |
...