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