Fixed setFavorPathExtension delegation code
This commit is contained in:
		
							parent
							
								
									ab3aa6c8c2
								
							
						
					
					
						commit
						188a11bdb9
					
				|  | @ -1,5 +1,5 @@ | ||||||
| /* | /* | ||||||
|  * Copyright 2002-2012 the original author or authors. |  * Copyright 2002-2013 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. | ||||||
|  | @ -25,7 +25,6 @@ import java.util.Locale; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| import java.util.Properties; | import java.util.Properties; | ||||||
| import java.util.Set; | import java.util.Set; | ||||||
| 
 |  | ||||||
| import javax.activation.FileTypeMap; | import javax.activation.FileTypeMap; | ||||||
| import javax.servlet.ServletContext; | import javax.servlet.ServletContext; | ||||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||||
|  | @ -33,6 +32,7 @@ import javax.servlet.http.HttpServletResponse; | ||||||
| 
 | 
 | ||||||
| import org.apache.commons.logging.Log; | import org.apache.commons.logging.Log; | ||||||
| import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||||
|  | 
 | ||||||
| import org.springframework.beans.factory.BeanFactoryUtils; | import org.springframework.beans.factory.BeanFactoryUtils; | ||||||
| import org.springframework.beans.factory.InitializingBean; | import org.springframework.beans.factory.InitializingBean; | ||||||
| import org.springframework.core.OrderComparator; | import org.springframework.core.OrderComparator; | ||||||
|  | @ -95,7 +95,7 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport | ||||||
| 
 | 
 | ||||||
| 	private ContentNegotiationManager contentNegotiationManager; | 	private ContentNegotiationManager contentNegotiationManager; | ||||||
| 
 | 
 | ||||||
| 	private ContentNegotiationManagerFactoryBean cnManagerFactoryBean = new ContentNegotiationManagerFactoryBean(); | 	private final ContentNegotiationManagerFactoryBean cnManagerFactoryBean = new ContentNegotiationManagerFactoryBean(); | ||||||
| 
 | 
 | ||||||
| 	private boolean useNotAcceptableStatusCode = false; | 	private boolean useNotAcceptableStatusCode = false; | ||||||
| 
 | 
 | ||||||
|  | @ -104,10 +104,6 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport | ||||||
| 	private List<ViewResolver> viewResolvers; | 	private List<ViewResolver> viewResolvers; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	public ContentNegotiatingViewResolver() { |  | ||||||
| 		super(); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	public void setOrder(int order) { | 	public void setOrder(int order) { | ||||||
| 		this.order = order; | 		this.order = order; | ||||||
| 	} | 	} | ||||||
|  | @ -118,7 +114,9 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport | ||||||
| 
 | 
 | ||||||
| 	/** | 	/** | ||||||
| 	 * Set the {@link ContentNegotiationManager} to use to determine requested media types. | 	 * Set the {@link ContentNegotiationManager} to use to determine requested media types. | ||||||
| 	 * If not set, the default constructor is used. | 	 * <p>If not set, ContentNegotiationManager's default constructor will be used, | ||||||
|  | 	 * applying a {@link org.springframework.web.accept.HeaderContentNegotiationStrategy}. | ||||||
|  | 	 * @see ContentNegotiationManager#ContentNegotiationManager() | ||||||
| 	 */ | 	 */ | ||||||
| 	public void setContentNegotiationManager(ContentNegotiationManager contentNegotiationManager) { | 	public void setContentNegotiationManager(ContentNegotiationManager contentNegotiationManager) { | ||||||
| 		this.contentNegotiationManager = contentNegotiationManager; | 		this.contentNegotiationManager = contentNegotiationManager; | ||||||
|  | @ -130,18 +128,16 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport | ||||||
| 	 * <p>For instance, when this flag is {@code true} (the default), a request for {@code /hotels.pdf} | 	 * <p>For instance, when this flag is {@code true} (the default), a request for {@code /hotels.pdf} | ||||||
| 	 * will result in an {@code AbstractPdfView} being resolved, while the {@code Accept} header can be the | 	 * will result in an {@code AbstractPdfView} being resolved, while the {@code Accept} header can be the | ||||||
| 	 * browser-defined {@code text/html,application/xhtml+xml}. | 	 * browser-defined {@code text/html,application/xhtml+xml}. | ||||||
| 	 * |  | ||||||
| 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | ||||||
| 	 */ | 	 */ | ||||||
| 	@Deprecated | 	@Deprecated | ||||||
| 	public void setFavorPathExtension(boolean favorPathExtension) { | 	public void setFavorPathExtension(boolean favorPathExtension) { | ||||||
| 		this.cnManagerFactoryBean.setFavorParameter(favorPathExtension); | 		this.cnManagerFactoryBean.setFavorPathExtension(favorPathExtension); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/** | 	/** | ||||||
| 	 * Indicate whether to use the Java Activation Framework to map from file extensions to media types. | 	 * Indicate whether to use the Java Activation Framework to map from file extensions to media types. | ||||||
| 	 * <p>Default is {@code true}, i.e. the Java Activation Framework is used (if available). | 	 * <p>Default is {@code true}, i.e. the Java Activation Framework is used (if available). | ||||||
| 	 * |  | ||||||
| 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | ||||||
| 	 */ | 	 */ | ||||||
| 	@Deprecated | 	@Deprecated | ||||||
|  | @ -155,7 +151,6 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport | ||||||
| 	 * <p>For instance, when this flag is {@code true}, a request for {@code /hotels?format=pdf} will result | 	 * <p>For instance, when this flag is {@code true}, a request for {@code /hotels?format=pdf} will result | ||||||
| 	 * in an {@code AbstractPdfView} being resolved, while the {@code Accept} header can be the browser-defined | 	 * in an {@code AbstractPdfView} being resolved, while the {@code Accept} header can be the browser-defined | ||||||
| 	 * {@code text/html,application/xhtml+xml}. | 	 * {@code text/html,application/xhtml+xml}. | ||||||
| 	 * |  | ||||||
| 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | ||||||
| 	 */ | 	 */ | ||||||
| 	@Deprecated | 	@Deprecated | ||||||
|  | @ -166,7 +161,6 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport | ||||||
| 	/** | 	/** | ||||||
| 	 * Set the parameter name that can be used to determine the requested media type if the {@link | 	 * Set the parameter name that can be used to determine the requested media type if the {@link | ||||||
| 	 * #setFavorParameter} property is {@code true}. The default parameter name is {@code format}. | 	 * #setFavorParameter} property is {@code true}. The default parameter name is {@code format}. | ||||||
| 	 * |  | ||||||
| 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | ||||||
| 	 */ | 	 */ | ||||||
| 	@Deprecated | 	@Deprecated | ||||||
|  | @ -179,7 +173,6 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport | ||||||
| 	 * <p>If set to {@code true}, this view resolver will only refer to the file extension and/or | 	 * <p>If set to {@code true}, this view resolver will only refer to the file extension and/or | ||||||
| 	 * parameter, as indicated by the {@link #setFavorPathExtension favorPathExtension} and | 	 * parameter, as indicated by the {@link #setFavorPathExtension favorPathExtension} and | ||||||
| 	 * {@link #setFavorParameter favorParameter} properties. | 	 * {@link #setFavorParameter favorParameter} properties. | ||||||
| 	 * |  | ||||||
| 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | ||||||
| 	 */ | 	 */ | ||||||
| 	@Deprecated | 	@Deprecated | ||||||
|  | @ -191,7 +184,6 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport | ||||||
| 	 * Set the mapping from file extensions to media types. | 	 * Set the mapping from file extensions to media types. | ||||||
| 	 * <p>When this mapping is not set or when an extension is not present, this view resolver | 	 * <p>When this mapping is not set or when an extension is not present, this view resolver | ||||||
| 	 * will fall back to using a {@link FileTypeMap} when the Java Action Framework is available. | 	 * will fall back to using a {@link FileTypeMap} when the Java Action Framework is available. | ||||||
| 	 * |  | ||||||
| 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | ||||||
| 	 */ | 	 */ | ||||||
| 	@Deprecated | 	@Deprecated | ||||||
|  | @ -207,7 +199,6 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport | ||||||
| 	 * Set the default content type. | 	 * Set the default content type. | ||||||
| 	 * <p>This content type will be used when file extension, parameter, nor {@code Accept} | 	 * <p>This content type will be used when file extension, parameter, nor {@code Accept} | ||||||
| 	 * header define a content-type, either through being disabled or empty. | 	 * header define a content-type, either through being disabled or empty. | ||||||
| 	 * |  | ||||||
| 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | 	 * @deprecated use {@link #setContentNegotiationManager(ContentNegotiationManager)} | ||||||
| 	 */ | 	 */ | ||||||
| 	@Deprecated | 	@Deprecated | ||||||
|  | @ -275,7 +266,7 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport | ||||||
| 		this.cnManagerFactoryBean.setServletContext(servletContext); | 		this.cnManagerFactoryBean.setServletContext(servletContext); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public void afterPropertiesSet() throws Exception { | 	public void afterPropertiesSet() { | ||||||
| 		if (this.contentNegotiationManager == null) { | 		if (this.contentNegotiationManager == null) { | ||||||
| 			this.cnManagerFactoryBean.afterPropertiesSet(); | 			this.cnManagerFactoryBean.afterPropertiesSet(); | ||||||
| 			this.contentNegotiationManager = this.cnManagerFactoryBean.getObject(); | 			this.contentNegotiationManager = this.cnManagerFactoryBean.getObject(); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue