Class ConfigAwareProxyServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.mitre.dsmiley.httpproxy.ProxyServlet
org.craftercms.engine.util.servlet.ConfigAwareProxyServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
public class ConfigAwareProxyServlet
extends org.mitre.dsmiley.httpproxy.ProxyServlet
Extension of
ProxyServlet that uses the current site configuration- Since:
- 3.1.7
- Author:
- joseross
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected ExecutorServicestatic final StringFields inherited from class org.mitre.dsmiley.httpproxy.ProxyServlet
asciiQueryChars, connectionRequestTimeout, connectTimeout, doForwardIP, doHandleCompression, doHandleRedirects, doLog, doPreserveCookiePath, doPreserveCookies, doPreserveHost, doSendUrlFragment, hopByHopHeaders, maxConnections, P_CONNECTIONREQUESTTIMEOUT, P_CONNECTTIMEOUT, P_FORWARDEDFOR, P_HANDLECOMPRESSION, P_HANDLEREDIRECTS, P_LOG, P_MAXCONNECTIONS, P_PRESERVECOOKIEPATH, P_PRESERVECOOKIES, P_PRESERVEHOST, P_READTIMEOUT, P_TARGET_URI, P_USESYSTEMPROPERTIES, readTimeout, targetHost, targetUri, targetUriObj, useSystemPropertiesFields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcopyResponseHeader(jakarta.servlet.http.HttpServletRequest servletRequest, jakarta.servlet.http.HttpServletResponse servletResponse, org.apache.http.Header header) Overrides how ProxyServlet copies response headers from the proxied response to the client response.voiddestroy()voidinit()protected voidprotected org.apache.http.HttpRequestnewProxyRequestWithEntity(String method, String proxyRequestUri, jakarta.servlet.http.HttpServletRequest request) protected voidservice(jakarta.servlet.http.HttpServletRequest servletRequest, jakarta.servlet.http.HttpServletResponse servletResponse) Methods inherited from class org.mitre.dsmiley.httpproxy.ProxyServlet
buildHttpClient, buildProxyCookiePath, buildRequestConfig, buildSocketConfig, closeQuietly, copyProxyCookie, copyRequestHeader, copyRequestHeaders, copyResponseEntity, copyResponseHeaders, createHttpClient, createProxyCookie, doExecute, encodeUriQuery, getConfigParam, getCookieNamePrefix, getHttpClientBuilder, getProxyClient, getProxyCookieName, getRealCookie, getServletInfo, getTargetHost, getTargetUri, getTargetUri, handleRequestException, rewritePathInfoFromRequest, rewriteQueryStringFromRequest, rewriteUrlFromRequest, rewriteUrlFromResponseMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPatch, doPost, doPut, doTrace, getLastModified, init, isSensitiveHeader, serviceMethods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, log, log
-
Field Details
-
ATTR_TARGET_URI
-
ATTR_TARGET_HOST
-
WEBSOCKET_IDENTIFIER_HEADER
- See Also:
-
exec
-
-
Constructor Details
-
ConfigAwareProxyServlet
public ConfigAwareProxyServlet()
-
-
Method Details
-
init
public void init() throws jakarta.servlet.ServletException- Overrides:
initin classorg.mitre.dsmiley.httpproxy.ProxyServlet- Throws:
jakarta.servlet.ServletException
-
initTarget
protected void initTarget()- Overrides:
initTargetin classorg.mitre.dsmiley.httpproxy.ProxyServlet
-
destroy
public void destroy()- Specified by:
destroyin interfacejakarta.servlet.Servlet- Overrides:
destroyin classorg.mitre.dsmiley.httpproxy.ProxyServlet
-
newProxyRequestWithEntity
protected org.apache.http.HttpRequest newProxyRequestWithEntity(String method, String proxyRequestUri, jakarta.servlet.http.HttpServletRequest request) throws IOException - Overrides:
newProxyRequestWithEntityin classorg.mitre.dsmiley.httpproxy.ProxyServlet- Throws:
IOException
-
copyResponseHeader
protected void copyResponseHeader(jakarta.servlet.http.HttpServletRequest servletRequest, jakarta.servlet.http.HttpServletResponse servletResponse, org.apache.http.Header header) Overrides how ProxyServlet copies response headers from the proxied response to the client response. This method ensures that headers added by HttpProxyFilter are not duplicated. Additionally, it handles special cases for headers like SET_COOKIE, SET_COOKIE2, and LOCATION.- Overrides:
copyResponseHeaderin classorg.mitre.dsmiley.httpproxy.ProxyServlet- Parameters:
servletRequest- The HttpServletRequest from the client.servletResponse- The HttpServletResponse to the client.header- The header from the proxied response that needs to be copied. Special handling includes: - Skip copying hop-by-hop headers as they are not meant to be forwarded. - For SET_COOKIE and SET_COOKIE2 headers, cookies are processed and set in the client response. - For the LOCATION header, the URL is rewritten to ensure it points to the correct destination. - For other headers, the header is only added if it does not already exist in the client response.
-
service
protected void service(jakarta.servlet.http.HttpServletRequest servletRequest, jakarta.servlet.http.HttpServletResponse servletResponse) throws IOException, jakarta.servlet.ServletException - Overrides:
servicein classorg.mitre.dsmiley.httpproxy.ProxyServlet- Throws:
IOExceptionjakarta.servlet.ServletException
-