php.java.bridge.http
Interface IContext

All Known Subinterfaces:
IPhpScriptContext
All Known Implementing Classes:
AbstractPhpScriptContext, Context, HttpContext, PhpCompiledScriptContext, PhpHttpScriptContext, PhpJavaBridgeRunnerScriptContext, PhpScriptContext, PhpScriptContextDecorator, PhpSecureScriptContext, RemoteContext

public interface IContext

Interface which all contexts must implement. Used when the JSR223 interface is not available.

Author:
jostb

Field Summary
static int ENGINE_SCOPE
          The engine scope
static int GLOBAL_SCOPE
          The global scope
static java.lang.String JAVA_BRIDGE
          This key can be used to get the current JavaBridge instance.
static java.lang.String PHP_PROCEDURE
          This key can be used to get the current continuation.
static java.lang.String SERVLET
          This key can be used to get the current Servlet instance.
static java.lang.String SERVLET_CONFIG
          This key can be used to get the current ServletConfig instance.
static java.lang.String SERVLET_CONTEXT
          This key can be used to get the current ServletContext instance.
static java.lang.String SERVLET_REQUEST
          This key can be used to get the current HttpServletRequest instance.
static java.lang.String SERVLET_RESPONSE
          This key can be used to get the current HttpServletResponse instance.
 
Method Summary
 java.lang.Object get(java.lang.String key)
          Get a binding from the engine scope
 java.util.Map getAll()
          Get all bindings from the engine scope
 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 name, int scope)
          Retrieves the value associated with specified name in the specified level of scope.
 int getAttributesScope(java.lang.String name)
          Retrieves the lowest value of scopes for which the attribute is defined.
 java.lang.Object getHttpServletRequest()
          Return the http servlet request
 java.lang.Object getHttpServletResponse()
          Return the http servlet response
 java.lang.String getRealPath(java.lang.String path)
          Get the full file system path for the given resource.
 java.lang.String getRedirectString()
          Deprecated. Use getRedirectURL(String)
 java.lang.String getRedirectString(java.lang.String webPath)
          Deprecated. Use getRedirectURL(String)
 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
 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.
 void put(java.lang.String key, java.lang.Object val)
          Add a new binding to the engine scope
 void putAll(java.util.Map map)
          Put all bindings to the engine scope
 void remove(java.lang.String key)
          Remove a bindings from the engine scope
 java.lang.Object removeAttribute(java.lang.String name, int scope)
          Removes the specified attribute form the specified level of scope.
 void setAttribute(java.lang.String name, java.lang.Object value, int scope)
          Sets an attribute specified by the name in specified level of scope.
 

Field Detail

ENGINE_SCOPE

static final int ENGINE_SCOPE
The engine scope

See Also:
Constant Field Values

GLOBAL_SCOPE

static final int GLOBAL_SCOPE
The global scope

See Also:
Constant Field Values

PHP_PROCEDURE

static final java.lang.String PHP_PROCEDURE
This key can be used to get the current continuation. Example: java_context->getAttribute("php.java.bridge.PhpProcedure");

See Also:
Constant Field Values

JAVA_BRIDGE

static final java.lang.String JAVA_BRIDGE
This key can be used to get the current JavaBridge instance. Example: java_context->getAttribute("php.java.bridge.JavaBridge");

See Also:
Constant Field Values

SERVLET_CONTEXT

static final java.lang.String SERVLET_CONTEXT
This key can be used to get the current ServletContext instance. Example: java_context->getAttribute("php.java.servlet.ServletContext");

See Also:
Constant Field Values

SERVLET_CONFIG

static final java.lang.String SERVLET_CONFIG
This key can be used to get the current ServletConfig instance. Example: java_context->getAttribute("php.java.servlet.ServletConfig");

See Also:
Constant Field Values

SERVLET

static final java.lang.String SERVLET
This key can be used to get the current Servlet instance. Example: java_context->getAttribute("php.java.servlet.Servlet");

See Also:
Constant Field Values

SERVLET_REQUEST

static final java.lang.String SERVLET_REQUEST
This key can be used to get the current HttpServletRequest instance. Example: java_context->getAttribute("php.java.servlet.HttpServletRequest");

See Also:
Constant Field Values

SERVLET_RESPONSE

static final java.lang.String SERVLET_RESPONSE
This key can be used to get the current HttpServletResponse instance. Example: java_context->getAttribute("php.java.servlet.HttpServletResponse");

See Also:
Constant Field Values
Method Detail

getAttribute

java.lang.Object getAttribute(java.lang.String name)
                              throws java.lang.IllegalArgumentException
Retrieves the value for getAttribute(String, int) for the lowest scope in which it returns a non-null value.

Parameters:
name - the name of the attribute
Returns:
the value of the attribute
Throws:
java.lang.IllegalArgumentException

getAttribute

java.lang.Object getAttribute(java.lang.String name,
                              int scope)
                              throws java.lang.IllegalArgumentException
Retrieves the value associated with specified name in the specified level of scope. Returns null if no value is associated with specified key in specified level of scope.

Parameters:
name - the name of the attribute
scope - the level of scope
Returns:
the value value associated with the specified name in specified level of scope
Throws:
java.lang.IllegalArgumentException

getAttributesScope

int getAttributesScope(java.lang.String name)
Retrieves the lowest value of scopes for which the attribute is defined. If there is no associate scope with the given attribute (-1) is returned.

Parameters:
name - the name of attribute
Returns:
the value of level of scope

getWriter

java.io.Writer getWriter()
                         throws java.io.IOException
Retrieves an instance of java.io.Writer which can be used by scripts to display their output.

Returns:
an instance of java.io.Writer
Throws:
java.io.IOException

removeAttribute

java.lang.Object removeAttribute(java.lang.String name,
                                 int scope)
                                 throws java.lang.IllegalArgumentException
Removes the specified attribute form the specified level of scope.

Parameters:
name - the name of the attribute
scope - the level of scope
Returns:
value which is removed
Throws:
java.lang.IllegalArgumentException

setAttribute

void setAttribute(java.lang.String name,
                  java.lang.Object value,
                  int scope)
                  throws java.lang.IllegalArgumentException
Sets an attribute specified by the name in specified level of scope.

Parameters:
name - the name of the attribute
value - the value of the attribute
scope - the level of the scope
Throws:
java.lang.IllegalArgumentException - if the name is null scope is invlaid

getHttpServletResponse

java.lang.Object getHttpServletResponse()
Return the http servlet response

Returns:
The http servlet reponse

getHttpServletRequest

java.lang.Object getHttpServletRequest()
Return the http servlet request

Returns:
The http servlet request

getServlet

java.lang.Object getServlet()
Return the http servlet

Returns:
The http servlet

getServletConfig

java.lang.Object getServletConfig()
Return the servlet config

Returns:
The servlet config

getServletContext

java.lang.Object getServletContext()
Return the servlet context

Returns:
The servlet context

getRealPath

java.lang.String getRealPath(java.lang.String path)
Get the full file system path for the given resource.

Parameters:
path - the relative path to an existing resource
Returns:
the file system path

put

void put(java.lang.String key,
         java.lang.Object val)
Add a new binding to the engine scope

Parameters:
key - the key
val - the value

get

java.lang.Object get(java.lang.String key)
Get a binding from the engine scope

Parameters:
key - the key
Returns:
the value

remove

void remove(java.lang.String key)
Remove a bindings from the engine scope

Parameters:
key - the key

putAll

void putAll(java.util.Map map)
Put all bindings to the engine scope

Parameters:
map - the map

getAll

java.util.Map getAll()
Get all bindings from the engine scope

Returns:
the map

getRedirectURL

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

Parameters:
webPath - Usually request.getContextPath()+request.getServletPath()
Returns:
the redirect string

getRedirectString

java.lang.String getRedirectString(java.lang.String webPath)
Deprecated. Use getRedirectURL(String)


getRedirectString

java.lang.String getRedirectString()
Deprecated. Use getRedirectURL(String)


getSocketName

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

Returns:
the socket name