com.github.datalking.web.config.ContentNegotiationManagerFactoryBean Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of play-mvc Show documentation
Show all versions of play-mvc Show documentation
simple mvc framework based on java servlet.
The newest version!
package com.github.datalking.web.config;
import com.github.datalking.beans.factory.FactoryBean;
import com.github.datalking.beans.factory.InitializingBean;
import com.github.datalking.util.Assert;
import com.github.datalking.util.CollectionUtils;
import com.github.datalking.web.http.MediaType;
import com.github.datalking.web.http.accept.ContentNegotiationManager;
import com.github.datalking.web.http.accept.ContentNegotiationStrategy;
import com.github.datalking.web.http.accept.FixedContentNegotiationStrategy;
import com.github.datalking.web.http.accept.HeaderContentNegotiationStrategy;
import com.github.datalking.web.http.accept.ParameterContentNegotiationStrategy;
import com.github.datalking.web.http.accept.PathExtensionContentNegotiationStrategy;
import com.github.datalking.web.http.accept.ServletPathExtensionContentNegotiationStrategy;
import com.github.datalking.web.context.ServletContextAware;
import javax.servlet.ServletContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
/**
* @author yaoo on 5/4/18
*/
public class ContentNegotiationManagerFactoryBean
implements FactoryBean, ServletContextAware, InitializingBean {
private boolean favorPathExtension = true;
private boolean favorParameter = false;
private boolean ignoreAcceptHeader = false;
private Map mediaTypes = new HashMap<>();
private Boolean useJaf;
private String parameterName = "format";
private MediaType defaultContentType;
private ContentNegotiationManager contentNegotiationManager;
private ServletContext servletContext;
public void setFavorPathExtension(boolean favorPathExtension) {
this.favorPathExtension = favorPathExtension;
}
public void setMediaTypes(Properties mediaTypes) {
if (!CollectionUtils.isEmpty(mediaTypes)) {
for (Map.Entry
© 2015 - 2025 Weber Informatics LLC | Privacy Policy