Class FastCGIProxyServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.eclipse.jetty.proxy.AbstractProxyServlet
-
- org.eclipse.jetty.proxy.ProxyServlet
-
- org.eclipse.jetty.proxy.AsyncProxyServlet
-
- org.eclipse.jetty.proxy.AsyncProxyServlet.Transparent
-
- org.eclipse.jetty.fcgi.server.proxy.FastCGIProxyServlet
-
- All Implemented Interfaces:
java.io.Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
public class FastCGIProxyServlet extends AsyncProxyServlet.Transparent
Specific implementation ofAsyncProxyServlet.Transparent
for FastCGI.This servlet accepts an HTTP request and transforms it into a FastCGI request that is sent to the FastCGI server specified in the
proxyTo
init-param.This servlet accepts these additional
init-param
s:scriptRoot
, mandatory, that must be set to the directory where the application that must be served via FastCGI is installed and corresponds to the FastCGI DOCUMENT_ROOT parameterscriptPattern
, optional, defaults to(.+?\.php)
, that specifies a regular expression with at least 1 and at most 2 groups that specify respectively:- the FastCGI SCRIPT_NAME parameter
- the FastCGI PATH_INFO parameter
fastCGI.HTTPS
, optional, defaults to false, that specifies whether to force the FastCGIHTTPS
parameter to the valueon
fastCGI.envNames
, optional, a comma separated list of environment variable names read viaSystem.getenv(String)
that are forwarded as FastCGI parameters.
- See Also:
TryFilesFilter
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
FastCGIProxyServlet.ProxyHttpClientTransportOverFCGI
-
Nested classes/interfaces inherited from class org.eclipse.jetty.proxy.AsyncProxyServlet
AsyncProxyServlet.StreamReader, AsyncProxyServlet.StreamWriter, AsyncProxyServlet.Transparent
-
Nested classes/interfaces inherited from class org.eclipse.jetty.proxy.ProxyServlet
ProxyServlet.ProxyInputStreamContentProvider, ProxyServlet.ProxyResponseListener
-
Nested classes/interfaces inherited from class org.eclipse.jetty.proxy.AbstractProxyServlet
AbstractProxyServlet.TransparentDelegate
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FASTCGI_ENV_NAMES_INIT_PARAM
static java.lang.String
FASTCGI_HTTPS_INIT_PARAM
private java.util.Set<java.lang.String>
fcgiEnvNames
private boolean
fcgiHTTPS
static java.lang.String
ORIGINAL_QUERY_ATTRIBUTE_INIT_PARAM
static java.lang.String
ORIGINAL_URI_ATTRIBUTE_INIT_PARAM
private java.lang.String
originalQueryAttribute
private java.lang.String
originalURIAttribute
private static java.lang.String
REMOTE_ADDR_ATTRIBUTE
private static java.lang.String
REMOTE_PORT_ATTRIBUTE
private static java.lang.String
REQUEST_QUERY_ATTRIBUTE
private static java.lang.String
REQUEST_URI_ATTRIBUTE
private static java.lang.String
SCHEME_ATTRIBUTE
static java.lang.String
SCRIPT_PATTERN_INIT_PARAM
static java.lang.String
SCRIPT_ROOT_INIT_PARAM
private java.util.regex.Pattern
scriptPattern
private static java.lang.String
SERVER_ADDR_ATTRIBUTE
private static java.lang.String
SERVER_NAME_ATTRIBUTE
private static java.lang.String
SERVER_PORT_ATTRIBUTE
-
Fields inherited from class org.eclipse.jetty.proxy.AbstractProxyServlet
_log, CLIENT_REQUEST_ATTRIBUTE, HOP_HEADERS
-
-
Constructor Summary
Constructors Constructor Description FastCGIProxyServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
customizeFastCGIHeaders(Request proxyRequest, HttpFields fastCGIHeaders)
void
init()
protected HttpClient
newHttpClient()
The servlet init parameter 'selectors' can be set for the number of selector threads to be used by the HttpClient.protected void
sendProxyRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse proxyResponse, Request proxyRequest)
-
Methods inherited from class org.eclipse.jetty.proxy.AsyncProxyServlet.Transparent
init, rewriteTarget
-
Methods inherited from class org.eclipse.jetty.proxy.AsyncProxyServlet
newReadListener, newWriteListener, onResponseContent, proxyRequestContent
-
Methods inherited from class org.eclipse.jetty.proxy.ProxyServlet
newProxyResponseListener, onContinue, service
-
Methods inherited from class org.eclipse.jetty.proxy.AbstractProxyServlet
addProxyHeaders, addViaHeader, addViaHeader, addXForwardedHeaders, clientRequestStatus, copyRequestHeaders, createHttpClient, createLogger, destroy, expects100Continue, filterServerResponseHeader, findConnectionHeaders, getBlackListHosts, getHostHeader, getHttpClient, getRequestId, getTimeout, getViaHost, getWhiteListHosts, hasContent, newProxyRequest, onClientRequestFailure, onProxyResponseFailure, onProxyResponseSuccess, onProxyRewriteFailed, onServerResponseHeaders, proxyResponseStatus, sendProxyResponseError, setTimeout, validateDestination
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
-
-
-
-
Field Detail
-
SCRIPT_ROOT_INIT_PARAM
public static final java.lang.String SCRIPT_ROOT_INIT_PARAM
- See Also:
- Constant Field Values
-
SCRIPT_PATTERN_INIT_PARAM
public static final java.lang.String SCRIPT_PATTERN_INIT_PARAM
- See Also:
- Constant Field Values
-
ORIGINAL_URI_ATTRIBUTE_INIT_PARAM
public static final java.lang.String ORIGINAL_URI_ATTRIBUTE_INIT_PARAM
- See Also:
- Constant Field Values
-
ORIGINAL_QUERY_ATTRIBUTE_INIT_PARAM
public static final java.lang.String ORIGINAL_QUERY_ATTRIBUTE_INIT_PARAM
- See Also:
- Constant Field Values
-
FASTCGI_HTTPS_INIT_PARAM
public static final java.lang.String FASTCGI_HTTPS_INIT_PARAM
- See Also:
- Constant Field Values
-
FASTCGI_ENV_NAMES_INIT_PARAM
public static final java.lang.String FASTCGI_ENV_NAMES_INIT_PARAM
- See Also:
- Constant Field Values
-
REMOTE_ADDR_ATTRIBUTE
private static final java.lang.String REMOTE_ADDR_ATTRIBUTE
-
REMOTE_PORT_ATTRIBUTE
private static final java.lang.String REMOTE_PORT_ATTRIBUTE
-
SERVER_NAME_ATTRIBUTE
private static final java.lang.String SERVER_NAME_ATTRIBUTE
-
SERVER_ADDR_ATTRIBUTE
private static final java.lang.String SERVER_ADDR_ATTRIBUTE
-
SERVER_PORT_ATTRIBUTE
private static final java.lang.String SERVER_PORT_ATTRIBUTE
-
SCHEME_ATTRIBUTE
private static final java.lang.String SCHEME_ATTRIBUTE
-
REQUEST_URI_ATTRIBUTE
private static final java.lang.String REQUEST_URI_ATTRIBUTE
-
REQUEST_QUERY_ATTRIBUTE
private static final java.lang.String REQUEST_QUERY_ATTRIBUTE
-
scriptPattern
private java.util.regex.Pattern scriptPattern
-
originalURIAttribute
private java.lang.String originalURIAttribute
-
originalQueryAttribute
private java.lang.String originalQueryAttribute
-
fcgiHTTPS
private boolean fcgiHTTPS
-
fcgiEnvNames
private java.util.Set<java.lang.String> fcgiEnvNames
-
-
Method Detail
-
init
public void init() throws javax.servlet.ServletException
- Overrides:
init
in classAbstractProxyServlet
- Throws:
javax.servlet.ServletException
-
newHttpClient
protected HttpClient newHttpClient()
Description copied from class:AbstractProxyServlet
The servlet init parameter 'selectors' can be set for the number of selector threads to be used by the HttpClient.- Overrides:
newHttpClient
in classAbstractProxyServlet
- Returns:
- a new HttpClient instance
-
sendProxyRequest
protected void sendProxyRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse proxyResponse, Request proxyRequest)
- Overrides:
sendProxyRequest
in classAbstractProxyServlet
-
customizeFastCGIHeaders
protected void customizeFastCGIHeaders(Request proxyRequest, HttpFields fastCGIHeaders)
-
-