@@ -18,7 +18,7 @@ information: Portions Copyright [yyyy] [name of copyright owner]
18
18
19
19
CDDL HEADER END
20
20
21
- Copyright (c) 2009, 2022 , Oracle and/or its affiliates. All rights reserved.
21
+ Copyright (c) 2009, 2025 , Oracle and/or its affiliates. All rights reserved.
22
22
Portions Copyright 2011 Jens Elkner.
23
23
Portions Copyright (c) 2018, 2020, Chris Fraire <[email protected] >.
24
24
@@ -45,21 +45,16 @@ include file="/projects.jspf"
45
45
46
46
// Optimize for URLs up to 128 characters.
47
47
StringBuilder url = new StringBuilder (128 );
48
- String scheme = request. getScheme();
49
- int port = request. getServerPort();
50
-
48
+ final String scheme = request. getScheme();
51
49
url. append(scheme). append(" ://" );
52
-
53
- String serverName = cfg. getServerName();
54
- url. append(serverName);
50
+ url. append(cfg. getServerName());
55
51
56
52
// Append port if needed.
53
+ int port = request. getServerPort();
57
54
if ((port != 80 && scheme. equals(" http" )) || (port != 443 && scheme. equals(" https" ))) {
58
55
url. append(' :' ). append(port);
59
56
}
60
57
61
- String imgUrl = url + cfg. getCssDir() + " /img/icon.png" ;
62
-
63
58
/* TODO Bug 11749 ??? */
64
59
StringBuilder text = new StringBuilder ();
65
60
url. append(request. getContextPath()). append(Prefix . SEARCH_P ). append(' ?' );
@@ -68,15 +63,15 @@ include file="/projects.jspf"
68
63
text. append(name). append(' ,' );
69
64
Util . appendQuery(url, QueryParameters . PROJECT_SEARCH_PARAM , name);
70
65
}
71
- if (text. length() != 0 ) {
72
- text. setLength(text. length()- 1 );
66
+ if (! text. isEmpty() ) {
67
+ text. setLength(text. length() - 1 );
73
68
}
74
69
% > <?xml version =" 1.0" encoding =" UTF-8" ?>
75
70
<OpenSearchDescription xmlns =" http://a9.com/-/spec/opensearch/1.1/" >
76
71
<ShortName >OpenGrok <%= text. toString() % > </ShortName >
77
72
<Description >Search in OpenGrok <%= text. toString() % > </Description >
78
73
<InputEncoding >UTF-8</InputEncoding >
79
- <Image height =" 16" width =" 16" type =" image/png" ><%= imgUrl % > </Image >
74
+ <Image height =" 16" width =" 16" type =" image/png" ><%= url + cfg . getCssDir() + " /img/icon.png " % > </Image >
80
75
<%-- <Url type="application/x-suggestions+json" template="suggestionURL"/>--%>
81
76
<Url template =" <%= url. toString() % >& ; <%= QueryParameters . FULL_SEARCH_PARAM_EQ % > {searchTerms}"
82
77
type =" text/html" />
0 commit comments