polishing
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1837 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
317022ee8e
commit
cf81f04056
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2008 the original author or authors.
|
* Copyright 2002-2009 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -22,7 +22,6 @@ import org.quartz.spi.TriggerFiredBundle;
|
||||||
import org.springframework.beans.BeanWrapper;
|
import org.springframework.beans.BeanWrapper;
|
||||||
import org.springframework.beans.MutablePropertyValues;
|
import org.springframework.beans.MutablePropertyValues;
|
||||||
import org.springframework.beans.PropertyAccessorFactory;
|
import org.springframework.beans.PropertyAccessorFactory;
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subclass of {@link AdaptableJobFactory} that also supports Spring-style
|
* Subclass of {@link AdaptableJobFactory} that also supports Spring-style
|
||||||
|
|
@ -68,8 +67,8 @@ public class SpringBeanJobFactory extends AdaptableJobFactory implements Schedul
|
||||||
* from the scheduler context, job data map and trigger data map.
|
* from the scheduler context, job data map and trigger data map.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Object createJobInstance(TriggerFiredBundle bundle) {
|
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
|
||||||
Object job = BeanUtils.instantiateClass(bundle.getJobDetail().getJobClass());
|
Object job = bundle.getJobDetail().getJobClass().newInstance();
|
||||||
BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(job);
|
BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(job);
|
||||||
if (isEligibleForPropertyPopulation(bw.getWrappedInstance())) {
|
if (isEligibleForPropertyPopulation(bw.getWrappedInstance())) {
|
||||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||||
|
|
@ -79,8 +78,7 @@ public class SpringBeanJobFactory extends AdaptableJobFactory implements Schedul
|
||||||
pvs.addPropertyValues(bundle.getJobDetail().getJobDataMap());
|
pvs.addPropertyValues(bundle.getJobDetail().getJobDataMap());
|
||||||
pvs.addPropertyValues(bundle.getTrigger().getJobDataMap());
|
pvs.addPropertyValues(bundle.getTrigger().getJobDataMap());
|
||||||
if (this.ignoredUnknownProperties != null) {
|
if (this.ignoredUnknownProperties != null) {
|
||||||
for (int i = 0; i < this.ignoredUnknownProperties.length; i++) {
|
for (String propName : this.ignoredUnknownProperties) {
|
||||||
String propName = this.ignoredUnknownProperties[i];
|
|
||||||
if (pvs.contains(propName) && !bw.isWritableProperty(propName)) {
|
if (pvs.contains(propName) && !bw.isWritableProperty(propName)) {
|
||||||
pvs.removePropertyValue(propName);
|
pvs.removePropertyValue(propName);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2008 the original author or authors.
|
* Copyright 2002-2009 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -84,7 +84,7 @@ public class MessageSourceResourceBundle extends ResourceBundle {
|
||||||
* not allow for enumerating the defined message codes.
|
* not allow for enumerating the defined message codes.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Enumeration getKeys() {
|
public Enumeration<String> getKeys() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,18 @@ import java.lang.reflect.Array;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Miscellaneous object utility methods. Mainly for internal use within the
|
* Miscellaneous object utility methods.
|
||||||
* framework; consider Jakarta's Commons Lang for a more comprehensive suite
|
*
|
||||||
* of object utilities.
|
* <p>Mainly for internal use within the framework; consider
|
||||||
|
* <a href="http://jakarta.apache.org/commons/lang/">Jakarta's Commons Lang</a>
|
||||||
|
* for a more comprehensive suite of object utilities.
|
||||||
|
*
|
||||||
|
* <p>Thanks to Alex Ruiz for contributing several enhancements to this class!
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @author Keith Donald
|
* @author Keith Donald
|
||||||
* @author Rod Johnson
|
* @author Rod Johnson
|
||||||
* @author Rob Harrop
|
* @author Rob Harrop
|
||||||
* @author Alex Ruiz
|
|
||||||
* @since 19.03.2004
|
* @since 19.03.2004
|
||||||
* @see org.apache.commons.lang.ObjectUtils
|
* @see org.apache.commons.lang.ObjectUtils
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -269,9 +269,11 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
/** List of ViewResolvers used by this servlet */
|
/** List of ViewResolvers used by this servlet */
|
||||||
private List<ViewResolver> viewResolvers;
|
private List<ViewResolver> viewResolvers;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether to detect all HandlerMapping beans in this servlet's context. Else, just a single bean with name
|
* Set whether to detect all HandlerMapping beans in this servlet's context. Otherwise,
|
||||||
* "handlerMapping" will be expected. <p>Default is "true". Turn this off if you want this servlet to use a single
|
* just a single bean with name "handlerMapping" will be expected.
|
||||||
|
* <p>Default is "true". Turn this off if you want this servlet to use a single
|
||||||
* HandlerMapping, despite multiple HandlerMapping beans being defined in the context.
|
* HandlerMapping, despite multiple HandlerMapping beans being defined in the context.
|
||||||
*/
|
*/
|
||||||
public void setDetectAllHandlerMappings(boolean detectAllHandlerMappings) {
|
public void setDetectAllHandlerMappings(boolean detectAllHandlerMappings) {
|
||||||
|
|
@ -279,8 +281,9 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether to detect all HandlerAdapter beans in this servlet's context. Else, just a single bean with name
|
* Set whether to detect all HandlerAdapter beans in this servlet's context. Otherwise,
|
||||||
* "handlerAdapter" will be expected. <p>Default is "true". Turn this off if you want this servlet to use a single
|
* just a single bean with name "handlerAdapter" will be expected.
|
||||||
|
* <p>Default is "true". Turn this off if you want this servlet to use a single
|
||||||
* HandlerAdapter, despite multiple HandlerAdapter beans being defined in the context.
|
* HandlerAdapter, despite multiple HandlerAdapter beans being defined in the context.
|
||||||
*/
|
*/
|
||||||
public void setDetectAllHandlerAdapters(boolean detectAllHandlerAdapters) {
|
public void setDetectAllHandlerAdapters(boolean detectAllHandlerAdapters) {
|
||||||
|
|
@ -288,18 +291,19 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether to detect all HandlerExceptionResolver beans in this servlet's context. Else, just a single bean with
|
* Set whether to detect all HandlerExceptionResolver beans in this servlet's context. Otherwise,
|
||||||
* name "handlerExceptionResolver" will be expected. <p>Default is "true". Turn this off if you want this servlet to
|
* just a single bean with name "handlerExceptionResolver" will be expected.
|
||||||
* use a single HandlerExceptionResolver, despite multiple HandlerExceptionResolver beans being defined in the
|
* <p>Default is "true". Turn this off if you want this servlet to use a single
|
||||||
* context.
|
* HandlerExceptionResolver, despite multiple HandlerExceptionResolver beans being defined in the context.
|
||||||
*/
|
*/
|
||||||
public void setDetectAllHandlerExceptionResolvers(boolean detectAllHandlerExceptionResolvers) {
|
public void setDetectAllHandlerExceptionResolvers(boolean detectAllHandlerExceptionResolvers) {
|
||||||
this.detectAllHandlerExceptionResolvers = detectAllHandlerExceptionResolvers;
|
this.detectAllHandlerExceptionResolvers = detectAllHandlerExceptionResolvers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether to detect all ViewResolver beans in this servlet's context. Else, just a single bean with name
|
* Set whether to detect all ViewResolver beans in this servlet's context. Otherwise,
|
||||||
* "viewResolver" will be expected. <p>Default is "true". Turn this off if you want this servlet to use a single
|
* just a single bean with name "viewResolver" will be expected.
|
||||||
|
* <p>Default is "true". Turn this off if you want this servlet to use a single
|
||||||
* ViewResolver, despite multiple ViewResolver beans being defined in the context.
|
* ViewResolver, despite multiple ViewResolver beans being defined in the context.
|
||||||
*/
|
*/
|
||||||
public void setDetectAllViewResolvers(boolean detectAllViewResolvers) {
|
public void setDetectAllViewResolvers(boolean detectAllViewResolvers) {
|
||||||
|
|
@ -307,28 +311,32 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether to perform cleanup of request attributes after an include request, that is, whether to reset the
|
* Set whether to perform cleanup of request attributes after an include request, that is,
|
||||||
* original state of all request attributes after the DispatcherServlet has processed within an include request. Else,
|
* whether to reset the original state of all request attributes after the DispatcherServlet
|
||||||
* just the DispatcherServlet's own request attributes will be reset, but not model attributes for JSPs or special
|
* has processed within an include request. Otherwise, just the DispatcherServlet's own
|
||||||
* attributes set by views (for example, JSTL's). <p>Default is "true", which is strongly recommended. Views should not
|
* request attributes will be reset, but not model attributes for JSPs or special attributes
|
||||||
* rely on request attributes having been set by (dynamic) includes. This allows JSP views rendered by an included
|
* set by views (for example, JSTL's).
|
||||||
* controller to use any model attributes, even with the same names as in the main JSP, without causing side effects.
|
* <p>Default is "true", which is strongly recommended. Views should not rely on request attributes
|
||||||
* Only turn this off for special needs, for example to deliberately allow main JSPs to access attributes from JSP
|
* having been set by (dynamic) includes. This allows JSP views rendered by an included controller
|
||||||
* views rendered by an included controller.
|
* to use any model attributes, even with the same names as in the main JSP, without causing side
|
||||||
|
* effects. Only turn this off for special needs, for example to deliberately allow main JSPs to
|
||||||
|
* access attributes from JSP views rendered by an included controller.
|
||||||
*/
|
*/
|
||||||
public void setCleanupAfterInclude(boolean cleanupAfterInclude) {
|
public void setCleanupAfterInclude(boolean cleanupAfterInclude) {
|
||||||
this.cleanupAfterInclude = cleanupAfterInclude;
|
this.cleanupAfterInclude = cleanupAfterInclude;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This implementation calls {@link #initStrategies}. */
|
/**
|
||||||
|
* This implementation calls {@link #initStrategies}.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onRefresh(ApplicationContext context) throws BeansException {
|
protected void onRefresh(ApplicationContext context) throws BeansException {
|
||||||
initStrategies(context);
|
initStrategies(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the strategy objects that this servlet uses. <p>May be overridden in subclasses in order to initialize
|
* Initialize the strategy objects that this servlet uses.
|
||||||
* further strategy objects.
|
* <p>May be overridden in subclasses in order to initialize further strategy objects.
|
||||||
*/
|
*/
|
||||||
protected void initStrategies(ApplicationContext context) {
|
protected void initStrategies(ApplicationContext context) {
|
||||||
initMultipartResolver(context);
|
initMultipartResolver(context);
|
||||||
|
|
@ -342,8 +350,9 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the MultipartResolver used by this class. <p>If no bean is defined with the given name in the BeanFactory
|
* Initialize the MultipartResolver used by this class.
|
||||||
* for this namespace, no multipart handling is provided.
|
* <p>If no bean is defined with the given name in the BeanFactory for this namespace,
|
||||||
|
* no multipart handling is provided.
|
||||||
*/
|
*/
|
||||||
private void initMultipartResolver(ApplicationContext context) {
|
private void initMultipartResolver(ApplicationContext context) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -363,8 +372,9 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the LocaleResolver used by this class. <p>If no bean is defined with the given name in the BeanFactory
|
* Initialize the LocaleResolver used by this class.
|
||||||
* for this namespace, we default to AcceptHeaderLocaleResolver.
|
* <p>If no bean is defined with the given name in the BeanFactory for this namespace,
|
||||||
|
* we default to AcceptHeaderLocaleResolver.
|
||||||
*/
|
*/
|
||||||
private void initLocaleResolver(ApplicationContext context) {
|
private void initLocaleResolver(ApplicationContext context) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -384,8 +394,9 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the ThemeResolver used by this class. <p>If no bean is defined with the given name in the BeanFactory for
|
* Initialize the ThemeResolver used by this class.
|
||||||
* this namespace, we default to a FixedThemeResolver.
|
* <p>If no bean is defined with the given name in the BeanFactory for this namespace,
|
||||||
|
* we default to a FixedThemeResolver.
|
||||||
*/
|
*/
|
||||||
private void initThemeResolver(ApplicationContext context) {
|
private void initThemeResolver(ApplicationContext context) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -406,8 +417,9 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the HandlerMappings used by this class. <p>If no HandlerMapping beans are defined in the BeanFactory for
|
* Initialize the HandlerMappings used by this class.
|
||||||
* this namespace, we default to BeanNameUrlHandlerMapping.
|
* <p>If no HandlerMapping beans are defined in the BeanFactory for this namespace,
|
||||||
|
* we default to BeanNameUrlHandlerMapping.
|
||||||
*/
|
*/
|
||||||
private void initHandlerMappings(ApplicationContext context) {
|
private void initHandlerMappings(ApplicationContext context) {
|
||||||
this.handlerMappings = null;
|
this.handlerMappings = null;
|
||||||
|
|
@ -443,8 +455,9 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the HandlerAdapters used by this class. <p>If no HandlerAdapter beans are defined in the BeanFactory for
|
* Initialize the HandlerAdapters used by this class.
|
||||||
* this namespace, we default to SimpleControllerHandlerAdapter.
|
* <p>If no HandlerAdapter beans are defined in the BeanFactory for this namespace,
|
||||||
|
* we default to SimpleControllerHandlerAdapter.
|
||||||
*/
|
*/
|
||||||
private void initHandlerAdapters(ApplicationContext context) {
|
private void initHandlerAdapters(ApplicationContext context) {
|
||||||
this.handlerAdapters = null;
|
this.handlerAdapters = null;
|
||||||
|
|
@ -480,8 +493,9 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the HandlerExceptionResolver used by this class. <p>If no bean is defined with the given name in the
|
* Initialize the HandlerExceptionResolver used by this class.
|
||||||
* BeanFactory for this namespace, we default to no exception resolver.
|
* <p>If no bean is defined with the given name in the BeanFactory for this namespace,
|
||||||
|
* we default to no exception resolver.
|
||||||
*/
|
*/
|
||||||
private void initHandlerExceptionResolvers(ApplicationContext context) {
|
private void initHandlerExceptionResolvers(ApplicationContext context) {
|
||||||
this.handlerExceptionResolvers = null;
|
this.handlerExceptionResolvers = null;
|
||||||
|
|
@ -518,8 +532,8 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the RequestToViewNameTranslator used by this servlet instance. If no implementation is configured then we
|
* Initialize the RequestToViewNameTranslator used by this servlet instance.
|
||||||
* default to DefaultRequestToViewNameTranslator.
|
* <p>If no implementation is configured then we default to DefaultRequestToViewNameTranslator.
|
||||||
*/
|
*/
|
||||||
private void initRequestToViewNameTranslator(ApplicationContext context) {
|
private void initRequestToViewNameTranslator(ApplicationContext context) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -541,7 +555,8 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the ViewResolvers used by this class. <p>If no ViewResolver beans are defined in the BeanFactory for this
|
* Initialize the ViewResolvers used by this class.
|
||||||
|
* <p>If no ViewResolver beans are defined in the BeanFactory for this
|
||||||
* namespace, we default to InternalResourceViewResolver.
|
* namespace, we default to InternalResourceViewResolver.
|
||||||
*/
|
*/
|
||||||
private void initViewResolvers(ApplicationContext context) {
|
private void initViewResolvers(ApplicationContext context) {
|
||||||
|
|
@ -578,9 +593,9 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return this servlet's ThemeSource, if any; else return <code>null</code>. <p>Default is to return the
|
* Return this servlet's ThemeSource, if any; else return <code>null</code>.
|
||||||
* WebApplicationContext as ThemeSource, provided that it implements the ThemeSource interface.
|
* <p>Default is to return the WebApplicationContext as ThemeSource,
|
||||||
*
|
* provided that it implements the ThemeSource interface.
|
||||||
* @return the ThemeSource, if any
|
* @return the ThemeSource, if any
|
||||||
* @see #getWebApplicationContext()
|
* @see #getWebApplicationContext()
|
||||||
*/
|
*/
|
||||||
|
|
@ -595,18 +610,17 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain this servlet's MultipartResolver, if any.
|
* Obtain this servlet's MultipartResolver, if any.
|
||||||
*
|
* @return the MultipartResolver used by this servlet, or <code>null</code> if none
|
||||||
* @return the MultipartResolver used by this servlet, or <code>null</code> if none (indicating that no multipart
|
* (indicating that no multipart support is available)
|
||||||
* support is available)
|
|
||||||
*/
|
*/
|
||||||
public final MultipartResolver getMultipartResolver() {
|
public final MultipartResolver getMultipartResolver() {
|
||||||
return this.multipartResolver;
|
return this.multipartResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the default strategy object for the given strategy interface. <p>The default implementation delegates to
|
* Return the default strategy object for the given strategy interface.
|
||||||
* {@link #getDefaultStrategies}, expecting a single object in the list.
|
* <p>The default implementation delegates to {@link #getDefaultStrategies},
|
||||||
*
|
* expecting a single object in the list.
|
||||||
* @param context the current WebApplicationContext
|
* @param context the current WebApplicationContext
|
||||||
* @param strategyInterface the strategy interface
|
* @param strategyInterface the strategy interface
|
||||||
* @return the corresponding strategy object
|
* @return the corresponding strategy object
|
||||||
|
|
@ -622,10 +636,10 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a List of default strategy objects for the given strategy interface. <p>The default implementation uses the
|
* Create a List of default strategy objects for the given strategy interface.
|
||||||
* "DispatcherServlet.properties" file (in the same package as the DispatcherServlet class) to determine the class
|
* <p>The default implementation uses the "DispatcherServlet.properties" file (in the same
|
||||||
* names. It instantiates the strategy objects through the context's BeanFactory.
|
* package as the DispatcherServlet class) to determine the class names. It instantiates
|
||||||
*
|
* the strategy objects through the context's BeanFactory.
|
||||||
* @param context the current WebApplicationContext
|
* @param context the current WebApplicationContext
|
||||||
* @param strategyInterface the strategy interface
|
* @param strategyInterface the strategy interface
|
||||||
* @return the List of corresponding strategy objects
|
* @return the List of corresponding strategy objects
|
||||||
|
|
@ -662,8 +676,8 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a default strategy. <p>The default implementation uses {@link org.springframework.beans.factory.config.AutowireCapableBeanFactory#createBean}.
|
* Create a default strategy.
|
||||||
*
|
* <p>The default implementation uses {@link org.springframework.beans.factory.config.AutowireCapableBeanFactory#createBean}.
|
||||||
* @param context the current WebApplicationContext
|
* @param context the current WebApplicationContext
|
||||||
* @param clazz the strategy implementation class to instantiate
|
* @param clazz the strategy implementation class to instantiate
|
||||||
* @return the fully configured strategy instance
|
* @return the fully configured strategy instance
|
||||||
|
|
@ -676,8 +690,8 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exposes the DispatcherServlet-specific request attributes and delegates to {@link #doDispatch} for the actual
|
* Exposes the DispatcherServlet-specific request attributes and delegates to {@link #doDispatch}
|
||||||
* dispatching.
|
* for the actual dispatching.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void doService(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
protected void doService(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
|
|
@ -720,11 +734,12 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the actual dispatching to the handler. <p>The handler will be obtained by applying the servlet's
|
* Process the actual dispatching to the handler.
|
||||||
* HandlerMappings in order. The HandlerAdapter will be obtained by querying the servlet's installed HandlerAdapters to
|
* <p>The handler will be obtained by applying the servlet's HandlerMappings in order.
|
||||||
* find the first that supports the handler class. <p>All HTTP methods are handled by this method. It's up to
|
* The HandlerAdapter will be obtained by querying the servlet's installed HandlerAdapters
|
||||||
* HandlerAdapters or handlers themselves to decide which methods are acceptable.
|
* to find the first that supports the handler class.
|
||||||
*
|
* <p>All HTTP methods are handled by this method. It's up to HandlerAdapters or handlers
|
||||||
|
* themselves to decide which methods are acceptable.
|
||||||
* @param request current HTTP request
|
* @param request current HTTP request
|
||||||
* @param response current HTTP response
|
* @param response current HTTP response
|
||||||
* @throws Exception in case of any kind of processing failure
|
* @throws Exception in case of any kind of processing failure
|
||||||
|
|
@ -827,8 +842,8 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override HttpServlet's <code>getLastModified</code> method to evaluate the Last-Modified value of the mapped
|
* Override HttpServlet's <code>getLastModified</code> method to evaluate the Last-Modified value
|
||||||
* handler.
|
* of the mapped handler.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected long getLastModified(HttpServletRequest request) {
|
protected long getLastModified(HttpServletRequest request) {
|
||||||
|
|
@ -862,10 +877,9 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a LocaleContext for the given request, exposing the request's primary locale as current locale. <p>The default
|
* Build a LocaleContext for the given request, exposing the request's primary locale as current locale.
|
||||||
* implementation uses the dispatcher's LocaleResolver to obtain the current locale, which might change during a
|
* <p>The default implementation uses the dispatcher's LocaleResolver to obtain the current locale,
|
||||||
* request.
|
* which might change during a request.
|
||||||
*
|
|
||||||
* @param request current HTTP request
|
* @param request current HTTP request
|
||||||
* @return the corresponding LocaleContext
|
* @return the corresponding LocaleContext
|
||||||
*/
|
*/
|
||||||
|
|
@ -884,9 +898,8 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the request into a multipart request, and make multipart resolver available. If no multipart resolver is
|
* Convert the request into a multipart request, and make multipart resolver available.
|
||||||
* set, simply use the existing request.
|
* <p>If no multipart resolver is set, simply use the existing request.
|
||||||
*
|
|
||||||
* @param request current HTTP request
|
* @param request current HTTP request
|
||||||
* @return the processed request (multipart wrapper if necessary)
|
* @return the processed request (multipart wrapper if necessary)
|
||||||
* @see MultipartResolver#resolveMultipart
|
* @see MultipartResolver#resolveMultipart
|
||||||
|
|
@ -907,7 +920,6 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up any resources used by the given multipart request (if any).
|
* Clean up any resources used by the given multipart request (if any).
|
||||||
*
|
|
||||||
* @param request current HTTP request
|
* @param request current HTTP request
|
||||||
* @see MultipartResolver#cleanupMultipart
|
* @see MultipartResolver#cleanupMultipart
|
||||||
*/
|
*/
|
||||||
|
|
@ -919,7 +931,6 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the HandlerExecutionChain for this request. Try all handler mappings in order.
|
* Return the HandlerExecutionChain for this request. Try all handler mappings in order.
|
||||||
*
|
|
||||||
* @param request current HTTP request
|
* @param request current HTTP request
|
||||||
* @param cache whether to cache the HandlerExecutionChain in a request attribute
|
* @param cache whether to cache the HandlerExecutionChain in a request attribute
|
||||||
* @return the HandlerExceutionChain, or <code>null</code> if no handler could be found
|
* @return the HandlerExceutionChain, or <code>null</code> if no handler could be found
|
||||||
|
|
@ -951,7 +962,6 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No handler found -> set appropriate HTTP response status.
|
* No handler found -> set appropriate HTTP response status.
|
||||||
*
|
|
||||||
* @param request current HTTP request
|
* @param request current HTTP request
|
||||||
* @param response current HTTP response
|
* @param response current HTTP response
|
||||||
* @throws Exception if preparing the response failed
|
* @throws Exception if preparing the response failed
|
||||||
|
|
@ -967,7 +977,6 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the HandlerAdapter for this handler object.
|
* Return the HandlerAdapter for this handler object.
|
||||||
*
|
|
||||||
* @param handler the handler object to find an adapter for
|
* @param handler the handler object to find an adapter for
|
||||||
* @throws ServletException if no HandlerAdapter can be found for the handler. This is a fatal error.
|
* @throws ServletException if no HandlerAdapter can be found for the handler. This is a fatal error.
|
||||||
*/
|
*/
|
||||||
|
|
@ -986,11 +995,10 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine an error ModelAndView via the registered HandlerExceptionResolvers.
|
* Determine an error ModelAndView via the registered HandlerExceptionResolvers.
|
||||||
*
|
|
||||||
* @param request current HTTP request
|
* @param request current HTTP request
|
||||||
* @param response current HTTP response
|
* @param response current HTTP response
|
||||||
* @param handler the executed handler, or <code>null</code> if none chosen at the time of the exception (for example,
|
* @param handler the executed handler, or <code>null</code> if none chosen at the time of the exception
|
||||||
* if multipart resolution failed)
|
* (for example, if multipart resolution failed)
|
||||||
* @param ex the exception that got thrown during handler execution
|
* @param ex the exception that got thrown during handler execution
|
||||||
* @return a corresponding ModelAndView to forward to
|
* @return a corresponding ModelAndView to forward to
|
||||||
* @throws Exception if no error ModelAndView found
|
* @throws Exception if no error ModelAndView found
|
||||||
|
|
@ -1024,9 +1032,8 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the given ModelAndView. This is the last stage in handling a request. It may involve resolving the view by
|
* Render the given ModelAndView.
|
||||||
* name.
|
* <p>This is the last stage in handling a request. It may involve resolving the view by name.
|
||||||
*
|
|
||||||
* @param mv the ModelAndView to render
|
* @param mv the ModelAndView to render
|
||||||
* @param request current HTTP servlet request
|
* @param request current HTTP servlet request
|
||||||
* @param response current HTTP servlet response
|
* @param response current HTTP servlet response
|
||||||
|
|
@ -1067,7 +1074,6 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translate the supplied request into a default view name.
|
* Translate the supplied request into a default view name.
|
||||||
*
|
|
||||||
* @param request current HTTP servlet request
|
* @param request current HTTP servlet request
|
||||||
* @return the view name (or <code>null</code> if no default found)
|
* @return the view name (or <code>null</code> if no default found)
|
||||||
* @throws Exception if view name translation failed
|
* @throws Exception if view name translation failed
|
||||||
|
|
@ -1077,16 +1083,17 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve the given view name into a View object (to be rendered). <p>Default implementations asks all ViewResolvers
|
* Resolve the given view name into a View object (to be rendered).
|
||||||
* of this dispatcher. Can be overridden for custom resolution strategies, potentially based on specific model
|
* <p>Default implementations asks all ViewResolvers of this dispatcher.
|
||||||
* attributes or request parameters.
|
* Can be overridden for custom resolution strategies, potentially based on
|
||||||
*
|
* specific model attributes or request parameters.
|
||||||
* @param viewName the name of the view to resolve
|
* @param viewName the name of the view to resolve
|
||||||
* @param model the model to be passed to the view
|
* @param model the model to be passed to the view
|
||||||
* @param locale the current locale
|
* @param locale the current locale
|
||||||
* @param request current HTTP servlet request
|
* @param request current HTTP servlet request
|
||||||
* @return the View object, or <code>null</code> if none found
|
* @return the View object, or <code>null</code> if none found
|
||||||
* @throws Exception if the view cannot be resolved (typically in case of problems creating an actual View object)
|
* @throws Exception if the view cannot be resolved
|
||||||
|
* (typically in case of problems creating an actual View object)
|
||||||
* @see ViewResolver#resolveViewName
|
* @see ViewResolver#resolveViewName
|
||||||
*/
|
*/
|
||||||
protected View resolveViewName(String viewName,
|
protected View resolveViewName(String viewName,
|
||||||
|
|
@ -1104,9 +1111,9 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger afterCompletion callbacks on the mapped HandlerInterceptors. Will just invoke afterCompletion for all
|
* Trigger afterCompletion callbacks on the mapped HandlerInterceptors.
|
||||||
* interceptors whose preHandle invocation has successfully completed and returned true.
|
* Will just invoke afterCompletion for all interceptors whose preHandle invocation
|
||||||
*
|
* has successfully completed and returned true.
|
||||||
* @param mappedHandler the mapped HandlerExecutionChain
|
* @param mappedHandler the mapped HandlerExecutionChain
|
||||||
* @param interceptorIndex index of last interceptor that successfully completed
|
* @param interceptorIndex index of last interceptor that successfully completed
|
||||||
* @param ex Exception thrown on handler execution, or <code>null</code> if none
|
* @param ex Exception thrown on handler execution, or <code>null</code> if none
|
||||||
|
|
@ -1137,7 +1144,6 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restore the request attributes after an include.
|
* Restore the request attributes after an include.
|
||||||
*
|
|
||||||
* @param request current HTTP request
|
* @param request current HTTP request
|
||||||
* @param attributesSnapshot the snapshot of the request attributes before the include
|
* @param attributesSnapshot the snapshot of the request attributes before the include
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2008 the original author or authors.
|
* Copyright 2002-2009 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -17,16 +17,14 @@
|
||||||
package org.springframework.web.servlet.handler;
|
package org.springframework.web.servlet.handler;
|
||||||
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
import org.springframework.web.util.WebUtils;
|
import org.springframework.web.util.WebUtils;
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link org.springframework.web.servlet.HandlerExceptionResolver} implementation that allows for mapping exception
|
* {@link org.springframework.web.servlet.HandlerExceptionResolver} implementation that allows for mapping exception
|
||||||
|
|
@ -37,8 +35,8 @@ import org.springframework.util.CollectionUtils;
|
||||||
*
|
*
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
* @author Arjen Poutsma
|
* @author Arjen Poutsma
|
||||||
* @see org.springframework.web.servlet.DispatcherServlet
|
|
||||||
* @since 22.11.2003
|
* @since 22.11.2003
|
||||||
|
* @see org.springframework.web.servlet.DispatcherServlet
|
||||||
*/
|
*/
|
||||||
public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionResolver {
|
public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionResolver {
|
||||||
|
|
||||||
|
|
@ -55,20 +53,20 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
|
||||||
|
|
||||||
private String exceptionAttribute = DEFAULT_EXCEPTION_ATTRIBUTE;
|
private String exceptionAttribute = DEFAULT_EXCEPTION_ATTRIBUTE;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the mappings between exception class names and error view names. The exception class name can be a substring,
|
* Set the mappings between exception class names and error view names.
|
||||||
* with no wildcard support at present. A value of "ServletException" would match
|
* The exception class name can be a substring, with no wildcard support at present.
|
||||||
* <code>javax.servlet.ServletException</code> and subclasses, for example. <p><b>NB:</b> Consider carefully how
|
* A value of "ServletException" would match <code>javax.servlet.ServletException</code>
|
||||||
* specific the pattern is, and whether to include package information (which isn't mandatory). For example,
|
* and subclasses, for example.
|
||||||
* "Exception" will match nearly anything, and will probably hide other rules. "java.lang.Exception" would be correct
|
* <p><b>NB:</b> Consider carefully how
|
||||||
* if "Exception" was meant to define a rule for all checked exceptions. With more unusual exception names such as
|
* specific the pattern is, and whether to include package information (which isn't mandatory).
|
||||||
* "BaseBusinessException" there's no need to use a FQN. <p>Follows the same matching algorithm as
|
* For example, "Exception" will match nearly anything, and will probably hide other rules.
|
||||||
* RuleBasedTransactionAttribute and RollbackRuleAttribute.
|
* "java.lang.Exception" would be correct if "Exception" was meant to define a rule for all
|
||||||
*
|
* checked exceptions. With more unusual exception names such as "BaseBusinessException"
|
||||||
* @param mappings exception patterns (can also be fully qualified class names) as keys, and error view names as
|
* there's no need to use a FQN.
|
||||||
* values
|
* @param mappings exception patterns (can also be fully qualified class names) as keys,
|
||||||
* @see org.springframework.transaction.interceptor.RuleBasedTransactionAttribute
|
* and error view names as values
|
||||||
* @see org.springframework.transaction.interceptor.RollbackRuleAttribute
|
|
||||||
*/
|
*/
|
||||||
public void setExceptionMappings(Properties mappings) {
|
public void setExceptionMappings(Properties mappings) {
|
||||||
this.exceptionMappings = mappings;
|
this.exceptionMappings = mappings;
|
||||||
|
|
@ -85,12 +83,9 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
|
||||||
/**
|
/**
|
||||||
* Set the HTTP status code that this exception resolver will apply for a given resolved error view. Keys are
|
* Set the HTTP status code that this exception resolver will apply for a given resolved error view. Keys are
|
||||||
* view names; values are status codes.
|
* view names; values are status codes.
|
||||||
*
|
|
||||||
* <p>Note that this error code will only get applied in case of a top-level request. It will not be set for an include
|
* <p>Note that this error code will only get applied in case of a top-level request. It will not be set for an include
|
||||||
* request, since the HTTP status cannot be modified from within an include.
|
* request, since the HTTP status cannot be modified from within an include.
|
||||||
*
|
|
||||||
* <p>If not specified, the default status code will be applied.
|
* <p>If not specified, the default status code will be applied.
|
||||||
*
|
|
||||||
* @see #setDefaultStatusCode(int)
|
* @see #setDefaultStatusCode(int)
|
||||||
*/
|
*/
|
||||||
public void setStatusCodes(Properties statusCodes) {
|
public void setStatusCodes(Properties statusCodes) {
|
||||||
|
|
@ -104,13 +99,10 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
|
||||||
/**
|
/**
|
||||||
* Set the default HTTP status code that this exception resolver will apply if it resolves an error view and if there
|
* Set the default HTTP status code that this exception resolver will apply if it resolves an error view and if there
|
||||||
* is no status code mapping defined.
|
* is no status code mapping defined.
|
||||||
*
|
|
||||||
* <p>Note that this error code will only get applied in case of a top-level request. It will not be set for an
|
* <p>Note that this error code will only get applied in case of a top-level request. It will not be set for an
|
||||||
* include request, since the HTTP status cannot be modified from within an include.
|
* include request, since the HTTP status cannot be modified from within an include.
|
||||||
*
|
|
||||||
* <p>If not specified, no status code will be applied, either leaving this to the controller or view, or keeping
|
* <p>If not specified, no status code will be applied, either leaving this to the controller or view, or keeping
|
||||||
* the servlet engine's default of 200 (OK).
|
* the servlet engine's default of 200 (OK).
|
||||||
*
|
|
||||||
* @param defaultStatusCode HTTP status code value, for example 500
|
* @param defaultStatusCode HTTP status code value, for example 500
|
||||||
* ({@link HttpServletResponse#SC_INTERNAL_SERVER_ERROR}) or 404 ({@link HttpServletResponse#SC_NOT_FOUND})
|
* ({@link HttpServletResponse#SC_INTERNAL_SERVER_ERROR}) or 404 ({@link HttpServletResponse#SC_NOT_FOUND})
|
||||||
* @see #setStatusCodes(Properties)
|
* @see #setStatusCodes(Properties)
|
||||||
|
|
@ -122,7 +114,6 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
|
||||||
/**
|
/**
|
||||||
* Set the name of the model attribute as which the exception should be exposed. Default is "exception". <p>This can be
|
* Set the name of the model attribute as which the exception should be exposed. Default is "exception". <p>This can be
|
||||||
* either set to a different attribute name or to <code>null</code> for not exposing an exception attribute at all.
|
* either set to a different attribute name or to <code>null</code> for not exposing an exception attribute at all.
|
||||||
*
|
|
||||||
* @see #DEFAULT_EXCEPTION_ATTRIBUTE
|
* @see #DEFAULT_EXCEPTION_ATTRIBUTE
|
||||||
*/
|
*/
|
||||||
public void setExceptionAttribute(String exceptionAttribute) {
|
public void setExceptionAttribute(String exceptionAttribute) {
|
||||||
|
|
@ -134,7 +125,6 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
|
||||||
* represents a specific error page if appropriate. <p>May be overridden in subclasses, in order to apply specific
|
* represents a specific error page if appropriate. <p>May be overridden in subclasses, in order to apply specific
|
||||||
* exception checks. Note that this template method will be invoked <i>after</i> checking whether this resolved applies
|
* exception checks. Note that this template method will be invoked <i>after</i> checking whether this resolved applies
|
||||||
* ("mappedHandlers" etc), so an implementation may simply proceed with its actual exception handling.
|
* ("mappedHandlers" etc), so an implementation may simply proceed with its actual exception handling.
|
||||||
*
|
|
||||||
* @param request current HTTP request
|
* @param request current HTTP request
|
||||||
* @param response current HTTP response
|
* @param response current HTTP response
|
||||||
* @param handler the executed handler, or <code>null</code> if none chosen at the time of the exception (for example,
|
* @param handler the executed handler, or <code>null</code> if none chosen at the time of the exception (for example,
|
||||||
|
|
@ -167,7 +157,6 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
|
||||||
/**
|
/**
|
||||||
* Determine the view name for the given exception, searching the {@link #setExceptionMappings "exceptionMappings"},
|
* Determine the view name for the given exception, searching the {@link #setExceptionMappings "exceptionMappings"},
|
||||||
* using the {@link #setDefaultErrorView "defaultErrorView"} as fallback.
|
* using the {@link #setDefaultErrorView "defaultErrorView"} as fallback.
|
||||||
*
|
|
||||||
* @param ex the exception that got thrown during handler execution
|
* @param ex the exception that got thrown during handler execution
|
||||||
* @param request current HTTP request (useful for obtaining metadata)
|
* @param request current HTTP request (useful for obtaining metadata)
|
||||||
* @return the resolved view name, or <code>null</code> if none found
|
* @return the resolved view name, or <code>null</code> if none found
|
||||||
|
|
@ -191,7 +180,6 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a matching view name in the given exception mappings.
|
* Find a matching view name in the given exception mappings.
|
||||||
*
|
|
||||||
* @param exceptionMappings mappings between exception class names and error view names
|
* @param exceptionMappings mappings between exception class names and error view names
|
||||||
* @param ex the exception that got thrown during handler execution
|
* @param ex the exception that got thrown during handler execution
|
||||||
* @return the view name, or <code>null</code> if none found
|
* @return the view name, or <code>null</code> if none found
|
||||||
|
|
@ -218,9 +206,9 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the depth to the superclass matching. <p>0 means ex matches exactly. Returns -1 if there's no match.
|
* Return the depth to the superclass matching.
|
||||||
* Otherwise, returns depth. Lowest depth wins. <p>Follows the same algorithm as {@link
|
* <p>0 means ex matches exactly. Returns -1 if there's no match.
|
||||||
* org.springframework.transaction.interceptor.RollbackRuleAttribute}.
|
* Otherwise, returns depth. Lowest depth wins.
|
||||||
*/
|
*/
|
||||||
protected int getDepth(String exceptionMapping, Exception ex) {
|
protected int getDepth(String exceptionMapping, Exception ex) {
|
||||||
return getDepth(exceptionMapping, ex.getClass(), 0);
|
return getDepth(exceptionMapping, ex.getClass(), 0);
|
||||||
|
|
@ -240,17 +228,14 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the HTTP status code to apply for the given error view.
|
* Determine the HTTP status code to apply for the given error view.
|
||||||
*
|
|
||||||
* <p>The default implementation returns the status code for the given view name (specified through the
|
* <p>The default implementation returns the status code for the given view name (specified through the
|
||||||
* {@link #setStatusCodes(Properties) statusCodes} property), or falls back to the
|
* {@link #setStatusCodes(Properties) statusCodes} property), or falls back to the
|
||||||
* {@link #setDefaultStatusCode defaultStatusCode} if there is no match.
|
* {@link #setDefaultStatusCode defaultStatusCode} if there is no match.
|
||||||
*
|
|
||||||
* <p>Override this in a custom subclass to customize this behavior.
|
* <p>Override this in a custom subclass to customize this behavior.
|
||||||
*
|
|
||||||
* @param request current HTTP request
|
* @param request current HTTP request
|
||||||
* @param viewName the name of the error view
|
* @param viewName the name of the error view
|
||||||
* @return the HTTP status code to use, or <code>null</code> for the servlet container's default (200 in case of a
|
* @return the HTTP status code to use, or <code>null</code> for the servlet container's default
|
||||||
* standard error view)
|
* (200 in case of a standard error view)
|
||||||
* @see #setDefaultStatusCode
|
* @see #setDefaultStatusCode
|
||||||
* @see #applyStatusCodeIfPossible
|
* @see #applyStatusCodeIfPossible
|
||||||
*/
|
*/
|
||||||
|
|
@ -262,9 +247,8 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply the specified HTTP status code to the given response, if possible (that is, if not executing within an include
|
* Apply the specified HTTP status code to the given response, if possible (that is,
|
||||||
* request).
|
* if not executing within an include request).
|
||||||
*
|
|
||||||
* @param request current HTTP request
|
* @param request current HTTP request
|
||||||
* @param response current HTTP response
|
* @param response current HTTP response
|
||||||
* @param statusCode the status code to apply
|
* @param statusCode the status code to apply
|
||||||
|
|
@ -283,9 +267,8 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a ModelAndView for the given request, view name and exception. <p>The default implementation delegates to
|
* Return a ModelAndView for the given request, view name and exception.
|
||||||
* {@link #getModelAndView(String, Exception)}.
|
* <p>The default implementation delegates to {@link #getModelAndView(String, Exception)}.
|
||||||
*
|
|
||||||
* @param viewName the name of the error view
|
* @param viewName the name of the error view
|
||||||
* @param ex the exception that got thrown during handler execution
|
* @param ex the exception that got thrown during handler execution
|
||||||
* @param request current HTTP request (useful for obtaining metadata)
|
* @param request current HTTP request (useful for obtaining metadata)
|
||||||
|
|
@ -296,9 +279,9 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a ModelAndView for the given view name and exception. <p>The default implementation adds the specified
|
* Return a ModelAndView for the given view name and exception.
|
||||||
* exception attribute. Can be overridden in subclasses.
|
* <p>The default implementation adds the specified exception attribute.
|
||||||
*
|
* Can be overridden in subclasses.
|
||||||
* @param viewName the name of the error view
|
* @param viewName the name of the error view
|
||||||
* @param ex the exception that got thrown during handler execution
|
* @param ex the exception that got thrown during handler execution
|
||||||
* @return the ModelAndView instance
|
* @return the ModelAndView instance
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue