php.java.bridge
Class JavaBridgeRunner

java.lang.Object
  extended by php.java.bridge.http.HttpServer
      extended by php.java.bridge.JavaBridgeRunner
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
JavaBridgeScriptRunner

public class JavaBridgeRunner
extends HttpServer

This is the main entry point for the PHP/Java Bridge library. Example:
public MyClass {
  public static void main(String s[]) {
     JavaBridgeRunner runner = JavaBridgeRunner.getInstance();
     // connect to port 9267 and send protocol requests ...
    runner.destroy();
  }
}

Author:
jostb
See Also:
PhpScriptContext

Field Summary
 
Fields inherited from class php.java.bridge.http.HttpServer
GET, POST, PUT
 
Method Summary
 ISocketFactory bind(java.lang.String addr)
          Create a server socket.
 ISocketFactory bindSecure(java.lang.String addr)
          Create a server socket.
static void destroyRunner()
          Destroy the JavaBridgeRunner instance
 ContextServer getContextServer()
          Return the ContextServer
static JavaBridgeRunner getInstance(java.lang.String serverPort)
          Return a instance.
static JavaBridgeRunner getInstance(java.lang.String serverPort, boolean isSecure)
          Return a instance.
static JavaBridgeRunner getRequiredInstance()
          Return a instance.
static JavaBridgeRunner getRequiredInstance(java.lang.String serverPort)
          Return a instance.
static JavaBridgeRunner getRequiredInstance(java.lang.String serverPort, boolean isSecure)
          Return a instance.
 void waitFor()
          Wait for the runner to finish
 
Methods inherited from class php.java.bridge.http.HttpServer
destroy, getSocket, run
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getContextServer

public ContextServer getContextServer()
Return the ContextServer

Returns:
the ContextServer

getRequiredInstance

public static JavaBridgeRunner getRequiredInstance(java.lang.String serverPort,
                                                   boolean isSecure)
                                            throws java.io.IOException
Return a instance.

Parameters:
serverPort - The server port name
isSecure - use https instead of http
Returns:
a standalone runner
Throws:
java.io.IOException

getInstance

public static JavaBridgeRunner getInstance(java.lang.String serverPort,
                                           boolean isSecure)
Return a instance.

Parameters:
serverPort - The server port name
isSecure - use https instead of http
Returns:
a standalone runner

getRequiredInstance

public static JavaBridgeRunner getRequiredInstance(java.lang.String serverPort)
                                            throws java.io.IOException
Return a instance.

Parameters:
serverPort - The server port name
Returns:
a standalone runner
Throws:
java.io.IOException

getInstance

public static JavaBridgeRunner getInstance(java.lang.String serverPort)
Return a instance.

Parameters:
serverPort - The server port name
Returns:
a standalone runner

getRequiredInstance

public static JavaBridgeRunner getRequiredInstance()
                                            throws java.io.IOException
Return a instance.

Returns:
a standalone runner
Throws:
java.io.IOException

bind

public ISocketFactory bind(java.lang.String addr)
                    throws java.io.IOException
Create a server socket.

Specified by:
bind in class HttpServer
Parameters:
addr - The host address, either INET:port or INET_LOCAL:port
Returns:
The server socket.
Throws:
java.io.IOException

bindSecure

public ISocketFactory bindSecure(java.lang.String addr)
                          throws java.io.IOException
Create a server socket.

Specified by:
bindSecure in class HttpServer
Parameters:
addr - The host address, either INET:port or INET_LOCAL:port
Returns:
The server socket.
Throws:
java.io.IOException

waitFor

public void waitFor()
             throws java.lang.InterruptedException
Wait for the runner to finish

Throws:
java.lang.InterruptedException

destroyRunner

public static void destroyRunner()
Destroy the JavaBridgeRunner instance