| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectphp.java.script.PhpScriptContextDecorator
php.java.script.servlet.PhpHttpScriptContext
public class PhpHttpScriptContext
An example decorator for compiled script engines running in a servlet environment. Use
 
 static final CompiledScript script = ((Compilable)(new ScriptEngineManager().getEngineByName("php-invocable"))).compile("");
 
 script.eval(new php.java.script.servlet.PhpCompiledHttpScriptContext(script.getEngine().getContext(),this,application,request,response));
 
 
| Field Summary | |
|---|---|
| static int | APPLICATION_SCOPEInteger value for the level of APPLICATION_SCOPE | 
| static int | REQUEST_SCOPEInteger value for the level of SCRIPT_SCOPE | 
| static int | SESSION_SCOPEInteger value for the level of SESSION_SCOPE | 
| 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 | |
|---|---|
| PhpHttpScriptContext(ScriptContext ctx,
                     javax.servlet.Servlet servlet,
                     javax.servlet.ServletContext context,
                     javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response)Create a new PhpCompiledScriptContext using an existing PhpScriptContext | |
| Method Summary | |
|---|---|
|  Continuation | createContinuation(java.io.Reader reader,
                   java.util.Map env,
                   java.io.OutputStream out,
                   java.io.OutputStream err,
                   HeaderParser headerParser,
                   ResultProxy result,
                   ILogger logger,
                   boolean isCompiled)Create a continuation | 
|  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 key,
             int scope)Retrieves the value associated with specified name in the specified level of scope. | 
|  javax.servlet.ServletContext | getContext()Get the ServletContext | 
|  ContextServer | getContextServer()Get the context server associated with this context, usually a HttpServer (JavaBridgeRunner) or a ContextServer from a ContextLoaderListener | 
|  java.io.Writer | getErrorWriter()Returns the Writerused to display error output. | 
|  java.lang.Object | getHttpServletRequest()Return the http servlet request | 
|  java.lang.Object | getHttpServletResponse()Return the http servlet response | 
|  java.io.Reader | getReader()Returns a Readerto be used by the script to read
 input. | 
|  java.lang.String | getRealPath(java.lang.String path)Get the full file system path for the given resource. | 
|  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 | 
|  javax.servlet.http.HttpServletRequest | getRequest()Get the HttpServletRequest | 
|  javax.servlet.http.HttpServletResponse | getResponse()Get the servlet response | 
|  java.lang.Object | getServlet()Return the http servlet | 
|  java.lang.Object | getServletConfig()Return the servlet config | 
|  java.lang.Object | getServletContext()Return the servlet context | 
|  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. | 
|  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 | setAttribute(java.lang.String key,
             java.lang.Object value,
             int scope)Sets an attribute specified by the name in specified level of scope. | 
|  void | setErrorWriter(java.io.Writer errorWriter)Sets the Writerused to display error output. | 
|  void | setReader(java.io.Reader reader)Sets the Readerfor scripts to read input
 . | 
|  void | setWriter(java.io.Writer writer)Sets the Writerfor 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.PhpScriptContextDecorator | 
|---|
| call, get, getAll, getAttributesScope, getBindings, getContinuation, getScopes, put, putAll, remove, removeAttribute, setBindings, setContinuation | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final int REQUEST_SCOPE
public static final int SESSION_SCOPE
public static final int APPLICATION_SCOPE
| Constructor Detail | 
|---|
public PhpHttpScriptContext(ScriptContext ctx,
                            javax.servlet.Servlet servlet,
                            javax.servlet.ServletContext context,
                            javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
ctx - the script context to be decorated| Method Detail | 
|---|
public Continuation createContinuation(java.io.Reader reader,
                                       java.util.Map env,
                                       java.io.OutputStream out,
                                       java.io.OutputStream err,
                                       HeaderParser headerParser,
                                       ResultProxy result,
                                       ILogger logger,
                                       boolean isCompiled)
createContinuation in interface IPhpScriptContextcreateContinuation in class PhpScriptContextDecoratorreader - the script readerenv - the environment passed to phpout - the fcgi output streamerr - the fcgi error streamheaderParser - fcgi header parserresult - the result proxylogger - the loggerisCompiled - create a continuation for a compiled or non-compiled script engine
public void startContinuation()
PhpScriptContextDecorator
startContinuation in interface IPhpScriptContextstartContinuation in class PhpScriptContextDecorator
public java.lang.Object getAttribute(java.lang.String key,
                                     int scope)
getAttribute in interface ScriptContextgetAttribute in interface IContextgetAttribute in class PhpScriptContextDecoratorkey - the name of the attributescope - the level of scope
public java.lang.Object getAttribute(java.lang.String name)
                              throws java.lang.IllegalArgumentException
getAttribute in interface ScriptContextgetAttribute in interface IContextgetAttribute in class PhpScriptContextDecoratorname - the name of the attribute
java.lang.IllegalArgumentException - if the name is null
public void setAttribute(java.lang.String key,
                         java.lang.Object value,
                         int scope)
                  throws java.lang.IllegalArgumentException
setAttribute in interface ScriptContextsetAttribute in interface IContextsetAttribute in class PhpScriptContextDecoratorkey - 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 javax.servlet.http.HttpServletResponse getResponse()
public javax.servlet.http.HttpServletRequest getRequest()
public javax.servlet.ServletContext getContext()
public java.io.Writer getWriter()
getWriter in interface ScriptContextgetWriter in interface IContextgetWriter in class PhpScriptContextDecoratorpublic void setWriter(java.io.Writer writer)
Writer for scripts to use when displaying output.
setWriter in interface ScriptContextsetWriter in class PhpScriptContextDecoratorwriter - The new Writer.public java.io.Writer getErrorWriter()
Writer used to display error output.
getErrorWriter in interface ScriptContextgetErrorWriter in class PhpScriptContextDecoratorWriterpublic void setErrorWriter(java.io.Writer errorWriter)
Writer used to display error output.
setErrorWriter in interface ScriptContextsetErrorWriter in class PhpScriptContextDecoratorerrorWriter - The Writer.public java.io.Reader getReader()
Reader to be used by the script to read
 input.
getReader in interface ScriptContextgetReader in class PhpScriptContextDecoratorReader.public void setReader(java.io.Reader reader)
PhpScriptContextDecoratorReader for scripts to read input
 .
setReader in interface ScriptContextsetReader in class PhpScriptContextDecoratorreader - The new Reader.
public java.lang.Object init(java.lang.Object callable)
                      throws java.lang.Exception
init in interface IManagedinit in class PhpScriptContextDecoratorcallable - Its call() method will be called synchronized.
java.lang.Exception - The result of the call() invocation.public void onShutdown(java.lang.Object closeable)
onShutdown in interface IManagedonShutdown in class PhpScriptContextDecoratorcloseable - Its close() method will be called before the context or the VM terminates.public java.lang.Object getHttpServletResponse()
getHttpServletResponse in interface IContextgetHttpServletResponse in class PhpScriptContextDecoratorpublic java.lang.Object getHttpServletRequest()
getHttpServletRequest in interface IContextgetHttpServletRequest in class PhpScriptContextDecoratorpublic java.lang.Object getServlet()
getServlet in interface IContextgetServlet in class PhpScriptContextDecoratorpublic java.lang.Object getServletConfig()
getServletConfig in interface IContextgetServletConfig in class PhpScriptContextDecoratorpublic java.lang.Object getServletContext()
getServletContext in interface IContextgetServletContext in class PhpScriptContextDecoratorpublic java.lang.String getRealPath(java.lang.String path)
getRealPath in interface IContextgetRealPath in class PhpScriptContextDecoratorpath - the relative path to an existing resource
public java.lang.String getRedirectString(java.lang.String webPath)
getRedirectString in interface IContextgetRedirectString in class PhpScriptContextDecoratorpublic java.lang.String getRedirectString()
getRedirectString in interface IContextgetRedirectString in class PhpScriptContextDecoratorpublic java.lang.String getRedirectURL(java.lang.String webPath)
getRedirectURL in interface IContextgetRedirectURL in class PhpScriptContextDecoratorwebPath - Usually request.getContextPath()+request.getServletPath()
public java.lang.String getSocketName()
getSocketName in interface IContextgetSocketName in class PhpScriptContextDecoratorpublic ContextServer getContextServer()
getContextServer in interface IPhpScriptContextgetContextServer in class PhpScriptContextDecorator| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||