opensearch.jsp revision 1186
812N/A<%--
812N/A$Id$
812N/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
812N/APortions Copyright 2011 Jens Elkner.
812N/A
830N/A--%><%@page session="false" errorPage="error.jsp" import="
812N/Ajava.util.Set,
812N/A
812N/Aorg.opensolaris.opengrok.web.Util"
812N/A%><%@
812N/A
812N/Ainclude file="pageconfig.jspf"
812N/A
812N/A%><%@
812N/A
812N/Ainclude file="projects.jspf"
812N/A
812N/A%><%
812N/A /* ---------------------- opensearch.jsp start --------------------- */
812N/A{
896N/A cfg = PageConfig.get(request);
850N/A
896N/A StringBuilder url = new StringBuilder(128);
896N/A url.append("http://").append(request.getServerName());
905N/A int port = request.getServerPort();
905N/A if (port != 80) {
905N/A url.append(':').append(request.getServerPort());
905N/A }
905N/A port = url.length(); // mark
905N/A String img = url.append(cfg.getCssDir()).append("/img/icon.png").toString();
905N/A url.setLength(port); // rewind
905N/A
896N/A /* TODO Bug 11749 ??? */
850N/A StringBuilder text = new StringBuilder();
896N/A url.append(request.getContextPath()).append(Prefix.SEARCH_P).append('?');
896N/A Set<String> projects = cfg.getRequestedProjects();
905N/A for (String name : projects) {
830N/A text.append(name).append(',');
830N/A Util.appendQuery(url, "project", name);
905N/A }
905N/A if (text.length() != 0) {
905N/A text.setLength(text.length()-1);
812N/A }
812N/A%><?xml version="1.0" encoding="UTF-8"?>
830N/A<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
830N/A <ShortName>OpenGrok <%= text.toString() %></ShortName>
812N/A <Description>Search in OpenGrok <%= text.toString() %></Description>
812N/A <InputEncoding>UTF-8</InputEncoding>
812N/A <Image height="16" width="16" type="image/png"><%= img %></Image>
830N/A<%-- <Url type="application/x-suggestions+json" template="suggestionURL"/>--%>
812N/A <Url template="<%= url.toString() %>q={searchTerms}" type="text/html"/>
</OpenSearchDescription>
<%
}
/* ---------------------- opensearch.jsp end --------------------- */
%>