Added XML format to OpenSearch service

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4811 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2007-01-12 15:08:22 +00:00
parent e0134bb39f
commit d52cf961b6
4 changed files with 9 additions and 1 deletions

View File

@@ -31,7 +31,8 @@ public class APIResponse extends HttpServletResponseWrapper
public static final String HTML_TYPE = "text/html"; public static final String HTML_TYPE = "text/html";
public static final String OPEN_SEARCH_DESCRIPTION_TYPE = "application/opensearchdescription+xml"; public static final String OPEN_SEARCH_DESCRIPTION_TYPE = "application/opensearchdescription+xml";
public static final String ATOM_TYPE = "application/atom+xml"; public static final String ATOM_TYPE = "application/atom+xml";
public static final String XML_TYPE = "text/xml";
/** /**
* Construct * Construct

View File

@@ -162,6 +162,11 @@ public class TextSearch extends APIServiceImpl
contentType = APIResponse.ATOM_TYPE; contentType = APIResponse.ATOM_TYPE;
template = ATOM_TEMPLATE; template = ATOM_TEMPLATE;
} }
else if (format.equals("xml"))
{
contentType = APIResponse.XML_TYPE;
template = ATOM_TEMPLATE;
}
} }
Map<String, Object> model = createTemplateModel(req, res); Map<String, Object> model = createTemplateModel(req, res);

View File

@@ -68,6 +68,7 @@ public class TextSearchDescription extends APIServiceImpl
" <LongName>Alfresco ${agent.edition} Text Search ${agent.version}</LongName>\n" + " <LongName>Alfresco ${agent.edition} Text Search ${agent.version}</LongName>\n" +
" <Description>Search Alfresco \"company home\" using text keywords</Description>\n" + " <Description>Search Alfresco \"company home\" using text keywords</Description>\n" +
" <Url type=\"application/atom+xml\" template=\"${request.servicePath}/search/text?q={searchTerms}&amp;p={startPage?}&amp;c={count?}&amp;l={language?}&amp;guest={alf:guest?}&amp;format=atom\"/>\n" + " <Url type=\"application/atom+xml\" template=\"${request.servicePath}/search/text?q={searchTerms}&amp;p={startPage?}&amp;c={count?}&amp;l={language?}&amp;guest={alf:guest?}&amp;format=atom\"/>\n" +
" <Url type=\"text/xml\" template=\"${request.servicePath}/search/text?q={searchTerms}&amp;p={startPage?}&amp;c={count?}&amp;l={language?}&amp;guest={alf:guest?}&amp;format=xml\"/>\n" +
" <Url type=\"text/html\" template=\"${request.servicePath}/search/text?q={searchTerms}&amp;p={startPage?}&amp;c={count?}&amp;l={language?}&amp;guest={alf:guest?}\"/>\n" + " <Url type=\"text/html\" template=\"${request.servicePath}/search/text?q={searchTerms}&amp;p={startPage?}&amp;c={count?}&amp;l={language?}&amp;guest={alf:guest?}\"/>\n" +
" <Image height=\"16\" width=\"16\" type=\"image/x-icon\">${request.path}/images/logo/AlfrescoLogo16.ico</Image>\n" + " <Image height=\"16\" width=\"16\" type=\"image/x-icon\">${request.path}/images/logo/AlfrescoLogo16.ico</Image>\n" +
"</OpenSearchDescription>"; "</OpenSearchDescription>";

View File

@@ -12,6 +12,7 @@
<br> <br>
<ul> <ul>
<li><a href="/alfresco/service/search/text?q=alfresco tutorial&format=atom">Search for 'alfresco tutorial' (ATOM response)</a></li> <li><a href="/alfresco/service/search/text?q=alfresco tutorial&format=atom">Search for 'alfresco tutorial' (ATOM response)</a></li>
<li><a href="/alfresco/service/search/text?q=alfresco tutorial&format=xml">Search for 'alfresco tutorial' (XML response)</a></li>
<li><a href="/alfresco/service/search/text?q=alfresco tutorial">Search for 'alfresco tutorial' (HTML response)</a></li> <li><a href="/alfresco/service/search/text?q=alfresco tutorial">Search for 'alfresco tutorial' (HTML response)</a></li>
<ul> <ul>
</body> </body>