com.digitalsanctuary.atg.servlet.pipeline
Class ProxyIPFixerServlet

java.lang.Object
  extended byatg.nucleus.GenericService
      extended byatg.nucleus.TimedOperationService
          extended byatg.servlet.pipeline.PipelineableServletImpl
              extended byatg.servlet.pipeline.InsertableServletImpl
                  extended bycom.digitalsanctuary.atg.servlet.pipeline.ProxyIPFixerServlet
All Implemented Interfaces:
atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.naming.ComponentNameResolver, java.util.EventListener, atg.servlet.pipeline.InsertableServlet, atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.servlet.pipeline.PipelineableServlet, atg.nucleus.Service, atg.nucleus.ServiceListener, javax.servlet.Servlet

public class ProxyIPFixerServlet
extends atg.servlet.pipeline.InsertableServletImpl

Author:
Devon Hillard Incoming requests which have passed through one or more proxies will have a remoteAddr property of the request set to the IP of the last proxy which the request passed through. Proxies should maintain the original request IP, as well as any previous proxy IP addresses within an extended request header called X-FORWARDED-FOR. This class looks to see if that header exists and is populated, and if so, takes the left-most IP address (which should be the user's source IP address) and places it in the request's remoteAddr property, replacing the proxy IP current in there. We currently don't care about the proxy's IP address, and the address of the user is more useful for auditing, session security, and all other processes currently in place. Since all incoming requests are typically proxied by Akamai servers, we need this functionality in order to use ATG Dynamo's built-in session security mechanism which verifies request IP addresses against the IP address which spawned the session. This pipeline servlet has to go in front of the SessionManager

Field Summary
 
Fields inherited from class atg.servlet.pipeline.InsertableServletImpl
CLASS_VERSION
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
ProxyIPFixerServlet()
           
 
Method Summary
 void doStartService()
          This method handles the component setup.
 void doStopService()
          This method handles the component tear-down.
 java.lang.String getIPAddressPatternString()
           
 void service(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          This method takes in the request and response object, as part of the Dynamo servlet pipeline.
 void setIPAddressPatternString(java.lang.String pAddressPattern)
           
 
Methods inherited from class atg.servlet.pipeline.InsertableServletImpl
getInsertAfterServlet, setInsertAfterServlet
 
Methods inherited from class atg.servlet.pipeline.PipelineableServletImpl
createAdminServlet, destroy, getAdminServlet, getNextServlet, getServletConfig, getServletInfo, init, passRequest, passRequest, service, service, setNextServlet, setServletInfo
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, getAbsoluteName, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingWarning, setServiceInfo, startService, stopService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface atg.servlet.pipeline.PipelineableServlet
getNextServlet, passRequest, setNextServlet
 
Methods inherited from interface javax.servlet.Servlet
destroy, getServletConfig, getServletInfo, init, service
 

Constructor Detail

ProxyIPFixerServlet

public ProxyIPFixerServlet()
Method Detail

doStartService

public void doStartService()
                    throws atg.nucleus.ServiceException
This method handles the component setup.

Throws:
atg.nucleus.ServiceException - if do start service fails.
See Also:
InsertableServletImpl.doStartService()

doStopService

public void doStopService()
                   throws atg.nucleus.ServiceException
This method handles the component tear-down.

Throws:
atg.nucleus.ServiceException - if do stop service fails.
See Also:
GenericService.doStopService()

service

public void service(atg.servlet.DynamoHttpServletRequest pRequest,
                    atg.servlet.DynamoHttpServletResponse pResponse)
             throws java.io.IOException,
                    javax.servlet.ServletException
This method takes in the request and response object, as part of the Dynamo servlet pipeline. All processing on those request and response objects takes place here.

Parameters:
pRequest - the Dynamo http request object.
pResponse - the Dynamo http repsonse object.
Throws:
java.io.IOException - on error
javax.servlet.ServletException - on error
See Also:
PipelineableServletImpl.service(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse)

getIPAddressPatternString

public java.lang.String getIPAddressPatternString()
Returns:
the iPAddressPattern

setIPAddressPatternString

public void setIPAddressPatternString(java.lang.String pAddressPattern)
Parameters:
pAddressPattern - the iPAddressPattern to set