opensearch.jsp revision 1279
a0f5a5e3c5c6dd29b18bc06fea0d02ae7fc24ac9Mark AndrewsCDDL HEADER START
0cbe448914be61d0f92b1e9d3adaeba87d25639dEvan HuntThe contents of this file are subject to the terms of the
0cbe448914be61d0f92b1e9d3adaeba87d25639dEvan HuntCommon Development and Distribution License (the "License").
0cbe448914be61d0f92b1e9d3adaeba87d25639dEvan HuntYou may not use this file except in compliance with the License.
9dede25430218a1f683dfef36f04ac7cf5bbd9e8Mark AndrewsSee LICENSE.txt included in this distribution for the specific
10f8dc8456ba073fdb2bfc5168d78de574debeeeMark Andrewslanguage governing permissions and limitations under the License.
88699327de812fdd5beeb68b06ea45000fca2175Mark AndrewsWhen distributing Covered Code, include this CDDL HEADER in each
53a70bef3508acb1517b8eb57f61a81280c11509Mark Andrewsfile and include the License file at LICENSE.txt.
d3600bb89d32a7e0d943691d3cad5c569ef6158dMark AndrewsIf applicable, add the following below this CDDL HEADER, with the
d3600bb89d32a7e0d943691d3cad5c569ef6158dMark Andrewsfields enclosed by brackets "[]" replaced with your own identifying
d3600bb89d32a7e0d943691d3cad5c569ef6158dMark Andrewsinformation: Portions Copyright [yyyy] [name of copyright owner]
7472cd350fe9245553e9da7f2df8e7e364d136abMukund SivaramanCDDL HEADER END
7472cd350fe9245553e9da7f2df8e7e364d136abMukund SivaramanCopyright 2009 Sun Microsystems, Inc. All rights reserved.
7472cd350fe9245553e9da7f2df8e7e364d136abMukund SivaramanUse is subject to license terms.
049a49c2956dd9cc9b82974e2bbe77c57fcc73dbMark AndrewsPortions Copyright 2011 Jens Elkner.
e2047969decfc0c3fc1a946ccade993cab9c9315Mark Andrews--%><%@page session="false" errorPage="error.jsp" import="
e846f127d64ea690b789efa6e5b4ff9f64cf3235Witold Krecicki /* ---------------------- opensearch.jsp start --------------------- */
28053af04c5121ec234c320e4c76273305816e7aEvan Hunt cfg = PageConfig.get(request);
28053af04c5121ec234c320e4c76273305816e7aEvan Hunt StringBuilder url = new StringBuilder(128);
28053af04c5121ec234c320e4c76273305816e7aEvan Hunt String protocol="http://";
5ac427050fa0e303171133ce3855b284ab4cfbb7Mark Andrews if (request.getProtocol().toUpperCase().startsWith("HTTPS")) protocol="https://";
5ac427050fa0e303171133ce3855b284ab4cfbb7Mark Andrews url.append(protocol).append(request.getServerName());
594d15df254304ef6705a9fc028bcd34328bce42Mark Andrews if (port != 80) {
594d15df254304ef6705a9fc028bcd34328bce42Mark Andrews url.append(':').append(request.getServerPort());
19d80ce5844e00a021643759adcbe27c11b485a0Witold Krecicki port = url.length(); // mark
19d80ce5844e00a021643759adcbe27c11b485a0Witold Krecicki String img = url.append(cfg.getCssDir()).append("/img/icon.png").toString();
19d80ce5844e00a021643759adcbe27c11b485a0Witold Krecicki url.setLength(port); // rewind
dc2a4887c40b1ee361cef51e188b386e19497e01Witold Krecicki /* TODO Bug 11749 ??? */
dc2a4887c40b1ee361cef51e188b386e19497e01Witold Krecicki StringBuilder text = new StringBuilder();
08e36aa5a5c7697a839f83831fccf8fb3f792848Mark Andrews url.append(request.getContextPath()).append(Prefix.SEARCH_P).append('?');
08e36aa5a5c7697a839f83831fccf8fb3f792848Mark Andrews Set<String> projects = cfg.getRequestedProjects();
370c6e0ac1ad6330e5ded66e5636c5c93d2ce3ffEvan Hunt for (String name : projects) {
08e36aa5a5c7697a839f83831fccf8fb3f792848Mark Andrews text.append(name).append(',');
08e36aa5a5c7697a839f83831fccf8fb3f792848Mark Andrews Util.appendQuery(url, "project", name);
f1a2709aad7baa4161fdb6f63edf99b0150af252Evan Hunt if (text.length() != 0) {
f1a2709aad7baa4161fdb6f63edf99b0150af252Evan Hunt%><?xml version="1.0" encoding="UTF-8"?>
402c63495c40b2289de8daee5a396fd392cea080Mark Andrews<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
402c63495c40b2289de8daee5a396fd392cea080Mark Andrews <ShortName>OpenGrok <%= text.toString() %></ShortName>
402c63495c40b2289de8daee5a396fd392cea080Mark Andrews <Description>Search in OpenGrok <%= text.toString() %></Description>
b0ffe328620db4ead7079e8cd26a584f5b947754Mark Andrews <InputEncoding>UTF-8</InputEncoding>
402c63495c40b2289de8daee5a396fd392cea080Mark Andrews <Image height="16" width="16" type="image/png"><%= img %></Image>
402c63495c40b2289de8daee5a396fd392cea080Mark Andrews<%-- <Url type="application/x-suggestions+json" template="suggestionURL"/>--%>
699f790c49d03a9ef3c3234a72d272bb469203e8Evan Hunt <Url template="<%= url.toString() %>&q={searchTerms}" type="text/html"/>
699f790c49d03a9ef3c3234a72d272bb469203e8Evan Hunt</OpenSearchDescription>
66074f152f2a42218e6d54f50d4fa3717940c299Evan Hunt/* ---------------------- opensearch.jsp end --------------------- */