Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleReference

Refer to section TBD for more information about Registration.

Scope

The scope of a Dynamic Resource is limited to "singleton" as it is initialized prior to its registration, and the system does not have enough information to create it in runtime. This limitation is irrelevant when working with Spring. Refer to chapter ‎0 for more information on Spring integration.

Priorities

Although JAX-RS defines the algorithm for searching for resources and providers, Apache Wink enables to extend this algorithm by allowing the specification of priorities for them.
Apache Wink extends the JAX-RS search algorithms by providing the ability to specify priorities on the resources and providers. This is achieved by enabling the registration of multiple Application instances with different priorities, rendering the order of their registration irrelevant as long as they have different priorities.
In order to register a prioritized Application, it is necessary to register an instance of a Apache WinkApplication class.
Priority values range between 0 and 1. In the event that the priority was not specified, a default priority of 0.5 is used.

Resource Priorities

Priorities on resources are useful for situations where an application registers core resources bound to paths, and allows extensions to register resources on the same paths in order to override the core resources.
The Apache Wink runtime first sorts the resources based on their priority and then based on the JAX-RS specification, thus if two resources have the same path, the one with higher priority is invoked.

Provider Priorities

JAX-RS requires that application-provided providers be used in preference to implementation pre-packaged providers. Apache Wink extends this requirement by allowing applications to specify a priority for providers.
The Apache Wink runtime initially sorts the matching providers according to the JAX-RS specification, and uses the priority as the last sorting key for providers of equal standing.
If two providers have the same priority, the order in which they are registered determines their priority such that the latest addition receives the highest priority.
In order to meet the JAX-RS requirements, the pre-packages providers are registered using a priority of 0.1.

Properties Table

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.
Valid values are: none, atom, atom+html

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

Custom Properties File Definition

In order to provide a custom properties file, the application should define the symphony.propertiesLocation init-param in the Apache Wink Servlet definition.

Code Block
xml
xml
# Providers
<servlet>
  <servlet-name>restSdkService</servlet-name>
  <servlet-class>
    com.hp.symphony.server.internal.servlet.RestServlet
  </servlet-class>
  <init-param>
    <param-name>symphony.propertiesLocation</param-name>
    <param-value>/WEB-INF/configuration.properties</param-value>
  </init-param>
  <init-param>
    <param-name>symphonyApplicationConfigLocation</param-name>
    <param-value>/WEB-INF/application</param-value>
  </init-param>
  <load-on-startup>0</load-on-startup>
</servlet>

Runtime

RegistrationApache Wink provides several APIs for Runtime Registration. The APIs appear in the com.hp.symphony.server.utils.RegistrationUtils class. The most important method is the one that registers an instance of the javax.ws.rs.core.Application class

Code Block
xml
xml
# Providers
static void registerApplication(Application application, ServletContext servletContext)
Info
titleDouble Registration

Registration is ignored and a warning is printed to the log if the instance was previously registered

Media-Type Mapping

It is sometimes necessary to override the Content-Type response header based on the client user agent. For example, the Firefox browser cannot handle the application/atom+xml media type for Atom content, unless it is defined as a text/xml.
Apache Wink provides a set of predefined Media-Type mappings for use in such cases by supplying the MediaTypeMapper class. Applications may extend or override the MediaTypeMapper class to define additional mappings.

Predefined Mapping Table

User Agent

Content Type

Map To

Mozilla/

application/atom+xml    text/xml

text/xml

Mozilla/

application/atomsvc+xml    text/xml

text/xml

Mozilla/

pplication/opensearchdescription+xml

text/xml

Customizing Mappings

In order to customize these mappings the application should create a instance of a com.hp.symphony.server.internal.MediaTypeMapper class and set it on the DeploymentConfiguration instance.

Info
titleReference

Refer to section ‎TBD for more information on Customizing the Default Deployment Configuration.