blob: a887d28614e732c2bebe5a43e3c8f3214eef4ef4 [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 : 7.7 OpenSearch</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 : 7.7 OpenSearch
</span>
</div>
<div class="pagesubheading">
This page last changed on Oct 14, 2009 by <font color="#0050B2">michael</font>.
</div>
<h2><a name="7.7OpenSearch-OpenSearchOverview"></a>OpenSearch Overview</h2>
<p>OpenSearch is a collection of simple formats for the sharing of search results.<br/>
The OpenSearch description document format is used to describe a search engine that can be used by search client applications.</p>
<p>The OpenSearch response elements can be used to extend existing syndication formats, such as RSS and Atom, with the extra metadata needed to return search results. The OpenSearch document is associated with the "application/opensearchdescription+xml" mime type.</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>Note</b><br />For more detailed information about Open Search, refers to the Open Search home page at <a href="http://www.opensearch.org/Home">http://www.opensearch.org/Home</a></td></tr></table></div>
<h3><a name="7.7OpenSearch-DataModel"></a>Data Model</h3>
<p>Apache Wink provides an Open Search data model for producing Open Search Documents. of the model classes are located under the org.apache.wink.common.model.opensearch package. OpenSearchDescription class is used by an application to build Open Search Description documents.</p>
<h4><a name="7.7OpenSearch-OpenSearchSupport"></a>OpenSearch Support</h4>
<p>The following table shows the OpenSearch data model and representation in which it can be serialized and de-serialized.</p>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>&nbsp;</th>
<th class='confluenceTh'> Supported </th>
<th class='confluenceTh'> Media Types <br clear="all" /> </th>
<th class='confluenceTh'> Data Model <br clear="all" /> </th>
<th class='confluenceTh'> Provider registration <br clear="all" /> </th>
</tr>
<tr>
<td class='confluenceTd'> Read <br clear="all" /> </td>
<td class='confluenceTd'> Yes <br clear="all" /> </td>
<td class='confluenceTd'> NA <br clear="all" /> </td>
<td class='confluenceTd'> NA </td>
<td class='confluenceTd'> NA <br clear="all" /> </td>
</tr>
<tr>
<td class='confluenceTd'> Write <br clear="all" /> </td>
<td class='confluenceTd'> Yes </td>
<td class='confluenceTd'> application/ <br clear="all" />
opensearchdescription+xml <br clear="all" /> </td>
<td class='confluenceTd'> org.apache.wink <br clear="all" />
.common.model<br clear="all" />
.opensearch<br clear="all" />
.OpenSearchDescription </td>
<td class='confluenceTd'> Not required. Registered by default <br clear="all" /> </td>
</tr>
</tbody></table>
<h3><a name="7.7OpenSearch-ProducinganOpenSearchDocumentExample"></a>Producing an OpenSearch Document Example</h3>
<p>The following example demonstrates the creation of an OpenSearch document.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java"> @GET
@Produces(MediaTypeUtils.OPENSEARCH)
<span class="code-keyword">public</span> OpenSearchDescription getOpenSearch(@Context UriInfo info) {
<span class="code-object">String</span> baseUri = info.getAbsolutePath().toString();
OpenSearchDescription openSearchDescription = <span class="code-keyword">new</span> OpenSearchDescription();
openSearchDescription.setShortName(<span class="code-quote">"Example search engine"</span>);
...
<span class="code-keyword">return</span> openSearchDescription;
}
</pre>
</div></div>
<h5><a name="7.7OpenSearch-"></a></h5>
</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>