php.java.script
Class FastCGIProxy

java.lang.Object
  extended by php.java.script.Continuation
      extended by php.java.script.FastCGIProxy
All Implemented Interfaces:
java.lang.Runnable, IFCGIProcessFactory, IContinuation

public class FastCGIProxy
extends Continuation
implements IFCGIProcessFactory

This class can be used to run (and to connect to) a FastCGI server.

Author:
jostb
See Also:
HttpFastCGIProxy

Constructor Summary
FastCGIProxy(java.io.Reader reader, java.util.Map env, java.io.OutputStream out, java.io.OutputStream err, HeaderParser headerParser, ResultProxy resultProxy, ILogger logger)
           
 
Method Summary
 boolean canStartFCGI()
          Used for debugging only.
 IFCGIProcess createFCGIProcess(java.lang.String[] args, boolean includeJava, java.io.File home, java.util.Map env)
          Create a FastCGI Process
 java.lang.String getCgiDir()
          The full path to the pear dir.
 java.util.HashMap getEnvironment()
          Get the process environment map used for PHP.
 java.lang.String getPearDir()
          The full path to the pear dir.
 java.lang.String getPhp()
          Get the path to the PHP binary.
 java.lang.String getPhpConnectionPoolSize()
          Get the connection pool size, usually FCGIUtil#PHP_FCGI_CONNECTION_POOL_SIZE
 boolean getPhpIncludeJava()
          Get the value of the php_include_java option from the WEB-INF/web.xml.
 java.lang.String getPhpMaxRequests()
          Get the max requests value, usually FCGIUtil.PHP_FCGI_MAX_REQUESTS
 java.lang.String getWebInfDir()
          The full path to the web-inf dir.
 void log(java.lang.String msg)
          Log message through preferred log mechanism, for example servlet.log()
 
Methods inherited from class php.java.script.Continuation
call, getPhpScript, release, run
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastCGIProxy

public FastCGIProxy(java.io.Reader reader,
                    java.util.Map env,
                    java.io.OutputStream out,
                    java.io.OutputStream err,
                    HeaderParser headerParser,
                    ResultProxy resultProxy,
                    ILogger logger)
Method Detail

createFCGIProcess

public IFCGIProcess createFCGIProcess(java.lang.String[] args,
                                      boolean includeJava,
                                      java.io.File home,
                                      java.util.Map env)
                               throws java.io.IOException
Create a FastCGI Process

Specified by:
createFCGIProcess in interface IFCGIProcessFactory
Parameters:
args - The PHP arguments
includeJava - automatically include Java.inc in each script
home - The PHP home dir or null
env - The process environment
Returns:
a FastCGI process object
Throws:
java.io.IOException

canStartFCGI

public boolean canStartFCGI()
Used for debugging only. Should always return true.

Specified by:
canStartFCGI in interface IFCGIProcessFactory
Returns:
true

getCgiDir

public java.lang.String getCgiDir()
The full path to the pear dir. Defaults to WEB-INF/cgi. Use TMPDIR for a standalone runner.

Specified by:
getCgiDir in interface IFCGIProcessFactory
Returns:
the full path to the cgi dir

getEnvironment

public java.util.HashMap getEnvironment()
Get the process environment map used for PHP.

Specified by:
getEnvironment in interface IFCGIProcessFactory
Returns:
the process environment.

getPearDir

public java.lang.String getPearDir()
The full path to the pear dir. Defaults to WEB-INF/pear. Use TMPDIR for a standalone runner.

Specified by:
getPearDir in interface IFCGIProcessFactory
Returns:
the full path to the pear dir

getPhp

public java.lang.String getPhp()
Get the path to the PHP binary. For example "/usr/bin/php-cgi".

Specified by:
getPhp in interface IFCGIProcessFactory
Returns:
The path or the name of the PHP FastCGI binary or null (defaults to php-cgi or php-cgi.exe on the PATH)

getPhpConnectionPoolSize

public java.lang.String getPhpConnectionPoolSize()
Get the connection pool size, usually FCGIUtil#PHP_FCGI_CONNECTION_POOL_SIZE

Specified by:
getPhpConnectionPoolSize in interface IFCGIProcessFactory
Returns:
The connection pool size

getPhpIncludeJava

public boolean getPhpIncludeJava()
Get the value of the php_include_java option from the WEB-INF/web.xml. Should return true in most cases.

Specified by:
getPhpIncludeJava in interface IFCGIProcessFactory
Returns:
the php_include_java option

getPhpMaxRequests

public java.lang.String getPhpMaxRequests()
Get the max requests value, usually FCGIUtil.PHP_FCGI_MAX_REQUESTS

Specified by:
getPhpMaxRequests in interface IFCGIProcessFactory
Returns:
The connection pool size

getWebInfDir

public java.lang.String getWebInfDir()
The full path to the web-inf dir. Defaults to WEB-INF. Use TMPDIR for a standalone runner.

Specified by:
getWebInfDir in interface IFCGIProcessFactory
Returns:
the full path to the WEB-INF dir

log

public void log(java.lang.String msg)
Log message through preferred log mechanism, for example servlet.log()

Specified by:
log in interface IFCGIProcessFactory
Parameters:
msg - The message to log