This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 50342e5c8056983765be0082d58882c8d05138cc Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Feb 15 19:28:12 2023 +0000 Follow-up to fix for BZ 66429 - include custom error page --- webapps/docs/WEB-INF/jsp/403.jsp | 44 ++++++++++++++++++++++++++++++++++++ webapps/docs/WEB-INF/web.xml | 8 ++++++- webapps/examples/WEB-INF/jsp/403.jsp | 44 ++++++++++++++++++++++++++++++++++++ webapps/examples/WEB-INF/web.xml | 5 ++++ 4 files changed, 100 insertions(+), 1 deletion(-) diff --git a/webapps/docs/WEB-INF/jsp/403.jsp b/webapps/docs/WEB-INF/jsp/403.jsp new file mode 100644 index 0000000000..e2dee6d21d --- /dev/null +++ b/webapps/docs/WEB-INF/jsp/403.jsp @@ -0,0 +1,44 @@ +<%-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--%> +<%@ page session="false" trimDirectiveWhitespaces="true" %> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <title>403 Access Denied</title> + <style type="text/css"> + <!-- + BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;font-size:12px;} + H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} + PRE, TT {border: 1px dotted #525D76} + A {color : black;}A.name {color : black;} + --> + </style> + </head> + <body> + <h1>403 Access Denied</h1> + <p> + You are not authorized to view this page. + </p> + <p> + By default the documentation web application is only accessible from a browser + running on the same machine as Tomcat. If you wish to modify this + restriction, you'll need to edit the documentation web applications's + <tt>context.xml</tt> file. + </p> + </body> + +</html> diff --git a/webapps/docs/WEB-INF/web.xml b/webapps/docs/WEB-INF/web.xml index 8920ccd756..33ae3c0dd2 100644 --- a/webapps/docs/WEB-INF/web.xml +++ b/webapps/docs/WEB-INF/web.xml @@ -26,4 +26,10 @@ <description> Tomcat Documentation. </description> -</web-app> + + <error-page> + <error-code>403</error-code> + <location>/WEB-INF/jsp/403.jsp</location> + </error-page> + +</web-app> \ No newline at end of file diff --git a/webapps/examples/WEB-INF/jsp/403.jsp b/webapps/examples/WEB-INF/jsp/403.jsp new file mode 100644 index 0000000000..406f7543f1 --- /dev/null +++ b/webapps/examples/WEB-INF/jsp/403.jsp @@ -0,0 +1,44 @@ +<%-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--%> +<%@ page session="false" trimDirectiveWhitespaces="true" %> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <title>403 Access Denied</title> + <style type="text/css"> + <!-- + BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;font-size:12px;} + H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} + PRE, TT {border: 1px dotted #525D76} + A {color : black;}A.name {color : black;} + --> + </style> + </head> + <body> + <h1>403 Access Denied</h1> + <p> + You are not authorized to view this page. + </p> + <p> + By default the examples web application is only accessible from a browser + running on the same machine as Tomcat. If you wish to modify this + restriction, you'll need to edit the example web application's + <tt>context.xml</tt> file. + </p> + </body> + +</html> diff --git a/webapps/examples/WEB-INF/web.xml b/webapps/examples/WEB-INF/web.xml index ff394c0566..a40e084f21 100644 --- a/webapps/examples/WEB-INF/web.xml +++ b/webapps/examples/WEB-INF/web.xml @@ -415,4 +415,9 @@ <listener-class>websocket.drawboard.DrawboardContextListener</listener-class> </listener> + <error-page> + <error-code>403</error-code> + <location>/WEB-INF/jsp/403.jsp</location> + </error-page> + </web-app> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org