You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

APP Service Document

Apache Wink supports the automatic and manual generation of APP Service Documents by providing an APP data model and set of complementary providers.

Atom Publishing Protocol Service Documents are designed to support the auto-discovery of services. APP Service Documents represent server-defined groups of Collections used to initialize the process of creating and editing resources. These groups of collections are called Workspaces. The Service Document can indicate which media types and categories a collection accepts.   

The Apache Wink runtime supports the generation of the APP Service Documents in the XML (application/atomsvc+xml) and HTML (text/html) representations.

Enabling the APP Service Document Auto Generation

APP Service Document generation is activated by setting the symphony.rootResource key in the configuration properties file. By default, the key value is set to "atom+html", indicating that both XML (application/atomsvc+xml) and HTML (text/html) representations are available.

Once activated, the auto-generated APP Service Document is available at the application root URL "http://host:port/application".

Adding Resources to APP Service Document

Apache Wink provides the @Workspace annotation used to associate a Collection Resource with an APP Service Document workspace and collection elements. The only requirement to incorporate a collection resource in a service document is to place the @Workspace annotation on the resource.

Reference

Refer to chapter 7 TBD, section ‎7.1 for more information on the @Workspace annotation.

Example

Given the following collection resource definition:

@Workspace(workspaceTitle = "Workspace", collectionTitle = "Title")
@Path("my/service")
public class ResourceA {
    ...
}

The auto-generated APP Service Document is:

<service xmlns:atom=http://www.w3.org/2005/Atom
         xmlns="http://www.w3.org/2007/app">
  <workspace>
    <atom:title>Workspace</atom:title>
    <collection href="my/service">
      <atom:title>Title</atom:title>
      <accept/>
    </collection>
  </workspace>
</service>

APP Service Document HTML Styling

Apache Wink provides the ability to change the default styling of the APP Service Document HTML representation. The styling is changed by setting the value of the wink.serviceDocumentCssPath key in the configuration properties file to the application specific CSS file location.

Implementation

The following classes implement the APP Service Document support:

  • com.hp.symphony.server.internal.resources.RootResource - generates the XML (application/atomsvc+xml) representation of the APP Service Document.

 com.hp.symphony.server.internal.resources. HtmlServiceDocumentResource - generates the HTML (text/html) representation of the APP Service Document.

  • No labels