atg.userprofiling
Class ProfileRequestServlet

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.servlet.pipeline.PipelineableServletImpl
                  extended by atg.servlet.pipeline.InsertableServletImpl
                      extended by atg.userprofiling.ProfileRequestServlet
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, InsertableServlet, PipelineableServlet, java.util.EventListener, javax.servlet.Servlet
Direct Known Subclasses:
CommerceProfileRequestServlet

public class ProfileRequestServlet
extends InsertableServletImpl


Field Summary
static java.lang.String AUTO_LOGIN_FLAG
          value: AutoLogin
The default name used to access the AllowAutoLogin flag.
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String LOGOUT_PARAM
          value: DPSLogout
A parameter with this name will come in on the request directly after a logout..
static java.lang.String SEND_COOKIE_FLAG
          value: SendCookie
The default name used to access the SendCookie flag.
protected static java.util.ResourceBundle sResourceBundle
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
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
ProfileRequestServlet()
          Constructs an instanceof ProfileRequestServlet
 
Method Summary
 void addDataListener(DataListener pListener)
          Adds a listener to the list of data listeners
 void allowAutoLogin(javax.servlet.http.HttpServletRequest pRequest)
          Allows this user's session to auto-login via URL paramater.
 void allowSendCookie(javax.servlet.http.HttpServletRequest pRequest)
          Allows this user's session to send back a cookie.
 void disableAutoLogin(javax.servlet.http.HttpServletRequest pRequest)
          Does not allow this user's session to auto-login via URL paramater.
 void disableSendCookie(javax.servlet.http.HttpServletRequest pRequest)
          Does not allow this user's session to send back a cookie Binds Boolean.FALSE in the session to the key defined by the constant SEND_COOKIE_FLAG,
protected  void expireProfileCookies(Profile pProfile, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Expire any cookies associated with the given profile
 int getDataListenerCount()
          Returns the number of data listeners
 DataListener[] getDataListeners()
          Returns the list of data listeners as an array property
 java.lang.String getNewProfileType()
          Returns property NewProfileType
protected  Profile getProfile(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns a Profile object for the user if one already exists.
 java.lang.String getProfilePath()
          Returns property ProfilePath
protected  ProfileRequest getProfileRequest(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Constructs and configures a ProfileRequest
 java.lang.String getProfileRequestPath()
          Returns property ProfileRequestPath
 atg.userprofiling.ProfileRequestProcessor[] getProfileRequestProcessors()
          Returns property profileRequestProcessors
 ProfileRequestTools getProfileRequestTools()
          Returns property ProfileRequestTools
 ProfileTools getProfileTools()
          Returns property ProfileTools
protected  boolean initializeNewProfile(Profile pProfile, ProfileRequest pProfileRequest, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Initializes the Profile object by extracting the correct information out of the ProfileRequest
protected  boolean initializeProfile(Profile pProfile, ProfileRequest pProfileRequest, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Initializes the Profile.
protected  boolean initializeProfileFromRequest(Profile pProfile, ProfileRequest pProfileRequest, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Initializes the Profile object by extracting the correct information out of the ProfileRequest
protected  boolean initProfileAfterAutoLogin(Profile pProfile, ProfileRequest pProfileRequest, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Initialize the profile after an auto-login operation has occured.
protected  boolean initUserAfterAutoLogin(Profile pProfile, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Initialize the User object after an auto-login operation has occured, populating the User object with appropriate persona.
 boolean isAllowAutoLogin(javax.servlet.http.HttpServletRequest pRequest)
          Returns true if the session associated with this request is allowed to auto-login
 boolean isBuildProfile()
          Returns property BuildProfile
 boolean isPersistAfterLogout()
           
 boolean isPersistentAnonymousProfiles()
           
 boolean isSendCookie(javax.servlet.http.HttpServletRequest pRequest)
          Returns true if the session associated with this request is allowed to send a cookie
 boolean isSendCookie(Profile pProfile)
          Returns true is the profile wants cookies sent
 boolean isSendLoginEventForNewPersistentAnonymousProfiles()
           
 boolean isVerifyBasicAuthentication()
          Returns property VerifyBasicAuthentication
 void removeDataListener(DataListener pListener)
          Removes a listener from the list of data listeners
 void sendDataItem(java.lang.Object pDataItem)
          Sends a data item to all of the listeners
protected  void sendProfileCookies(Profile pProfile, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Sends any cookies associated with the given profile
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Attaches the profile to the request/session, sends any profile cookies, then passes the request onto the next servlet
protected  void serviceProfilingRequest(Profile pProfile, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Builds and places the profile into the Nucleus namespace for later retrieval.
 void setBuildProfile(boolean pBuildProfile)
          Sets property BuildProfile
 void setNewProfileType(java.lang.String pNewProfileType)
          Sets property NewProfileType
 void setPersistAfterLogout(boolean pPersistAfterLogout)
          Sets the property PersistAfterLogout.
 void setPersistentAnonymousProfiles(boolean pPersistentAnonymousProfiles)
          Sets the property PersistentAnonymousProfiles.
 void setProfilePath(java.lang.String pProfilePath)
          Sets property ProfilePath
 void setProfileRequestPath(java.lang.String pProfileRequestPath)
          Sets property ProfileRequestPath
 void setProfileRequestProcessors(atg.userprofiling.ProfileRequestProcessor[] pProfileRequestProcessors)
          Sets property profileRequestProcessors
 void setProfileRequestTools(ProfileRequestTools pProfileRequestTools)
          Sets property ProfileRequestTools
 void setProfileTools(ProfileTools pProfileTools)
          Sets property ProfileTools
 void setSendLoginEventForNewPersistentAnonymousProfiles(boolean pSendEvent)
          Sets the property sendLoginEventForNewPersistentAnonymousProfiles.
 void setVerifyBasicAuthentication(boolean pVerifyBasicAuthentication)
          Sets property VerifyBasicAuthentication
protected  void verifyBasicAuthentication(Profile pProfile, ProfileRequest pProfileRequest, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Checks to make sure the login name for the given profile matches the currently required login for Basic Authentication.
 
Methods inherited from class atg.servlet.pipeline.InsertableServletImpl
doStartService, getInsertAfterServlet, setInsertAfterServlet
 
Methods inherited from class atg.servlet.pipeline.PipelineableServletImpl
createAdminServlet, destroy, getAdminServlet, getNextServlet, getServletConfig, getServletInfo, init, isUsePathInfo, passRequest, passRequest, service, service, setNextServlet, setServletInfo, setUsePathInfo
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, doStopService, getAbsoluteName, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
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
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


LOGOUT_PARAM

public static final java.lang.String LOGOUT_PARAM
value: DPSLogout
A parameter with this name will come in on the request directly after a logout..

See Also:
Constant Field Values

AUTO_LOGIN_FLAG

public static final java.lang.String AUTO_LOGIN_FLAG
value: AutoLogin
The default name used to access the AllowAutoLogin flag.

See Also:
Constant Field Values

SEND_COOKIE_FLAG

public static final java.lang.String SEND_COOKIE_FLAG
value: SendCookie
The default name used to access the SendCookie flag.

See Also:
Constant Field Values

sResourceBundle

protected static java.util.ResourceBundle sResourceBundle
Constructor Detail

ProfileRequestServlet

public ProfileRequestServlet()
Constructs an instanceof ProfileRequestServlet

Method Detail

setBuildProfile

public void setBuildProfile(boolean pBuildProfile)
Sets property BuildProfile


isBuildProfile

public boolean isBuildProfile()
Returns property BuildProfile


setProfileRequestPath

public void setProfileRequestPath(java.lang.String pProfileRequestPath)
Sets property ProfileRequestPath


getProfileRequestPath

public java.lang.String getProfileRequestPath()
Returns property ProfileRequestPath


setProfilePath

public void setProfilePath(java.lang.String pProfilePath)
Sets property ProfilePath


getProfilePath

public java.lang.String getProfilePath()
Returns property ProfilePath


setNewProfileType

public void setNewProfileType(java.lang.String pNewProfileType)
Sets property NewProfileType


getNewProfileType

public java.lang.String getNewProfileType()
Returns property NewProfileType


setProfileTools

public void setProfileTools(ProfileTools pProfileTools)
Sets property ProfileTools


getProfileTools

public ProfileTools getProfileTools()
Returns property ProfileTools


setProfileRequestTools

public void setProfileRequestTools(ProfileRequestTools pProfileRequestTools)
Sets property ProfileRequestTools


getProfileRequestTools

public ProfileRequestTools getProfileRequestTools()
Returns property ProfileRequestTools


setVerifyBasicAuthentication

public void setVerifyBasicAuthentication(boolean pVerifyBasicAuthentication)
Sets property VerifyBasicAuthentication


isVerifyBasicAuthentication

public boolean isVerifyBasicAuthentication()
Returns property VerifyBasicAuthentication


setPersistentAnonymousProfiles

public void setPersistentAnonymousProfiles(boolean pPersistentAnonymousProfiles)
Sets the property PersistentAnonymousProfiles. If this flag is true, even anonymous users profiles are stored in the database. This can cause a lot of database traffic and should only be used with caution.


isPersistentAnonymousProfiles

public boolean isPersistentAnonymousProfiles()
Returns:
The value of the property PersistentAnonymousProfiles.

setPersistAfterLogout

public void setPersistAfterLogout(boolean pPersistAfterLogout)
Sets the property PersistAfterLogout. If this flag is true, then a new anonymous user is created directly after a registered user logs out. If this flag is false, then no anonymous user is created after a user logs out.


isPersistAfterLogout

public boolean isPersistAfterLogout()
Returns:
the value of the property PersistAfterLogout

setSendLoginEventForNewPersistentAnonymousProfiles

public void setSendLoginEventForNewPersistentAnonymousProfiles(boolean pSendEvent)
Sets the property sendLoginEventForNewPersistentAnonymousProfiles. If this flag is true, then a login event is fired when a new anonymous user is created and persisted to the database. If this flag is false, or if persistentAnonymousProfiles is false, then no login event is fired when a new anonymous user is created.


isSendLoginEventForNewPersistentAnonymousProfiles

public boolean isSendLoginEventForNewPersistentAnonymousProfiles()
Returns:
the value of the property sendLoginEventForNewPersistentAnonymousProfiles

sendDataItem

public void sendDataItem(java.lang.Object pDataItem)
Sends a data item to all of the listeners


addDataListener

public void addDataListener(DataListener pListener)
Adds a listener to the list of data listeners


removeDataListener

public void removeDataListener(DataListener pListener)
Removes a listener from the list of data listeners


getDataListeners

public DataListener[] getDataListeners()
Returns the list of data listeners as an array property


getDataListenerCount

public int getDataListenerCount()
Returns the number of data listeners


setProfileRequestProcessors

public void setProfileRequestProcessors(atg.userprofiling.ProfileRequestProcessor[] pProfileRequestProcessors)
Sets property profileRequestProcessors

Parameters:
pProfileRequestProcessors - a list of processors that run before and after the profile request has determined the profile

getProfileRequestProcessors

public atg.userprofiling.ProfileRequestProcessor[] getProfileRequestProcessors()
Returns property profileRequestProcessors

Returns:
a list of processors that run before and after the profile request has determined the profile

service

public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
             throws java.io.IOException,
                    javax.servlet.ServletException
Attaches the profile to the request/session, sends any profile cookies, then passes the request onto the next servlet

Overrides:
service in class PipelineableServletImpl
Throws:
javax.servlet.ServletException - if an error occurred while processing the servlet request
java.io.IOException - if an error occurred while reading or writing the servlet request

serviceProfilingRequest

protected void serviceProfilingRequest(Profile pProfile,
                                       DynamoHttpServletRequest pRequest,
                                       DynamoHttpServletResponse pResponse)
                                throws java.io.IOException,
                                       javax.servlet.ServletException
Builds and places the profile into the Nucleus namespace for later retrieval.

Throws:
java.io.IOException
javax.servlet.ServletException

sendProfileCookies

protected void sendProfileCookies(Profile pProfile,
                                  DynamoHttpServletRequest pRequest,
                                  DynamoHttpServletResponse pResponse)
                           throws java.io.IOException,
                                  javax.servlet.ServletException
Sends any cookies associated with the given profile

Throws:
java.io.IOException
javax.servlet.ServletException

expireProfileCookies

protected void expireProfileCookies(Profile pProfile,
                                    DynamoHttpServletRequest pRequest,
                                    DynamoHttpServletResponse pResponse)
                             throws java.io.IOException,
                                    javax.servlet.ServletException
Expire any cookies associated with the given profile

Throws:
java.io.IOException
javax.servlet.ServletException

getProfileRequest

protected ProfileRequest getProfileRequest(DynamoHttpServletRequest pRequest,
                                           DynamoHttpServletResponse pResponse)
                                    throws java.io.IOException,
                                           javax.servlet.ServletException
Constructs and configures a ProfileRequest

Throws:
java.io.IOException
javax.servlet.ServletException

getProfile

protected Profile getProfile(DynamoHttpServletRequest pRequest,
                             DynamoHttpServletResponse pResponse)
                      throws java.io.IOException,
                             javax.servlet.ServletException
Returns a Profile object for the user if one already exists. This method does not create a profile if needed.

Throws:
java.io.IOException
javax.servlet.ServletException

initializeProfile

protected boolean initializeProfile(Profile pProfile,
                                    ProfileRequest pProfileRequest,
                                    DynamoHttpServletRequest pRequest,
                                    DynamoHttpServletResponse pResponse)
                             throws java.io.IOException,
                                    javax.servlet.ServletException
Initializes the Profile. This is accomplished by either extracting the correct information out of the ProfileRequest or by creating a new data source for the profile.

Returns:
true if the profile was initialized
Throws:
java.io.IOException
javax.servlet.ServletException

initializeProfileFromRequest

protected boolean initializeProfileFromRequest(Profile pProfile,
                                               ProfileRequest pProfileRequest,
                                               DynamoHttpServletRequest pRequest,
                                               DynamoHttpServletResponse pResponse)
                                        throws java.io.IOException,
                                               javax.servlet.ServletException
Initializes the Profile object by extracting the correct information out of the ProfileRequest

Returns:
true if the profile was initialized
Throws:
java.io.IOException
javax.servlet.ServletException

initProfileAfterAutoLogin

protected boolean initProfileAfterAutoLogin(Profile pProfile,
                                            ProfileRequest pProfileRequest,
                                            DynamoHttpServletRequest pRequest,
                                            DynamoHttpServletResponse pResponse)
                                     throws java.io.IOException,
                                            javax.servlet.ServletException
Initialize the profile after an auto-login operation has occured. This method sets the security status on the profile to the "auto-login" level, and fires an event which signifies that the user has logged in.

Returns:
true if the profile was initialized
Throws:
java.io.IOException
javax.servlet.ServletException

initUserAfterAutoLogin

protected boolean initUserAfterAutoLogin(Profile pProfile,
                                         DynamoHttpServletRequest pRequest,
                                         DynamoHttpServletResponse pResponse)
                                  throws java.io.IOException,
                                         javax.servlet.ServletException
Initialize the User object after an auto-login operation has occured, populating the User object with appropriate persona.

Returns:
true if the user was initialized properly
Throws:
java.io.IOException
javax.servlet.ServletException

allowAutoLogin

public void allowAutoLogin(javax.servlet.http.HttpServletRequest pRequest)
Allows this user's session to auto-login via URL paramater. Binds Boolean.TRUE in the session to the key defined by the constant AUTO_LOGIN_FLAG,


disableAutoLogin

public void disableAutoLogin(javax.servlet.http.HttpServletRequest pRequest)
Does not allow this user's session to auto-login via URL paramater. Binds Boolean.FALSE in the session to the key defined by the constant AUTO_LOGIN_FLAG,


isAllowAutoLogin

public boolean isAllowAutoLogin(javax.servlet.http.HttpServletRequest pRequest)
Returns true if the session associated with this request is allowed to auto-login


allowSendCookie

public void allowSendCookie(javax.servlet.http.HttpServletRequest pRequest)
Allows this user's session to send back a cookie. Binds Boolean.TRUE in the session to the key defined by the constant SEND_COOKIE_FLAG,


disableSendCookie

public void disableSendCookie(javax.servlet.http.HttpServletRequest pRequest)
Does not allow this user's session to send back a cookie Binds Boolean.FALSE in the session to the key defined by the constant SEND_COOKIE_FLAG,


isSendCookie

public boolean isSendCookie(javax.servlet.http.HttpServletRequest pRequest)
Returns true if the session associated with this request is allowed to send a cookie


isSendCookie

public boolean isSendCookie(Profile pProfile)
Returns true is the profile wants cookies sent


verifyBasicAuthentication

protected void verifyBasicAuthentication(Profile pProfile,
                                         ProfileRequest pProfileRequest,
                                         DynamoHttpServletRequest pRequest,
                                         DynamoHttpServletResponse pResponse)
                                  throws java.io.IOException,
                                         javax.servlet.ServletException
Checks to make sure the login name for the given profile matches the currently required login for Basic Authentication. If they are different then the profile's data source is switched to use the correct RepositoryItem.

Throws:
java.io.IOException
javax.servlet.ServletException

initializeNewProfile

protected boolean initializeNewProfile(Profile pProfile,
                                       ProfileRequest pProfileRequest,
                                       DynamoHttpServletRequest pRequest,
                                       DynamoHttpServletResponse pResponse)
                                throws java.io.IOException,
                                       javax.servlet.ServletException
Initializes the Profile object by extracting the correct information out of the ProfileRequest

Returns:
true if the profile was initialized
Throws:
java.io.IOException
javax.servlet.ServletException