php.java.servlet
Class PhpCGIFilter

java.lang.Object
  extended by php.java.servlet.PhpCGIFilter
All Implemented Interfaces:
javax.servlet.Filter

public class PhpCGIFilter
extends java.lang.Object
implements javax.servlet.Filter

Handles /foo/bar.php/baz?param=value requests.

Since the servlet spec doesn't allow <url-pattern>*.php*</url-pattern>, this filter searches for an embedded PHP_SUFFIX and forwards to the PhpCGIServlet.

To enable this filter add
<filter>
<filter-name>PhpCGIFilter</filter-name>
<filter-class>php.java.servlet.PhpCGIFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PhpCGIFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

See Also:
FastCGIServlet

Field Summary
static java.lang.String PHP_SUFFIX
          The default suffix to search for.
 
Constructor Summary
PhpCGIFilter()
           
 
Method Summary
 void destroy()
          
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          
 java.lang.String getPhpSuffix()
          Return the PHP_SUFFIX.
 void init(javax.servlet.FilterConfig config)
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PHP_SUFFIX

public static final java.lang.String PHP_SUFFIX
The default suffix to search for. For example .php/ or .phtml/

See Also:
Constant Field Values
Constructor Detail

PhpCGIFilter

public PhpCGIFilter()
Method Detail

getPhpSuffix

public java.lang.String getPhpSuffix()
Return the PHP_SUFFIX. Override this method to return your own suffix.

Returns:
the php suffix, defaults to ".php/"

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException

Specified by:
doFilter in interface javax.servlet.Filter
Throws:
java.io.IOException
javax.servlet.ServletException

init

public void init(javax.servlet.FilterConfig config)
          throws javax.servlet.ServletException

Specified by:
init in interface javax.servlet.Filter
Throws:
javax.servlet.ServletException

destroy

public void destroy()

Specified by:
destroy in interface javax.servlet.Filter