php.java.script
Class AbstractPhpScriptContext

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

public abstract class AbstractPhpScriptContext
extends ScriptContextDecorator
implements IPhpScriptContext

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

Author:
jostb

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
 
Fields inherited from interface javax.script.ScriptContext
ENGINE_SCOPE, GLOBAL_SCOPE
 
Constructor Summary
AbstractPhpScriptContext(ScriptContext ctx)
           
 
Method Summary
 boolean call(java.lang.Object kont)
          Call the java continuation with the current continuation kont as its argument.
 Continuation getContinuation()
          Get the php continuation
 java.io.Writer getErrorWriter()
          Returns the Writer used to display error output.
 java.io.Writer getWriter()
          Returns the Writer for scripts to use when displaying output.
 void setContinuation(Continuation 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.
 void startContinuation()
          Start the current continuation using a context-specific thread pool
 
Methods inherited from class php.java.script.ScriptContextDecorator
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.script.IPhpScriptContext
createContinuation, getContextServer
 
Methods inherited from interface php.java.bridge.IManaged
init, onShutdown
 
Methods inherited from interface php.java.bridge.http.IContext
get, getAll, getAttribute, getAttribute, getAttributesScope, getHttpServletRequest, getHttpServletResponse, getRealPath, getRedirectString, getRedirectString, getRedirectURL, getServlet, getServletConfig, getServletContext, getSocketName, put, putAll, remove, removeAttribute, setAttribute
 
Methods inherited from interface javax.script.ScriptContext
getAttribute, getAttribute, getAttributesScope, getBindings, getReader, getScopes, removeAttribute, setAttribute, setBindings, setReader
 

Constructor Detail

AbstractPhpScriptContext

public AbstractPhpScriptContext(ScriptContext ctx)
Method Detail

getWriter

public java.io.Writer getWriter()
Description copied from class: ScriptContextDecorator
Returns the Writer for scripts to use when displaying output.

Specified by:
getWriter in interface ScriptContext
Specified by:
getWriter in interface IContext
Overrides:
getWriter in class ScriptContextDecorator
Returns:
The Writer.

getErrorWriter

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

Specified by:
getErrorWriter in interface ScriptContext
Overrides:
getErrorWriter in class ScriptContextDecorator
Returns:
The Writer

startContinuation

public void startContinuation()
Start the current continuation using a context-specific thread pool

Specified by:
startContinuation in interface IPhpScriptContext

setContinuation

public void setContinuation(Continuation kont)
Description copied from interface: IPhpScriptContext
Set the php continuation

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

getContinuation

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

Specified by:
getContinuation in interface IPhpScriptContext
Returns:
The HttpProxy

call

public boolean call(java.lang.Object 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
Overrides:
setWriter in class ScriptContextDecorator
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 ScriptContextDecorator
Parameters:
writer - The Writer.