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