|
||||||||||
| 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, PHP_PROCEDURE, SERVLET, SERVLET_CONFIG, SERVLET_CONTEXT, SERVLET_REQUEST, SERVLET_RESPONSE |
| Method Summary | |
|---|---|
boolean |
call(java.lang.Object kont)
Call the java continuation with the current continuation kont as its argument. |
java.lang.Object |
get(java.lang.String key)
Get a binding from the engine scope |
java.util.Map |
getAll()
Get all bindings from the engine scope |
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.String |
getRedirectString()
Deprecated. |
java.lang.String |
getRedirectString(java.lang.String webPath)
Deprecated. |
java.lang.String |
getRedirectURL(java.lang.String webPath)
Return the redirect string, for example http://localhost:8080/webPath Used by the non-compiling script engines to hard-code the back-end URL in the Java.inc |
java.lang.Object |
getServlet()
Throws IllegalStateException |
java.lang.Object |
getServletConfig()
Throws IllegalStateException |
java.lang.Object |
getServletContext()
Throws IllegalStateException |
java.lang.String |
getSocketName()
Return the socket name, for example 8080 |
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. |
void |
put(java.lang.String key,
java.lang.Object val)
Add a new binding to the engine scope |
void |
putAll(java.util.Map map)
Put all bindings to the engine scope |
void |
remove(java.lang.String key)
Remove a bindings from the engine scope |
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(java.lang.Object 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
public java.lang.Object get(java.lang.String key)
get in interface IContextkey - the key
public void put(java.lang.String key,
java.lang.Object val)
put in interface IContextkey - the keyval - the valuepublic void remove(java.lang.String key)
remove in interface IContextkey - the keypublic void putAll(java.util.Map map)
putAll in interface IContextmap - the mappublic java.util.Map getAll()
getAll in interface IContextpublic java.lang.String getSocketName()
getSocketName in interface IContextpublic java.lang.String getRedirectString()
getRedirectString in interface IContextpublic java.lang.String getRedirectString(java.lang.String webPath)
getRedirectString in interface IContextpublic java.lang.String getRedirectURL(java.lang.String webPath)
getRedirectURL in interface IContextwebPath - Usually request.getContextPath()+request.getServletPath()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||