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