org.voovan.http.server.context.WebServerConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of voovan-web Show documentation
Show all versions of voovan-web Show documentation
Voovan is a java framwork and it not depends on any third-party framework.
package org.voovan.http.server.context;
import org.voovan.Global;
import org.voovan.tools.Chain;
import org.voovan.tools.TObject;
import org.voovan.tools.log.Logger;
import org.voovan.tools.reflect.TReflect;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Vector;
/**
* WebServer 配置类
* 参数说明部分,请参考 /conf/web.json 的注释
*
* @author helyho
*
* Voovan Framework.
* WebSite: https://github.com/helyho/Voovan
* Licence: Apache v2 License
*/
public class WebServerConfig {
private String serverName;
private String host = "0.0.0.0";
private int port = 28080;
private int readTimeout = 30;
private int sendTimeout = 30;
private String contextPath = "WEBAPP";
private boolean MatchRouteIgnoreCase = false;
private String characterSet = "UTF-8";
private String responseCharacterSet = "";
private String sessionContainer = "org.voovan.tools.cache.CachedHashMap";
private int sessionTimeout = 30;
private int keepAliveTimeout = 60;
private boolean accessLog = false;
private boolean gzip = true;
private int gzipMinSize = 2048;
private List gzipMimeType = TObject.asList("text/html","text/xml","text/javascript","application/javascript","text/css","text/plain","text/json","application/json");
private HttpsConfig https;
private String indexFiles = "index.htm,index.html,default.htm,default.htm";
private int hotSwapInterval = 0;
private String lifeCycleClass = null;
private String pauseURL = null;
private String scanAopPackage = null;
private int maxRequestSize = 1024;
private boolean cache = true;
private Chain filterConfigs = new Chain();
private List routerConfigs = new Vector();
private List moduleConfigs = new Vector();
public String getServerName() {
if(serverName==null){
serverName = Global.NAME;
}
return serverName;
}
public void setServerName(String serverName) {
this.serverName = serverName;
}
public void setHost(String host) {
this.host = host;
}
public void setPort(int port) {
this.port = port;
}
public void setReadTimeout(int readTimeout) {
this.readTimeout = readTimeout;
}
public void setSendTimeout(int sendTimeout) {
this.sendTimeout = sendTimeout;
}
public void setContextPath(String contextPath) {
this.contextPath = contextPath;
}
public boolean isMatchRouteIgnoreCase() {
return MatchRouteIgnoreCase;
}
public void setMatchRouteIgnoreCase(boolean matchRouteIgnoreCase) {
MatchRouteIgnoreCase = matchRouteIgnoreCase;
}
public void setCharacterSet(String characterSet) {
this.characterSet = characterSet;
this.responseCharacterSet = ";charset="+ characterSet;
}
public String getResponseCharacterSet() {
return responseCharacterSet;
}
public void setSessionContainer(String sessionContainer) {
this.sessionContainer = sessionContainer;
}
public void setSessionTimeout(int sessionTimeout) {
this.sessionTimeout = sessionTimeout;
}
public void setKeepAliveTimeout(int keepAliveTimeout) {
this.keepAliveTimeout = keepAliveTimeout;
}
public String getHost() {
return host;
}
public int getPort() {
return port;
}
public int getReadTimeout() {
return readTimeout;
}
public int getSendTimeout() {
return sendTimeout;
}
public String getContextPath() {
return contextPath;
}
public String getCharacterSet() {
return characterSet;
}
public String getSessionContainer() {
return sessionContainer;
}
public int getSessionTimeout() {
return sessionTimeout;
}
public int getKeepAliveTimeout() {
return keepAliveTimeout;
}
public boolean isGzip() {
return gzip;
}
public void setGzip(boolean gzip) {
this.gzip = gzip;
}
public int getGzipMinSize() {
return gzipMinSize;
}
public void setGzipMinSize(int gzipMinSize) {
this.gzipMinSize = gzipMinSize;
}
public List getGzipMimeType() {
return gzipMimeType;
}
public boolean isAccessLog() {
return accessLog;
}
public void setAccessLog(boolean accessLog) {
this.accessLog = accessLog;
}
public HttpsConfig getHttps() {
return https;
}
public boolean isHttps(){
return https!=null?true:false;
}
public void setHttps(HttpsConfig https) {
this.https = https;
}
public String[] getIndexFiles() {
return indexFiles.split(",");
}
public void setIndexFiles(String indexFiles) {
this.indexFiles = indexFiles;
}
public int getHotSwapInterval() {
return hotSwapInterval;
}
public void setHotSwapInterval(int hotSwapInterval) {
this.hotSwapInterval = hotSwapInterval;
}
public String getLifeCycleClass() {
return lifeCycleClass;
}
public void setLifeCycleClassClass(String lifeCycleClass) {
this.lifeCycleClass = lifeCycleClass;
}
public String getPauseURL() {
return pauseURL;
}
public void setPauseURL(String pauseURL) {
this.pauseURL = pauseURL;
}
public boolean isCache() {
return cache;
}
public void setCache(boolean cache) {
this.cache = cache;
}
public Chain getFilterConfigs() {
return filterConfigs;
}
public List getRouterConfigs() {
return routerConfigs;
}
public List getModuleonfigs() {
return moduleConfigs;
}
public String getScanAopPackage() {
return scanAopPackage;
}
public int getMaxRequestSize() {
return maxRequestSize;
}
public void setMaxRequestSize(int maxRequestSize) {
this.maxRequestSize = maxRequestSize;
}
/**
* 使用列表初始话过滤器链
*
* @param filterInfoList 过滤器信息列表
*/
public void addFilterByList(List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy