php.java.servlet
Class PhpCGIServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
php.java.servlet.CGIServlet
php.java.servlet.fastcgi.FastCGIServlet
php.java.servlet.PhpCGIServlet
- All Implemented Interfaces:
- java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
public class PhpCGIServlet
- extends FastCGIServlet
Handles requests from internet clients.
This servlet can handle GET/POST
requests directly. These requests invoke the php-cgi machinery from
the CGI or FastCGI servlet. Although the servlet to php-cgi back
to servlet path is quite slow (compared with the http front end/j2ee back end
setup) and consumes two servlet instances
instead of only one, it can be useful as a replacement for a system php
installation, see the README in the WEB-INF/cgi
folder. It is currently used for our J2EE test/demo.
- See Also:
JavaBridge
,
Serialized Form
Field Summary |
static int |
CGI_CHANNEL
A local port which will be used by the SocketContextServer for high-speed local communication. |
static int |
CGI_SSL_CHANNEL
A local port which will be used instead of the current SSL port. |
static boolean |
USE_SH_WRAPPER
|
Method Summary |
void |
destroy()
Destroys the FastCGI connection pool, if it exists. |
int |
getCGIMaxRequests()
Return the number of max requests. |
void |
init(javax.servlet.ServletConfig config)
Create a new FastCGI servlet which connects to a PHP FastCGI server using a connection pool. |
Methods inherited from class javax.servlet.http.HttpServlet |
service |
Methods inherited from class javax.servlet.GenericServlet |
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
USE_SH_WRAPPER
public static final boolean USE_SH_WRAPPER
CGI_CHANNEL
public static final int CGI_CHANNEL
- A local port which will be used by the SocketContextServer for high-speed local communication.
The SocketContextServer may use ports [9567,...[9667 (bound to
the local interface), if named pipes are not available (Windows
only). Use the system property
php.java.bridge.no_socket_server=true
to switch it
off (not recommended).
- See Also:
SocketContextServer
,
PipeContextServer
,
Constant Field Values
CGI_SSL_CHANNEL
public static final int CGI_SSL_CHANNEL
- A local port which will be used instead of the current SSL port. Requires that the J2EE server or
servlet engine listens on this local port.
If SSL is used, the CGI servlet passes this number instead of the current port number to PHP.
Example setting for tomcat conf/server.xml (add the line marked with a +
):
<Service name="Catalina">
[...]
+ <Connector port="9157" address="127.0.0.1" />
[...]
</Service>
To use a custom port#, switch off override_hosts
in the WEB-INF/web.xml
and add the following lines to your php.ini
file:
java.hosts=127.0.0.1:<CUSTOM_NON_SSL_PORT>
java.servlet=On
- See Also:
- Constant Field Values
PhpCGIServlet
public PhpCGIServlet()
init
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
- Description copied from class:
FastCGIServlet
- Create a new FastCGI servlet which connects to a PHP FastCGI server using a connection pool.
If the JavaBridge context exists and the JavaBridge context can
start a FastCGI server and the current context is configured to
connect to a FastCGI server, the current context connects to
the JavaBridge context to start the server and then uses this
server for all subsequent requests until the server is
stopped. When FastCGI is not available (anymore), the parent
CGI servlet is used instead.
- Specified by:
init
in interface javax.servlet.Servlet
- Overrides:
init
in class FastCGIServlet
- Parameters:
config
- a ServletConfig
object
containing the servlet's
configuration and initialization
parameters
- Throws:
javax.servlet.ServletException
- if an exception has occurred that
interferes with the servlet's normal
operation- See Also:
ConnectionPool
,
FastCGIServlet.destroy()
getCGIMaxRequests
public int getCGIMaxRequests()
- Return the number of max requests. In Tomcat this is 1/2 http thread pool size -1
destroy
public void destroy()
- Description copied from class:
FastCGIServlet
- Destroys the FastCGI connection pool, if it exists.
- Specified by:
destroy
in interface javax.servlet.Servlet
- Overrides:
destroy
in class FastCGIServlet