|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectphp.java.bridge.http.Context
public class Context
Emulates a JSR223 script context when the JSR223 classes are not available.
The method call(kont) returns false, so that it can be used to check if a script was called from java:
function toString() {return "hello java, I am a php script, but in your eyes I am an ordinary java object...";}
java_context()->call(java_closure()) || die("This script must be called from java!");
IPhpScriptContext,
ScriptContext,
PhpScriptContext| Field Summary |
|---|
| Fields inherited from interface php.java.bridge.http.IContext |
|---|
ENGINE_SCOPE, GLOBAL_SCOPE, JAVA_BRIDGE, SERVLET, SERVLET_CONFIG, SERVLET_CONTEXT, SERVLET_REQUEST, SERVLET_RESPONSE |
| Method Summary | |
|---|---|
boolean |
call(PhpProcedureProxy kont)
Call the java continuation with the current continuation kont as its argument. |
java.lang.Object |
getAttribute(java.lang.String name)
Retrieves the value for getAttribute(String, int) for the lowest scope in which it returns a non-null value. |
java.lang.Object |
getAttribute(java.lang.String name,
int scope)
Retrieves the value associated with specified name in the specified level of scope. |
int |
getAttributesScope(java.lang.String name)
Retrieves the lowest value of scopes for which the attribute is defined. |
java.lang.Object |
getHttpServletRequest()
Throws IllegalStateException |
java.lang.Object |
getHttpServletResponse()
Throws IllegalStateException |
static java.lang.Object |
getManageable(java.lang.Object callable)
Only for internal use |
java.lang.String |
getRealPath(java.lang.String path)
Get the full file system path for the given resource. |
static java.lang.String |
getRealPathInternal(java.lang.String path)
Only for internal use |
java.lang.Object |
getServlet()
Throws IllegalStateException |
java.lang.Object |
getServletConfig()
Throws IllegalStateException |
java.lang.Object |
getServletContext()
Throws IllegalStateException |
java.io.Writer |
getWriter()
Retrieves an instance of java.io.Writer which can be used by scripts to display their output. |
static void |
handleManaged(java.lang.Object closeable)
Only for internal use. |
java.lang.Object |
init(java.lang.Object callable)
Initialize a library. |
void |
onShutdown(java.lang.Object closeable)
Register a shutdown hook for the library. |
java.lang.Object |
removeAttribute(java.lang.String name,
int scope)
Removes the specified attribute form the specified level of scope. |
void |
setAttribute(java.lang.String name,
java.lang.Object value,
int scope)
Sets an attribute specified by the name in specified level of scope. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public java.lang.Object getAttribute(java.lang.String name)
throws java.lang.IllegalArgumentException
getAttribute in interface IContextname - the name of the attribute
java.lang.IllegalArgumentException
public java.lang.Object getAttribute(java.lang.String name,
int scope)
throws java.lang.IllegalArgumentException
getAttribute in interface IContextname - the name of the attributescope - the level of scope
java.lang.IllegalArgumentExceptionpublic int getAttributesScope(java.lang.String name)
getAttributesScope in interface IContextname - the name of attribute
public java.io.Writer getWriter()
throws java.io.IOException
getWriter in interface IContextjava.io.IOException
public java.lang.Object removeAttribute(java.lang.String name,
int scope)
throws java.lang.IllegalArgumentException
removeAttribute in interface IContextname - the name of the attributescope - the level of scope
java.lang.IllegalArgumentException
public void setAttribute(java.lang.String name,
java.lang.Object value,
int scope)
throws java.lang.IllegalArgumentException
setAttribute in interface IContextname - the name of the attributevalue - the value of the attributescope - the level of the scope
java.lang.IllegalArgumentException - if the name is null scope is
invlaidpublic java.lang.Object getHttpServletRequest()
getHttpServletRequest in interface IContextpublic java.lang.Object getServletContext()
getServletContext in interface IContextpublic java.lang.Object getHttpServletResponse()
getHttpServletResponse in interface IContextpublic java.lang.Object getServlet()
getServlet in interface IContextpublic java.lang.Object getServletConfig()
getServletConfig in interface IContextpublic boolean call(PhpProcedureProxy kont)
Invocablekont as its argument.
call in interface Invocablekont - dummy
public static void handleManaged(java.lang.Object closeable)
closeable - The procedure close(), will be called before the VM terminates
public static java.lang.Object getManageable(java.lang.Object callable)
throws java.lang.Exception
callable - The callable
java.lang.Exception
public java.lang.Object init(java.lang.Object callable)
throws java.lang.Exception
init in interface IManagedcallable - Its call() method will be called synchronized.
java.lang.Exceptionpublic void onShutdown(java.lang.Object closeable)
onShutdown in interface IManagedcloseable - Its close() method will be called before the context or the VM terminates.public static java.lang.String getRealPathInternal(java.lang.String path)
path - the path
public java.lang.String getRealPath(java.lang.String path)
getRealPath in interface IContextpath - the relative path to an existing resource
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||