This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • 5.4 APP Service Document
Skip to end of metadata
Go to start of metadata

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 wink.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

For more information on the @Workspace annotation refer to 5.2 Annotations.

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:

  • org.apache.wink.server.internal.resources.RootResource - generates the XML (application/atomsvc+xml) representation of the APP Service Document.

 org.apache.wink.server.internal.resources. HtmlServiceDocumentResource - generates the HTML (text/html) representation of the APP Service Document.

  • No labels

1 Comment

  1. I have a suggestion, where it reads:

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

    It should read

    Once activated, the auto-generated APP Service Document is available at the application root URL "http://<host>:<port>/<application_context>/<mapped_servlet>" ie http://localhost:8080/yourapp/restSdk/.

    It took me a while to figure out "/application" in the original doc refers to the application path, not the application file.