001/** 002 * Copyright (c) 2015-2022, Michael Yang 杨福海 (fuhai999@gmail.com). 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package io.jboot.web; 017 018import io.jboot.app.config.JbootConfigManager; 019import io.jboot.app.config.annotation.ConfigModel; 020 021/** 022 * @author Michael Yang 杨福海 (fuhai999@gmail.com) 023 * @version V1.0 024 */ 025@ConfigModel(prefix = "jboot.web") 026public class JbootWebConfig { 027 028 public static final String DEFAULT_COOKIE_ENCRYPT_KEY = "JBOOT_DEFAULT_ENCRYPT_KEY"; 029 030 private String cookieEncryptKey = DEFAULT_COOKIE_ENCRYPT_KEY; 031 private int cookieMaxAge = 60 * 60 * 24 * 2; // 2 days(单位:秒) 032 private String webSocketEndpoint; 033 private boolean escapeParasEnable = false; 034 private boolean pathVariableEnable = false; 035 036 public String getCookieEncryptKey() { 037 return cookieEncryptKey; 038 } 039 040 public void setCookieEncryptKey(String cookieEncryptKey) { 041 this.cookieEncryptKey = cookieEncryptKey; 042 } 043 044 public int getCookieMaxAge() { 045 return cookieMaxAge; 046 } 047 048 public void setCookieMaxAge(int cookieMaxAge) { 049 this.cookieMaxAge = cookieMaxAge; 050 } 051 052 public String getWebSocketEndpoint() { 053 return webSocketEndpoint; 054 } 055 056 public void setWebSocketEndpoint(String webSocketEndpoint) { 057 this.webSocketEndpoint = webSocketEndpoint; 058 } 059 060 public boolean isEscapeParasEnable() { 061 return escapeParasEnable; 062 } 063 064 public void setEscapeParasEnable(boolean escapeParasEnable) { 065 this.escapeParasEnable = escapeParasEnable; 066 } 067 068 public boolean isPathVariableEnable() { 069 return pathVariableEnable; 070 } 071 072 public void setPathVariableEnable(boolean pathVariableEnable) { 073 this.pathVariableEnable = pathVariableEnable; 074 } 075 076 private static JbootWebConfig me; 077 078 public static JbootWebConfig getInstance() { 079 if (me == null) { 080 me = JbootConfigManager.me().get(JbootWebConfig.class); 081 } 082 return me; 083 } 084}