php.java.script
Class AbstractPhpScriptContext

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

public abstract class AbstractPhpScriptContext
extends SimpleScriptContext
implements IContext, IPhpScriptContext

A simple ScriptContext which can be used in servlet- or standalone environments.

Author:
jostb

Field Summary
static int APPLICATION_SCOPE
          Integer value for the level of APPLICATION_SCOPE
static int REQUEST_SCOPE
          Integer value for the level of SCRIPT_SCOPE
static int SESSION_SCOPE
          Integer value for the level of SESSION_SCOPE
 
Fields inherited from interface php.java.bridge.http.IContext
ENGINE_SCOPE, GLOBAL_SCOPE, JAVA_BRIDGE, SERVLET, SERVLET_CONFIG, SERVLET_CONTEXT, SERVLET_REQUEST, SERVLET_RESPONSE
 
Fields inherited from interface javax.script.ScriptContext
ENGINE_SCOPE, GLOBAL_SCOPE
 
Constructor Summary
AbstractPhpScriptContext()
           
 
Method Summary
 boolean call(PhpProcedureProxy kont)
          Call the java continuation with the current continuation kont as its argument.
abstract  java.lang.String getContextString()
          Return the context string, for example http://localhost:8080/JavaBridge
 HttpProxy getContinuation()
          Get the php continuation
 java.io.Writer getErrorWriter()
          Returns the Writer used to display error output.
abstract  java.lang.String getSocketName()
          Return the socket name, for example 8080
 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
 
Methods inherited from interface php.java.bridge.http.IContext
getAttribute, getAttribute, getAttributesScope, removeAttribute, setAttribute
 

Field Detail

REQUEST_SCOPE

public static final int REQUEST_SCOPE
Integer value for the level of SCRIPT_SCOPE

See Also:
Constant Field Values

SESSION_SCOPE

public static final int SESSION_SCOPE
Integer value for the level of SESSION_SCOPE

See Also:
Constant Field Values

APPLICATION_SCOPE

public static final int APPLICATION_SCOPE
Integer value for the level of APPLICATION_SCOPE

See Also:
Constant Field Values
Constructor Detail

AbstractPhpScriptContext

public AbstractPhpScriptContext()
Method Detail

getWriter

public java.io.Writer getWriter()
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()
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)
Description copied from interface: IPhpScriptContext
Set the php continuation

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

getContinuation

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

Specified by:
getContinuation in interface IPhpScriptContext
Returns:
The HttpProxy

call

public boolean call(PhpProcedureProxy kont)
             throws java.lang.Exception
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.Exception

setWriter

public void setWriter(java.io.Writer writer)
Sets the Writer for scripts to use when displaying output. TODO: test

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.

getSocketName

public abstract java.lang.String getSocketName()
Return the socket name, for example 8080

Specified by:
getSocketName in interface IPhpScriptContext
Returns:
the socket name

getContextString

public abstract java.lang.String getContextString()
Return the context string, for example http://localhost:8080/JavaBridge

Specified by:
getContextString in interface IPhpScriptContext
Returns:
the context string