File tree Expand file tree Collapse file tree 4 files changed +75
-1
lines changed
src/org/opensolaris/opengrok/configuration Expand file tree Collapse file tree 4 files changed +75
-1
lines changed Original file line number Diff line number Diff line change @@ -433,6 +433,9 @@ web.xml of source.war file and change them (see note1) appropriately.
433
433
- The file 'body_include' can be created under DATA_ROOT.
434
434
The contents of this file will be inserted above the footer of the web
435
435
application's "Home" page.
436
+ - The file 'error_forbidden_include' can be created under DATA_ROOT.
437
+ The contents of this file will be displayed as the error page when
438
+ the user is forbidden to see a particular project with HTTP 403 code.
436
439
437
440
438
441
5.4.3 - Path Descriptions (optional)
Original file line number Diff line number Diff line change @@ -1014,6 +1014,30 @@ public String getBodyIncludeFileContent() {
1014
1014
return body ;
1015
1015
}
1016
1016
1017
+ /**
1018
+ * The name of the file relative to the <var>DATA_ROOT</var>, which should
1019
+ * be included into the error page handling access forbidden errors - HTTP
1020
+ * code 403 Forbidden.
1021
+ */
1022
+ public static final String E_FORBIDDEN_INCLUDE_FILE = "error_forbidden_include" ;
1023
+
1024
+ private transient String eforbidden_content = null ;
1025
+
1026
+ /**
1027
+ * Get the contents of the page for forbidden error page (403 Forbidden)
1028
+ * include file.
1029
+ *
1030
+ * @return an empty string if it could not be read successfully, the
1031
+ * contents of the file otherwise.
1032
+ * @see Configuration#E_FORBIDDEN_INCLUDE_FILE
1033
+ */
1034
+ public String getForbiddenIncludeFileContent () {
1035
+ if (eforbidden_content == null ) {
1036
+ eforbidden_content = getFileContent (new File (getDataRoot (), E_FORBIDDEN_INCLUDE_FILE ));
1037
+ }
1038
+ return eforbidden_content ;
1039
+ }
1040
+
1017
1041
/**
1018
1042
* Get the eftar file, which contains definition tags.
1019
1043
*
Original file line number Diff line number Diff line change 127
127
<param-name >keepgenerated</param-name ><param-value >true</param-value >
128
128
</init-param >
129
129
</servlet >
130
+ <servlet >
131
+ <display-name >Forbidden error handler</display-name >
132
+ <servlet-name >eforbidden</servlet-name >
133
+ <jsp-file >/eforbidden.jsp</jsp-file >
134
+ <init-param >
135
+ <param-name >keepgenerated</param-name >
136
+ <param-value >true</param-value >
137
+ </init-param >
138
+ </servlet >
130
139
<servlet-mapping >
131
140
<servlet-name >search</servlet-name >
132
141
<url-pattern >/search</url-pattern > <!-- SEARCH_P -->
179
188
<servlet-name >enoent</servlet-name >
180
189
<url-pattern >/enoent</url-pattern > <!-- NOT_FOUND -->
181
190
</servlet-mapping >
191
+ <servlet-mapping >
192
+ <servlet-name >eforbidden</servlet-name >
193
+ <url-pattern >/eforbidden</url-pattern > <!-- FORBIDDEN -->
194
+ </servlet-mapping >
182
195
<error-page >
183
196
<error-code >404</error-code >
184
197
<location >/enoent</location >
187
200
<error-code >500</error-code >
188
201
<location >/error</location >
189
202
</error-page >
203
+ <error-page >
204
+ <error-code >403</error-code >
205
+ <location >/eforbidden</location >
206
+ </error-page >
190
207
<jsp-config >
191
- <jsp-property-group >
208
+ <jsp-property-group >
192
209
<url-pattern >*.jsp</url-pattern >
193
210
<trim-directive-whitespaces >true</trim-directive-whitespaces >
194
211
</jsp-property-group >
Original file line number Diff line number Diff line change
1
+ <%--
2
+ CDDL HEADER START
3
+
4
+ The contents of this file are subject to the terms of the
5
+ Common Development and Distribution License (the "License").
6
+ You may not use this file except in compliance with the License.
7
+
8
+ See LICENSE.txt included in this distribution for the specific
9
+ language governing permissions and limitations under the License.
10
+
11
+ When distributing Covered Code, include this CDDL HEADER in each
12
+ file and include the License file at LICENSE.txt.
13
+ If applicable, add the following below this CDDL HEADER, with the
14
+ fields enclosed by brackets "[]" replaced with your own identifying
15
+ information: Portions Copyright [yyyy] [name of copyright owner]
16
+
17
+ CDDL HEADER END
18
+
19
+ Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
20
+ --%> <%@page session =" false" isErrorPage =" true" import="
21
+ org.opensolaris.opengrok.web.PageConfig"
22
+ %><%
23
+ /* ---------------------- eforbidden.jspf start --------------------- */
24
+ {
25
+ % >
26
+ <%= PageConfig . get(request). getEnv(). getConfiguration(). getForbiddenIncludeFileContent() % >
27
+ <%
28
+ }
29
+ /* ---------------------- eforbidden.jspf end --------------------- */
30
+ % >
You can’t perform that action at this time.
0 commit comments