blob: 48b4f5e115025dffc15330fbb3f64ecfa0765f2d [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Apache Wink : 5.4 APP Service Document</title>
<link rel="stylesheet" href="styles/site.css" type="text/css" />
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
<tr>
<td valign="top" class="pagebody">
<div class="pageheader">
<span class="pagetitle">
Apache Wink : 5.4 APP Service Document
</span>
</div>
<div class="pagesubheading">
This page last changed on Oct 13, 2009 by <font color="#0050B2">michael</font>.
</div>
<h1><a name="5.4APPServiceDocument-APPServiceDocument"></a>APP Service Document</h1>
<p>Apache Wink supports the automatic and manual generation of APP Service Documents by providing an APP data model and set of complementary providers.</p>
<p>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.&nbsp; &nbsp;</p>
<p>The Apache Wink runtime supports the generation of the APP Service Documents in the XML (application/atomsvc+xml) and HTML (text/html) representations.</p>
<h2><a name="5.4APPServiceDocument-EnablingtheAPPServiceDocumentAutoGeneration"></a>Enabling the APP Service Document Auto Generation</h2>
<p>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.</p>
<p>Once activated, the auto-generated APP Service Document is available at the application root URL "<a href="http://host:port/application">http://host:port/application</a>".</p>
<h2><a name="5.4APPServiceDocument-AddingResourcestoAPPServiceDocument"></a>Adding Resources to APP Service Document</h2>
<p>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.</p>
<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Reference</b><br />For more information on the @Workspace annotation refer to <a href="5.2 Annotations.html" title="5.2 Annotations">5.2 Annotations</a>.</td></tr></table></div>
<h3><a name="5.4APPServiceDocument-Example"></a>Example</h3>
<p>Given the following collection resource definition:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">@Workspace(workspaceTitle = <span class="code-quote">"Workspace"</span>, collectionTitle = <span class="code-quote">"Title"</span>)
@Path(<span class="code-quote">"my/service"</span>)
public class ResourceA {
...
}
</pre>
</div></div>
<p>The auto-generated APP Service Document is:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">&lt;service <span class="code-keyword">xmlns:atom</span>=http://www.w3.org/2005/Atom
xmlns=<span class="code-quote">"http://www.w3.org/2007/app"</span>&gt;
<span class="code-tag">&lt;workspace&gt;</span>
<span class="code-tag">&lt;atom:title&gt;</span>Workspace<span class="code-tag">&lt;/atom:title&gt;</span>
<span class="code-tag">&lt;collection href=<span class="code-quote">"my/service"</span>&gt;</span>
<span class="code-tag">&lt;atom:title&gt;</span>Title<span class="code-tag">&lt;/atom:title&gt;</span>
<span class="code-tag">&lt;accept/&gt;</span>
<span class="code-tag">&lt;/collection&gt;</span>
<span class="code-tag">&lt;/workspace&gt;</span>
<span class="code-tag">&lt;/service&gt;</span>
</pre>
</div></div>
<h2><a name="5.4APPServiceDocument-APPServiceDocumentHTMLStyling"></a>APP Service Document HTML Styling</h2>
<p>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.</p>
<h3><a name="5.4APPServiceDocument-Implementation"></a>Implementation</h3>
<p>The following classes implement the APP Service Document support:</p>
<ul>
<li><b>org.apache.wink.server.internal.resources.RootResource</b> &#45; generates the XML (application/atomsvc+xml) representation of the APP Service Document.</li>
</ul>
<p><b>&nbsp;org.apache.wink.server.internal.resources</b>. HtmlServiceDocumentResource - generates the HTML (text/html) representation of the APP Service Document.</p>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="12" background="http://cwiki.apache.org/confluence/images/border/border_bottom.gif"><img src="images/border/spacer.gif" width="1" height="1" border="0"/></td>
</tr>
<tr>
<td align="center"><font color="grey">Document generated by Confluence on Nov 11, 2009 06:57</font></td>
</tr>
</table>
</body>
</html>