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
 java.io.Writer getErrorWriter()
          Returns the Writer used to display error output.
static HttpServer getHttpServer()
          Return the http server associated with this VM.
 java.io.Writer getWriter()
          Returns the Writer for scripts to use when displaying output.
 void setContinuation(HttpProxy kont)
          Set the php continuation
 void setErrorWriter(java.io.Writer writer)
          Sets the Writer used to display error output.
 void setWriter(java.io.Writer writer)
          Sets the Writer for scripts to use when displaying output.
 
Methods inherited from class javax.script.SimpleScriptContext
getAttribute, getAttribute, getAttributesScope, getBindings, getReader, getScopes, removeAttribute, setAttribute, setBindings, setReader
 
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 interface: ScriptContext
Returns the Writer for scripts to use when displaying 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:
The Writer.

getErrorWriter

public java.io.Writer getErrorWriter()
Description copied from interface: ScriptContext
Returns the Writer used to display error output.

Specified by:
getErrorWriter in interface ScriptContext
Overrides:
getErrorWriter in class SimpleScriptContext
Returns:
The 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)
Sets the Writer for scripts to use when displaying output.

Specified by:
setWriter in interface ScriptContext
Specified by:
setWriter in interface IPhpScriptContext
Overrides:
setWriter in class SimpleScriptContext
Parameters:
writer - The new Writer.

setErrorWriter

public void setErrorWriter(java.io.Writer writer)
Sets the Writer used to display error output.

Specified by:
setErrorWriter in interface ScriptContext
Overrides:
setErrorWriter in class SimpleScriptContext
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