|
|
|
@ -600,9 +600,9 @@ public class TomcatEmbeddedServletContainerFactory |
|
|
|
|
|
|
|
|
|
|
|
private static class TomcatErrorPage { |
|
|
|
private static class TomcatErrorPage { |
|
|
|
|
|
|
|
|
|
|
|
private static final String ERROR_PAGE_TOMCAT7 = "org.apache.catalina.deploy.ErrorPage"; |
|
|
|
private static final String ERROR_PAGE_CLASS = "org.apache.tomcat.util.descriptor.web.ErrorPage"; |
|
|
|
|
|
|
|
|
|
|
|
private static final String ERROR_PAGE_TOMCAT = "org.apache.tomcat.util.descriptor.web.ErrorPage"; |
|
|
|
private static final String LEGACY_ERROR_PAGE_CLASS = "org.apache.catalina.deploy.ErrorPage"; |
|
|
|
|
|
|
|
|
|
|
|
private final String location; |
|
|
|
private final String location; |
|
|
|
|
|
|
|
|
|
|
|
@ -622,13 +622,13 @@ public class TomcatEmbeddedServletContainerFactory |
|
|
|
private Object createNativePage(ErrorPage errorPage) { |
|
|
|
private Object createNativePage(ErrorPage errorPage) { |
|
|
|
Object nativePage = null; |
|
|
|
Object nativePage = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (ClassUtils.isPresent(ERROR_PAGE_TOMCAT, null)) { |
|
|
|
if (ClassUtils.isPresent(ERROR_PAGE_CLASS, null)) { |
|
|
|
nativePage = BeanUtils.instantiate(ClassUtils |
|
|
|
nativePage = BeanUtils |
|
|
|
.forName(ERROR_PAGE_TOMCAT, null)); |
|
|
|
.instantiate(ClassUtils.forName(ERROR_PAGE_CLASS, null)); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (ClassUtils.isPresent(ERROR_PAGE_TOMCAT7, null)) { |
|
|
|
else if (ClassUtils.isPresent(LEGACY_ERROR_PAGE_CLASS, null)) { |
|
|
|
nativePage = BeanUtils.instantiate(ClassUtils |
|
|
|
nativePage = BeanUtils.instantiate( |
|
|
|
.forName(ERROR_PAGE_TOMCAT7, null)); |
|
|
|
ClassUtils.forName(LEGACY_ERROR_PAGE_CLASS, null)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (ClassNotFoundException ex) { |
|
|
|
catch (ClassNotFoundException ex) { |
|
|
|
@ -643,7 +643,7 @@ public class TomcatEmbeddedServletContainerFactory |
|
|
|
public void addToContext(Context context) { |
|
|
|
public void addToContext(Context context) { |
|
|
|
Assert.state(this.nativePage != null, |
|
|
|
Assert.state(this.nativePage != null, |
|
|
|
"Neither Tomcat 7 nor 8 detected so no native error page exists"); |
|
|
|
"Neither Tomcat 7 nor 8 detected so no native error page exists"); |
|
|
|
if (ClassUtils.isPresent(ERROR_PAGE_TOMCAT, null)) { |
|
|
|
if (ClassUtils.isPresent(ERROR_PAGE_CLASS, null)) { |
|
|
|
org.apache.tomcat.util.descriptor.web.ErrorPage errorPage = (org.apache.tomcat.util.descriptor.web.ErrorPage) this.nativePage; |
|
|
|
org.apache.tomcat.util.descriptor.web.ErrorPage errorPage = (org.apache.tomcat.util.descriptor.web.ErrorPage) this.nativePage; |
|
|
|
errorPage.setLocation(this.location); |
|
|
|
errorPage.setLocation(this.location); |
|
|
|
errorPage.setErrorCode(this.errorCode); |
|
|
|
errorPage.setErrorCode(this.errorCode); |
|
|
|
|