public class QuercusContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected long |
_envTimeout |
protected IntMap |
_functionNameMap |
protected static long |
ENV_TIMEOUT_UPDATE_INTERVAL |
static IniDefinition |
INI_ALWAYS_POPULATE_RAW_POST_DATA |
static IniDefinition |
INI_INCLUDE_PATH |
static IniDefinition |
INI_REGISTER_LONG_ARRAYS |
static IniDefinition |
INI_UNICODE_FALLBACK_ENCODING |
static IniDefinition |
INI_UNICODE_FROM_ERROR_MODE |
static IniDefinition |
INI_UNICODE_FROM_ERROR_SUBST_CHAR |
static IniDefinition |
INI_UNICODE_HTTP_INPUT_ENCODING |
static IniDefinition |
INI_UNICODE_OUTPUT_ENCODING |
static IniDefinition |
INI_UNICODE_RUNTIME_ENCODING |
static IniDefinition |
INI_UNICODE_SCRIPT_ENCODING |
static IniDefinition |
INI_UNICODE_SEMANTICS |
Constructor and Description |
---|
QuercusContext()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addImplClass(java.lang.String name,
java.lang.Class<?> type)
Adds a impl class
|
void |
addInitModule(QuercusModule module) |
void |
addJavaClass(java.lang.String name,
java.lang.Class<?> type)
Adds a java class
|
void |
addJavaClass(java.lang.String phpName,
java.lang.String className)
Adds a java class
|
int |
addLowerConstantId(StringValue name)
Returns the id for a constant
|
void |
clearDefinitionCache()
Clears the definition cache.
|
void |
close() |
void |
completeEnv(Env env) |
Env |
createEnv(QuercusPage page,
WriteStream out,
QuercusHttpServletRequest request,
QuercusHttpServletResponse response) |
ExprFactory |
createExprFactory() |
protected ModuleContext |
createModuleContext(ModuleContext parent,
java.lang.ClassLoader loader) |
protected PageManager |
createPageManager() |
protected QuercusSessionManager |
createSessionManager() |
StringValue |
createStaticName() |
StringValue |
createString(java.lang.String name)
Creates a string.
|
UnicodeBuilderValue |
createUnicodeString(java.lang.String name)
Creates a string.
|
void |
destroySession(java.lang.String sessionId)
Removes the session from the backing.
|
protected void |
extendFunctionMap(StringValue name,
int id) |
protected void |
finalize()
Calls close().
|
ClassDef |
findClass(java.lang.String name)
Returns the class with the given name.
|
int |
findClassId(java.lang.String name)
Returns the id for a function name.
|
javax.sql.DataSource |
findDatabase(java.lang.String driver,
java.lang.String url)
Gets the default data source.
|
AbstractFunction |
findFunction(StringValue name)
Returns the function with the given name.
|
int |
findFunctionId(StringValue name)
Returns the id for a function name.
|
AbstractFunction |
findFunctionImpl(StringValue name)
Returns the function with the given name.
|
ClassDef |
findJavaClassWrapper(java.lang.String name)
Finds the java class wrapper.
|
AbstractFunction |
findLowerFunctionImpl(StringValue lowerName)
Returns the function with the given name.
|
QuercusModule |
findModule(java.lang.String name)
Returns the module with the given name.
|
protected java.util.Map<Env,Env> |
getActiveEnvSet() |
QuercusClass |
getCachedClass(int id)
Returns the undefined functions
|
QuercusClass[] |
getClassCacheMap()
Returns the undefined functions
|
ClassDef |
getClassDef(int id)
Returns the class def with the given index.
|
ClassDef[] |
getClassDefMap()
Returns the undefined functions
|
int |
getClassId(java.lang.String className)
Returns the id for a class name.
|
int |
getClassIdCount()
Returns the number of classes
|
java.util.HashMap<java.lang.String,ClassDef> |
getClassMap()
Returns the class maps.
|
java.lang.String |
getClassName(int id) |
java.lang.String |
getClassName(Path path)
Returns the relative path.
|
java.lang.ClassLoader |
getCompileClassLoader()
Returns the compile classloader
|
java.sql.Connection |
getConnection(java.sql.Connection conn)
Unwrap connection if necessary.
|
Value |
getConstant(int id)
Returns a named constant.
|
int |
getConstantId(java.lang.String name)
Returns the id for a constant
|
int |
getConstantId(StringValue name)
Returns the id for a constant
|
int |
getConstantIdCount()
Returns the number of defined constants
|
int |
getConstantLower(int id)
Returns the name map.
|
int |
getConstantLowerId(java.lang.String name)
Returns the constant id.
|
Value[] |
getConstantMap()
Returns the name map.
|
Value |
getConstantName(int id)
Returns the name map.
|
java.lang.String |
getCookieName() |
long |
getCurrentTime()
Returns the current time.
|
javax.sql.DataSource |
getDatabase()
Gets the default data source.
|
long |
getDefCacheHitCount()
Returns the definition cache hit count.
|
long |
getDefCacheMissCount()
Returns the definition cache miss count.
|
ArrayValue |
getDefinedFunctions()
Returns an array of the defined functions.
|
long |
getDependencyCheckInterval() |
long |
getExactTime()
Returns the exact current time in milliseconds.
|
long |
getExactTimeNanoseconds()
Returns the current time in nanoseconds.
|
Value |
getExtensionFuncs(java.lang.String name)
Returns true if an extension is loaded.
|
int |
getFunctionId(StringValue name)
Returns the id for a function name.
|
int |
getFunctionIdCount()
Returns the number of functions
|
AbstractFunction[] |
getFunctionMap()
Returns the undefined functions
|
Path |
getIncludeCache(StringValue include,
java.lang.String includePath,
Path pwd,
Path scriptPwd)
Returns an include path.
|
int |
getIncludeCacheMax() |
long |
getIncludeCacheTimeout() |
boolean |
getIniBoolean(java.lang.String name)
Returns an ini value.
|
IniDefinitions |
getIniDefinitions()
Returns the IniDefinitions for all ini that have been defined by modules.
|
Path |
getIniFile()
Returns the ini file.
|
long |
getIniLong(java.lang.String name)
Returns an ini value as a long.
|
java.util.HashMap<java.lang.String,Value> |
getIniMap(boolean create)
Returns a map of the ini values that have been explicitly set.
|
java.lang.String |
getIniString(java.lang.String name)
Returns an ini value.
|
Value |
getIniValue(java.lang.String name)
Returns an ini value.
|
JavaClassDef |
getJavaClassDefinition(java.lang.Class<?> type,
java.lang.String className)
Adds a java class
|
JavaClassDef |
getJavaClassDefinition(java.lang.String className)
Adds a java class
|
JdbcDriverContext |
getJdbcDriverContext() |
java.util.HashSet<java.lang.String> |
getLoadedExtensions()
Returns the loaded extensions.
|
ModuleContext |
getLocalContext()
Returns the context for this class loader.
|
ModuleContext |
getLocalContext(java.lang.ClassLoader loader) |
ModuleContext |
getModuleContext()
Returns the module context.
|
java.util.Collection<ModuleInfo> |
getModules() |
java.util.HashSet<ModuleStartupListener> |
getModuleStartupListeners()
Returns a list of the modules that have some startup code to run.
|
java.lang.String |
getMysqlVersion()
Returns the mysql version to report to to PHP applications.
|
java.lang.String |
getName() |
java.lang.String |
getOutputEncoding()
Returns the encoding used for output, null if unicode.semantics is off.
|
int |
getPageCacheSize()
Gets the max size of the page cache.
|
java.lang.String |
getPhpVersion() |
int |
getProfileIndex(java.lang.String name) |
Path |
getPwd()
Returns the working directory.
|
QuercusSessionManager |
getQuercusSessionManager() |
int |
getRegexpCacheSize()
Gets the max size of the regexp cache.
|
java.lang.String |
getSapiName()
Returns the SAPI (Server API) name.
|
java.lang.String |
getScriptEncoding()
Returns the expected encoding of php scripts.
|
Value |
getServerEnv(StringValue name)
Gets a server env value.
|
java.util.HashMap<Value,Value> |
getServerEnvMap()
Returns the server env map.
|
QuercusServletContext |
getServletContext()
Returns the ServletContext.
|
Cache |
getSessionCache() |
java.lang.Object |
getSpecial(java.lang.String key)
Loads a special value
|
java.sql.Statement |
getStatement(java.sql.Statement stmt)
Unwrap statement if necessary.
|
QuercusClass |
getStdClass()
Returns the stdClass definition.
|
java.lang.String |
getVersion() |
java.lang.String |
getVersionDate() |
Path |
getWebInfDir() |
Path |
getWorkDir() |
boolean |
includeExists(Path path)
Returns true if a precompiled page exists
|
void |
init()
Initialize the engine
|
protected void |
initLocal()
Initialize local configuration, e.g.
|
boolean |
isAllowUrlFopen()
Returns true if URLs may be arguments of fopen().
|
boolean |
isAllowUrlInclude()
Returns true if URLs may be arguments of include().
|
protected boolean |
isClosed() |
boolean |
isCompile()
true if the pages should be compiled.
|
boolean |
isConnectionPool()
Returns true if connections should be pooled.
|
boolean |
isExtensionLoaded(java.lang.String name)
Returns true if an extension is loaded.
|
boolean |
isLooseParse()
Gets the loose mode.
|
boolean |
isPro()
Returns true if this is the Professional version.
|
boolean |
isProfile() |
boolean |
isRegisterArgv() |
boolean |
isRequireSource()
Returns whether the php source is required for compiled files.
|
boolean |
isResin()
Returns true if Quercus is running under Resin.
|
boolean |
isStrict()
Gets the strict mode.
|
static boolean |
isSuperGlobal(StringValue name)
Returns true if the variable is a superglobal.
|
boolean |
isUnicodeSemantics()
Returns true if unicode.semantics is on.
|
SessionArrayValue |
loadSession(Env env,
java.lang.String sessionId)
Loads the session from the backing.
|
void |
markForPoolRemoval(java.sql.Connection conn)
Marks the connection for removal from the connection pool.
|
static Value |
objectToValue(java.lang.Object obj) |
QuercusPage |
parse(Path path)
Parses a quercus program.
|
QuercusPage |
parse(Path path,
java.lang.String fileName,
int line)
Parses a quercus program.
|
QuercusPage |
parse(ReadStream is)
Parses a quercus program.
|
QuercusProgram |
parseCode(StringValue code)
Parses a quercus string.
|
QuercusProgram |
parseEvalExpr(StringValue code)
Parses a quercus string.
|
AbstractFunction |
parseFunction(java.lang.String name,
java.lang.String args,
java.lang.String code)
Parses a function.
|
void |
putIncludeCache(StringValue include,
java.lang.String includePath,
Path pwd,
Path scriptPwd,
Path path)
Adds an include path.
|
void |
saveSession(Env env,
SessionArrayValue session)
Saves the session to the backing.
|
void |
setCachedClass(int id,
QuercusClass qClass)
Returns the undefined functions
|
void |
setCompile(boolean isCompile)
Set true if pages should be compiled.
|
void |
setCompileClassLoader(java.lang.ClassLoader loader)
Sets the compile classloader
|
void |
setCompileFailover(boolean isCompileFailover)
true if interpreted pages should be used if pages fail to compile.
|
void |
setConnectionPool(boolean isEnable)
Turns connection pooling on or off.
|
void |
setDatabase(javax.sql.DataSource database)
Sets the default data source.
|
void |
setDependencyCheckInterval(long ms) |
int |
setFunction(StringValue name,
AbstractFunction fun) |
void |
setIncludeCacheMax(int cacheMax) |
void |
setIncludeCacheTimeout(long timeout) |
void |
setIni(java.lang.String name,
java.lang.String value)
Sets an ini value.
|
void |
setIni(java.lang.String name,
Value value)
Sets an ini value.
|
void |
setIniFile(Path path)
Sets an ini file.
|
void |
setLazyCompile(boolean isCompile)
Set true if pages should be compiled.
|
void |
setLooseParse(boolean isLoose)
Sets the loose mode.
|
void |
setMysqlVersion(java.lang.String version)
Sets the mysql version to report to applications.
|
void |
setPageCacheSize(int size)
Sets the capacity of the page cache.
|
void |
setPhpVersion(java.lang.String version) |
void |
setProfileProbability(double probability) |
void |
setPwd(Path path)
Sets the working directory.
|
void |
setRegexpCacheSize(int size)
Sets the capacity of the regexp cache.
|
void |
setRequireSource(boolean isRequireSource)
Set to true if compiled pages need to be backed by php source files.
|
void |
setScriptEncoding(java.lang.String encoding)
Sets the expected encoding of php scripts.
|
void |
setServerEnv(java.lang.String name,
java.lang.String value)
Sets a server env value.
|
void |
setServerEnv(StringValue name,
StringValue value)
Sets a server env value.
|
void |
setServletContext(QuercusServletContext servletContext)
Sets the ServletContext.
|
void |
setSessionTimeout(long sessionTimeout) |
void |
setSpecial(java.lang.String key,
java.lang.Object value)
Saves a special value
|
void |
setStrict(boolean isStrict)
Sets the strict mode.
|
void |
setUnicodeSemantics(boolean isUnicode) |
void |
setWebInfDir(Path path) |
void |
setWorkDir(Path workDir) |
void |
start() |
void |
startEnv(Env env) |
protected IntMap _functionNameMap
protected long _envTimeout
protected static final long ENV_TIMEOUT_UPDATE_INTERVAL
public static final IniDefinition INI_INCLUDE_PATH
public static final IniDefinition INI_REGISTER_LONG_ARRAYS
public static final IniDefinition INI_ALWAYS_POPULATE_RAW_POST_DATA
public static final IniDefinition INI_UNICODE_SEMANTICS
public static final IniDefinition INI_UNICODE_FALLBACK_ENCODING
public static final IniDefinition INI_UNICODE_FROM_ERROR_MODE
public static final IniDefinition INI_UNICODE_FROM_ERROR_SUBST_CHAR
public static final IniDefinition INI_UNICODE_HTTP_INPUT_ENCODING
public static final IniDefinition INI_UNICODE_OUTPUT_ENCODING
public static final IniDefinition INI_UNICODE_RUNTIME_ENCODING
public static final IniDefinition INI_UNICODE_SCRIPT_ENCODING
public long getCurrentTime()
public long getExactTimeNanoseconds()
public long getExactTime()
public Path getPwd()
public void setPwd(Path path)
public Path getWebInfDir()
public void setWebInfDir(Path path)
public Path getWorkDir()
public void setWorkDir(Path workDir)
public java.lang.String getCookieName()
public final long getDependencyCheckInterval()
public final void setDependencyCheckInterval(long ms)
public int getIncludeCacheMax()
public void setIncludeCacheMax(int cacheMax)
public void setIncludeCacheTimeout(long timeout)
public long getIncludeCacheTimeout()
public java.lang.String getName()
public java.lang.String getVersion()
public java.lang.String getVersionDate()
public java.lang.String getSapiName()
public boolean isRegisterArgv()
public boolean isProfile()
public int getProfileIndex(java.lang.String name)
public void setProfileProbability(double probability)
protected PageManager createPageManager()
protected QuercusSessionManager createSessionManager()
public final ModuleContext getLocalContext()
public ModuleContext getLocalContext(java.lang.ClassLoader loader)
protected ModuleContext createModuleContext(ModuleContext parent, java.lang.ClassLoader loader)
public ModuleContext getModuleContext()
public QuercusSessionManager getQuercusSessionManager()
public boolean isCompile()
public boolean isPro()
public boolean isResin()
public void setUnicodeSemantics(boolean isUnicode)
public boolean isUnicodeSemantics()
public boolean isAllowUrlInclude()
public boolean isAllowUrlFopen()
public void setCompile(boolean isCompile)
public void setLazyCompile(boolean isCompile)
public void setCompileFailover(boolean isCompileFailover)
public java.lang.String getScriptEncoding()
public void setScriptEncoding(java.lang.String encoding)
public java.lang.String getOutputEncoding()
public java.lang.String getMysqlVersion()
public void setMysqlVersion(java.lang.String version)
public java.lang.String getPhpVersion()
public void setPhpVersion(java.lang.String version)
public void setServletContext(QuercusServletContext servletContext)
public QuercusServletContext getServletContext()
public void setDatabase(javax.sql.DataSource database)
public javax.sql.DataSource getDatabase()
public JdbcDriverContext getJdbcDriverContext()
public javax.sql.DataSource findDatabase(java.lang.String driver, java.lang.String url)
public void markForPoolRemoval(java.sql.Connection conn)
public java.sql.Connection getConnection(java.sql.Connection conn)
public java.sql.Statement getStatement(java.sql.Statement stmt)
public void setStrict(boolean isStrict)
public boolean isStrict()
public void setLooseParse(boolean isLoose)
public boolean isLooseParse()
public int getPageCacheSize()
public void setPageCacheSize(int size)
public int getRegexpCacheSize()
public void setRegexpCacheSize(int size)
public void setRequireSource(boolean isRequireSource)
public boolean isRequireSource()
public void setConnectionPool(boolean isEnable)
public boolean isConnectionPool()
public void addJavaClass(java.lang.String name, java.lang.Class<?> type) throws ConfigException
ConfigException
public void addJavaClass(java.lang.String phpName, java.lang.String className)
public void addImplClass(java.lang.String name, java.lang.Class<?> type) throws ConfigException
ConfigException
public JavaClassDef getJavaClassDefinition(java.lang.Class<?> type, java.lang.String className)
public JavaClassDef getJavaClassDefinition(java.lang.String className)
public ClassDef findJavaClassWrapper(java.lang.String name)
public void setIniFile(Path path)
public Path getIniFile()
public IniDefinitions getIniDefinitions()
public java.util.HashMap<java.lang.String,Value> getIniMap(boolean create)
public void setIni(java.lang.String name, Value value)
public void setIni(java.lang.String name, java.lang.String value)
public boolean getIniBoolean(java.lang.String name)
public long getIniLong(java.lang.String name)
public Value getIniValue(java.lang.String name)
public java.lang.String getIniString(java.lang.String name)
public void setServerEnv(java.lang.String name, java.lang.String value)
public void setServerEnv(StringValue name, StringValue value)
public Value getServerEnv(StringValue name)
public java.lang.ClassLoader getCompileClassLoader()
public void setCompileClassLoader(java.lang.ClassLoader loader)
public final java.lang.String getClassName(Path path)
public Path getIncludeCache(StringValue include, java.lang.String includePath, Path pwd, Path scriptPwd)
public void putIncludeCache(StringValue include, java.lang.String includePath, Path pwd, Path scriptPwd, Path path)
public long getDefCacheHitCount()
public long getDefCacheMissCount()
public void clearDefinitionCache()
public boolean includeExists(Path path)
public QuercusPage parse(Path path) throws java.io.IOException
path
- the source file pathjava.io.IOException
public QuercusPage parse(Path path, java.lang.String fileName, int line) throws java.io.IOException
path
- the source file pathjava.io.IOException
public QuercusPage parse(ReadStream is) throws java.io.IOException
path
- the source file pathjava.io.IOException
public QuercusProgram parseCode(StringValue code) throws java.io.IOException
code
- the source codejava.io.IOException
public QuercusProgram parseEvalExpr(StringValue code) throws java.io.IOException
code
- the source codejava.io.IOException
public AbstractFunction parseFunction(java.lang.String name, java.lang.String args, java.lang.String code) throws java.io.IOException
args
- the argumentscode
- the source codejava.io.IOException
public AbstractFunction findFunction(StringValue name)
public AbstractFunction findFunctionImpl(StringValue name)
public AbstractFunction findLowerFunctionImpl(StringValue lowerName)
public ArrayValue getDefinedFunctions()
public int getFunctionId(StringValue name)
protected void extendFunctionMap(StringValue name, int id)
public int findFunctionId(StringValue name)
public int getFunctionIdCount()
public AbstractFunction[] getFunctionMap()
public int setFunction(StringValue name, AbstractFunction fun)
public int getClassId(java.lang.String className)
public java.lang.String getClassName(int id)
public int findClassId(java.lang.String name)
public int getClassIdCount()
public ClassDef[] getClassDefMap()
public ClassDef getClassDef(int id)
public QuercusClass[] getClassCacheMap()
public QuercusClass getCachedClass(int id)
public void setCachedClass(int id, QuercusClass qClass)
public int getConstantId(java.lang.String name)
public int getConstantId(StringValue name)
public int addLowerConstantId(StringValue name)
public int getConstantLower(int id)
public int getConstantLowerId(java.lang.String name)
public Value getConstantName(int id)
public Value[] getConstantMap()
public int getConstantIdCount()
public static boolean isSuperGlobal(StringValue name)
public QuercusClass getStdClass()
public ClassDef findClass(java.lang.String name)
public java.util.HashMap<java.lang.String,ClassDef> getClassMap()
public QuercusModule findModule(java.lang.String name)
public java.util.HashSet<ModuleStartupListener> getModuleStartupListeners()
public boolean isExtensionLoaded(java.lang.String name)
public java.util.HashSet<java.lang.String> getLoadedExtensions()
public Value getExtensionFuncs(java.lang.String name)
public java.util.Collection<ModuleInfo> getModules()
public void init()
public void addInitModule(QuercusModule module)
public UnicodeBuilderValue createUnicodeString(java.lang.String name)
public StringValue createString(java.lang.String name)
public Value getConstant(int id)
public StringValue createStaticName()
public Cache getSessionCache()
public void setSessionTimeout(long sessionTimeout)
public SessionArrayValue loadSession(Env env, java.lang.String sessionId)
public void saveSession(Env env, SessionArrayValue session)
public void destroySession(java.lang.String sessionId)
public java.lang.Object getSpecial(java.lang.String key)
public void setSpecial(java.lang.String key, java.lang.Object value)
public static Value objectToValue(java.lang.Object obj)
protected void initLocal()
public void start()
public Env createEnv(QuercusPage page, WriteStream out, QuercusHttpServletRequest request, QuercusHttpServletResponse response)
public ExprFactory createExprFactory()
public void startEnv(Env env)
public void completeEnv(Env env)
protected boolean isClosed()
public void close()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable