opensearch.jsp revision 14a41f02433890d19b2f871156271e3388cd0845
229N/A<%--
229N/A$Id$
229N/A
229N/ACDDL HEADER START
229N/A
229N/AThe contents of this file are subject to the terms of the
229N/ACommon Development and Distribution License (the "License").
229N/AYou may not use this file except in compliance with the License.
229N/A
229N/ASee LICENSE.txt included in this distribution for the specific
229N/Alanguage governing permissions and limitations under the License.
229N/A
229N/AWhen distributing Covered Code, include this CDDL HEADER in each
229N/Afile and include the License file at LICENSE.txt.
229N/AIf applicable, add the following below this CDDL HEADER, with the
229N/Afields enclosed by brackets "[]" replaced with your own identifying
229N/Ainformation: Portions Copyright [yyyy] [name of copyright owner]
229N/A
229N/ACDDL HEADER END
229N/A
229N/ACopyright 2009 Sun Microsystems, Inc. All rights reserved.
229N/AUse is subject to license terms.
229N/A
229N/APortions Copyright 2011 Jens Elkner.
229N/A
229N/A--%><%@page session="false" errorPage="error.jsp" import="
229N/Ajava.util.Set,
229N/A
229N/Aorg.opensolaris.opengrok.web.Util"
229N/A%><%@
229N/A
229N/Ainclude file="pageconfig.jspf"
229N/A
229N/A%><%@
229N/A
229N/Ainclude file="projects.jspf"
229N/A
229N/A%><%
229N/A /* ---------------------- opensearch.jsp start --------------------- */
229N/A{
229N/A cfg = PageConfig.get(request);
229N/A
229N/A StringBuilder url = new StringBuilder(128);
229N/A url.append("http://").append(request.getServerName());
229N/A int port = request.getServerPort();
229N/A if (port != 80) {
229N/A url.append(':').append(request.getServerPort());
229N/A }
229N/A port = url.length(); // mark
229N/A String img = url.append(cfg.getCssDir()).append("/img/icon.png").toString();
229N/A url.setLength(port); // rewind
229N/A
229N/A /* TODO Bug 11749 ??? */
229N/A StringBuilder text = new StringBuilder();
229N/A url.append(request.getContextPath()).append(Prefix.SEARCH_P).append('?');
229N/A Set<String> projects = cfg.getRequestedProjects();
229N/A for (String name : projects) {
229N/A text.append(name).append(',');
229N/A 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() %>q={searchTerms}" type="text/html"/>
</OpenSearchDescription>
<%
}
/* ---------------------- opensearch.jsp end --------------------- */
%>