001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.listener; 020 021import java.io.Serializable; 022 023import lucee.commons.io.res.Resource; 024import lucee.runtime.Mapping; 025import lucee.runtime.PageContext; 026import lucee.runtime.exp.PageException; 027import lucee.runtime.net.s3.Properties; 028import lucee.runtime.orm.ORMConfiguration; 029import lucee.runtime.rest.RestSettings; 030import lucee.runtime.type.dt.TimeSpan; 031 032/** 033 * DTO Interface for Application Context data (defined by tag application) 034 */ 035public interface ApplicationContext extends Serializable { 036 037 public static final int SCRIPT_PROTECT_NONE = 0; 038 public static final int SCRIPT_PROTECT_FORM = 1; 039 public static final int SCRIPT_PROTECT_URL = 2; 040 public static final int SCRIPT_PROTECT_CGI = 4; 041 public static final int SCRIPT_PROTECT_COOKIE = 8; 042 public static final int SCRIPT_PROTECT_ALL = SCRIPT_PROTECT_CGI+SCRIPT_PROTECT_COOKIE+SCRIPT_PROTECT_FORM+SCRIPT_PROTECT_URL; 043 044 /** 045 * @return Returns the applicationTimeout. 046 */ 047 public abstract TimeSpan getApplicationTimeout(); 048 049 /** 050 * @return Returns the loginStorage. 051 */ 052 public abstract int getLoginStorage(); 053 054 /** 055 * @return Returns the name. 056 */ 057 public abstract String getName(); 058 059 /** 060 * @return Returns the sessionTimeout. 061 */ 062 public abstract TimeSpan getSessionTimeout(); 063 064 /** 065 * @return Returns the setClientCookies. 066 */ 067 public abstract boolean isSetClientCookies(); 068 069 /** 070 * @return Returns the setClientManagement. 071 */ 072 public abstract boolean isSetClientManagement(); 073 074 /** 075 * @return Returns the setDomainCookies. 076 */ 077 public abstract boolean isSetDomainCookies(); 078 079 /** 080 * @return Returns the setSessionManagement. 081 */ 082 public abstract boolean isSetSessionManagement(); 083 084 /** 085 * @return Returns the clientstorage. 086 */ 087 public abstract String getClientstorage(); 088 089 /** 090 * @return if application context has a name 091 */ 092 public abstract boolean hasName(); 093 094 /** 095 * @return return script protect setting 096 */ 097 public int getScriptProtect(); 098 099 100 public Mapping[] getMappings(); 101 102 public Mapping[] getCustomTagMappings(); 103 104 105 public String getSecureJsonPrefix() ; 106 107 public boolean getSecureJson(); 108 109 // FUTURE deprecated use instead getDefDataSource() 110 public String getDefaultDataSource(); 111 112 public boolean isORMEnabled(); 113 114 // FUTURE deprecated use instead getDefaultDataSource() 115 public String getORMDatasource(); 116 117 public ORMConfiguration getORMConfiguration(); 118 119 public Properties getS3(); 120 121 public int getLocalMode(); 122 123 public String getSessionstorage(); 124 125 public TimeSpan getClientTimeout(); 126 127 public short getSessionType(); 128 129 public boolean getSessionCluster(); 130 131 public boolean getClientCluster(); 132 133 public Mapping[] getComponentMappings(); 134 135 136 137 138 139 140 141 public void setApplicationTimeout(TimeSpan applicationTimeout); 142 public void setSessionTimeout(TimeSpan sessionTimeout); 143 public void setClientTimeout(TimeSpan clientTimeout); 144 public void setClientstorage(String clientstorage); 145 public void setSessionstorage(String sessionstorage); 146 public void setCustomTagMappings(Mapping[] customTagMappings); 147 public void setComponentMappings(Mapping[] componentMappings); 148 public void setMappings(Mapping[] mappings); 149 public void setLoginStorage(int loginstorage); 150 public void setDefaultDataSource(String datasource); 151 public void setScriptProtect(int scriptrotect); 152 public void setSecureJson(boolean secureJson); 153 public void setSecureJsonPrefix(String secureJsonPrefix); 154 public void setSetClientCookies(boolean setClientCookies); 155 public void setSetClientManagement(boolean setClientManagement); 156 public void setSetDomainCookies(boolean setDomainCookies); 157 public void setSetSessionManagement(boolean setSessionManagement); 158 public void setLocalMode(int localMode); 159 public void setSessionType(short sessionType); 160 public void setClientCluster(boolean clientCluster); 161 public void setSessionCluster(boolean sessionCluster); 162 public void setS3(Properties s3); 163 public void setORMEnabled(boolean ormenabled); 164 public void setORMConfiguration(ORMConfiguration ormConf); 165 public void setORMDatasource(String string); 166 167 public String getSecurityApplicationToken(); 168 public String getSecurityCookieDomain(); 169 public int getSecurityIdleTimeout(); 170 public void setSecuritySettings(String applicationtoken,String cookiedomain, int idletimeout); 171 172 public void reinitORM(PageContext pc) throws PageException ; 173 174 public Resource getSource(); 175 176 177 178 public boolean getTriggerComponentDataMember(); 179 public void setTriggerComponentDataMember(boolean triggerComponentDataMember); 180 181 /** 182 * return the default cache name for a certain type 183 * @param type can be one of the following constants Config.CACHE_DEFAULT_OBJECT, Config.CACHE_DEFAULT_TEMPLATE, Config.CACHE_DEFAULT_QUERY, Config.CACHE_DEFAULT_RESOURCE, Config.CACHE_DEFAULT_FUNCTION 184 * @return name of the cache defined 185 */ 186 public String getDefaultCacheName(int type); 187 188 public void setDefaultCacheName(int type, String cacheName); 189 190 /** 191 * merge the field with same name to array if true, otherwise to a comma separated string list 192 * @param scope scope type, one of the following: Scope.SCOPE_FORM or Scope.SCOPE_URL 193 * @return 194 */ 195 public boolean getSameFieldAsArray(int scope); 196 197 public RestSettings getRestSettings(); 198 199 public JavaSettings getJavaSettings(); 200 201 public Resource[] getRestCFCLocations(); 202}