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