php.java.script
Class PhpScriptContext

java.lang.Object
  extended by javax.script.SimpleScriptContext
      extended by php.java.script.PhpScriptContext
All Implemented Interfaces:
ScriptContext, IContext, Invocable, IPhpScriptContext

public class PhpScriptContext
extends SimpleScriptContext
implements IContext, IPhpScriptContext

This class implements a simple script context for PHP. It starts a standalone JavaBridgeRunner which listens for requests from php instances.

In a servlet environment please use a php.java.script.PhpSimpleHttpScriptContext instead.

Author:
jostb
See Also:
PhpSimpleHttpScriptContext, JavaBridgeRunner

Field Summary
 
Fields inherited from interface javax.script.ScriptContext
ENGINE_SCOPE, GLOBAL_SCOPE
 
Constructor Summary
PhpScriptContext()
          Create a standalone PHP script context.
 
Method Summary
 boolean call(PhpProcedureProxy kont)
          Call the java continuation with the current continuation kont as its argument.
 HttpProxy getContinuation()
          Get the php continuation
static HttpServer getHttpServer()
          Return the http server associated with this VM.
 java.io.Writer getWriter()
          Retrieves an instance of java.io.Writer which can be used by scripts to display their output.
 void setContinuation(HttpProxy kont)
          Set the php continuation
 void setWriter(java.io.Writer writer)
          Set the Writer
 
Methods inherited from class javax.script.SimpleScriptContext
getAttribute, getAttribute, getAttributesScope, getBindings, removeAttribute, setAttribute, setBindings
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhpScriptContext

public PhpScriptContext()
Create a standalone PHP script context.

Method Detail

getHttpServer

public static HttpServer getHttpServer()
Return the http server associated with this VM.

Returns:
The http server.

getWriter

public java.io.Writer getWriter()
Description copied from class: SimpleScriptContext
Retrieves an instance of java.io.Writer which can be used by scripts to display their output.

Specified by:
getWriter in interface ScriptContext
Specified by:
getWriter in interface IContext
Specified by:
getWriter in interface IPhpScriptContext
Overrides:
getWriter in class SimpleScriptContext
Returns:
an instance of java.io.Writer

setContinuation

public void setContinuation(HttpProxy kont)
Set the php continuation

Specified by:
setContinuation in interface IPhpScriptContext
Parameters:
kont - - The continuation.

call

public boolean call(PhpProcedureProxy kont)
             throws java.lang.InterruptedException
Description copied from interface: Invocable
Call the java continuation with the current continuation kont as its argument.

Specified by:
call in interface Invocable
Parameters:
kont - The continuation.
Returns:
True on success, false otherwise.
Throws:
java.lang.InterruptedException

setWriter

public void setWriter(java.io.Writer writer)
Description copied from interface: IPhpScriptContext
Set the Writer

Specified by:
setWriter in interface IPhpScriptContext
Parameters:
writer - The writer

getContinuation

public HttpProxy getContinuation()
Description copied from interface: IPhpScriptContext
Get the php continuation

Specified by:
getContinuation in interface IPhpScriptContext
Returns:
The HttpProxy