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