opensearch.jsp revision 59b6a8c0cc6ef741a7180504b3c371e67c2aa338
32N/A<%--
32N/A$Id$
1339N/A
32N/ACDDL HEADER START
32N/A
919N/AThe contents of this file are subject to the terms of the
919N/ACommon Development and Distribution License (the "License").
919N/AYou may not use this file except in compliance with the License.
919N/A
919N/ASee LICENSE.txt included in this distribution for the specific
919N/Alanguage governing permissions and limitations under the License.
919N/A
919N/AWhen distributing Covered Code, include this CDDL HEADER in each
919N/Afile and include the License file at LICENSE.txt.
919N/AIf applicable, add the following below this CDDL HEADER, with the
919N/Afields enclosed by brackets "[]" replaced with your own identifying
919N/Ainformation: Portions Copyright [yyyy] [name of copyright owner]
919N/A
919N/ACDDL HEADER END
919N/A
919N/ACopyright 2009 Sun Microsystems, Inc. All rights reserved.
919N/AUse is subject to license terms.
32N/A
32N/APortions Copyright 2011 Jens Elkner.
32N/A
32N/A--%><%@page session="false" errorPage="error.jsp" import="
493N/Ajava.util.Set,
32N/A
32N/Aorg.opensolaris.opengrok.web.Util"
1276N/A%><%@
32N/A
911N/Ainclude file="pageconfig.jspf"
1276N/A
1276N/A%><%@
1276N/A
911N/Ainclude file="projects.jspf"
32N/A
32N/A%><%
32N/A /* ---------------------- opensearch.jsp start --------------------- */
1339N/A{
1339N/A cfg = PageConfig.get(request);
1339N/A
32N/A StringBuilder url = new StringBuilder(128);
32N/A String scheme=request.getScheme();
url.append(scheme).append("://").append(request.getServerName());
int port = request.getServerPort();
if ((port != 80 && scheme.equals("http")) ||
(port != 443 && scheme.equals("https"))) {
url.append(':').append(port);
}
port = url.length(); // mark
String img = url.append(cfg.getCssDir()).append("/img/icon.png").toString();
url.setLength(port); // rewind
/* TODO Bug 11749 ??? */
StringBuilder text = new StringBuilder();
url.append(request.getContextPath()).append(Prefix.SEARCH_P).append('?');
Set<String> projects = cfg.getRequestedProjects();
for (String name : projects) {
text.append(name).append(',');
Util.appendQuery(url, "project", name);
}
if (text.length() != 0) {
text.setLength(text.length()-1);
}
%><?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>OpenGrok <%= text.toString() %></ShortName>
<Description>Search in OpenGrok <%= text.toString() %></Description>
<InputEncoding>UTF-8</InputEncoding>
<Image height="16" width="16" type="image/png"><%= img %></Image>
<%-- <Url type="application/x-suggestions+json" template="suggestionURL"/>--%>
<Url template="<%= url.toString() %>&amp;q={searchTerms}" type="text/html"/>
</OpenSearchDescription>
<%
}
/* ---------------------- opensearch.jsp end --------------------- */
%>