Package org.apache.catalina.ha.session
Class DeltaRequest
- java.lang.Object
-
- org.apache.catalina.ha.session.DeltaRequest
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable
public class DeltaRequest extends java.lang.Object implements java.io.ExternalizableThis class is used to track the series of actions that happens when a request is executed. These actions will then translate into invocations of methods on the actual session.This class is NOT thread safe. One DeltaRequest per session.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intACTION_REMOVEAction to remove a value.static intACTION_SETAction to set a value.static LoglogThe logger for this class.static java.lang.StringNAME_AUTHTYPEName used for auth type actions.static java.lang.StringNAME_ISNEWName used for new flag actions.static java.lang.StringNAME_LISTENERName used for listener actions.static java.lang.StringNAME_MAXINTERVALName used for max inactive interval actions.static java.lang.StringNAME_PRINCIPALName used for principal actions.protected static StringManagersmThe string manager for this package.static intTYPE_ATTRIBUTEAction type for session attributes.static intTYPE_AUTHTYPEAction type for session authentication type.static intTYPE_ISNEWAction type for session new flag.static intTYPE_LISTENERAction type for session listener.static intTYPE_MAXINTERVALAction type for session max inactive interval.static intTYPE_NOTEAction type for session note.static intTYPE_PRINCIPALAction type for session principal.
-
Constructor Summary
Constructors Constructor Description DeltaRequest()Default constructor required byExternalizable.DeltaRequest(java.lang.String sessionId, boolean recordAllActions)Construct a new DeltaRequest.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAction(int type, int action, java.lang.String name, java.lang.Object value)Add an action to the list of actions to be executed.voidaddSessionListener(SessionListener listener)Record an add session listener action.voidclear()Clear all actions and the action pool.voidexecute(DeltaSession session, boolean notifyListeners)Execute all recorded actions on the given session.java.lang.StringgetSessionId()Get the session identifier.intgetSize()Get the number of actions recorded.voidreadExternal(java.io.ObjectInput in)voidremoveAttribute(java.lang.String name)Record a remove attribute action.voidremoveNote(java.lang.String name)Record a remove note action.voidremoveSessionListener(SessionListener listener)Record a remove session listener action.voidreset()Reset this request, returning all action objects to the pool.protected byte[]serialize()serialize DeltaRequestvoidsetAttribute(java.lang.String name, java.lang.Object value)Record a set attribute action.voidsetAuthType(java.lang.String authType)Record a set auth type action.voidsetMaxInactiveInterval(int interval)Record a set max inactive interval action.voidsetNew(boolean n)Record a set new action.voidsetNote(java.lang.String name, java.lang.Object value)Record a set note action.voidsetPrincipal(java.security.Principal p)Only support principals from typeGenericPrincipalvoidsetSessionId(java.lang.String sessionId)Set the session identifier.voidwriteExternal(java.io.ObjectOutput out)
-
-
-
Field Detail
-
log
public static final Log log
The logger for this class.
-
sm
protected static final StringManager sm
The string manager for this package.
-
TYPE_ATTRIBUTE
public static final int TYPE_ATTRIBUTE
Action type for session attributes.- See Also:
- Constant Field Values
-
TYPE_PRINCIPAL
public static final int TYPE_PRINCIPAL
Action type for session principal.- See Also:
- Constant Field Values
-
TYPE_ISNEW
public static final int TYPE_ISNEW
Action type for session new flag.- See Also:
- Constant Field Values
-
TYPE_MAXINTERVAL
public static final int TYPE_MAXINTERVAL
Action type for session max inactive interval.- See Also:
- Constant Field Values
-
TYPE_AUTHTYPE
public static final int TYPE_AUTHTYPE
Action type for session authentication type.- See Also:
- Constant Field Values
-
TYPE_LISTENER
public static final int TYPE_LISTENER
Action type for session listener.- See Also:
- Constant Field Values
-
TYPE_NOTE
public static final int TYPE_NOTE
Action type for session note.- See Also:
- Constant Field Values
-
ACTION_SET
public static final int ACTION_SET
Action to set a value.- See Also:
- Constant Field Values
-
ACTION_REMOVE
public static final int ACTION_REMOVE
Action to remove a value.- See Also:
- Constant Field Values
-
NAME_PRINCIPAL
public static final java.lang.String NAME_PRINCIPAL
Name used for principal actions.- See Also:
- Constant Field Values
-
NAME_MAXINTERVAL
public static final java.lang.String NAME_MAXINTERVAL
Name used for max inactive interval actions.- See Also:
- Constant Field Values
-
NAME_ISNEW
public static final java.lang.String NAME_ISNEW
Name used for new flag actions.- See Also:
- Constant Field Values
-
NAME_AUTHTYPE
public static final java.lang.String NAME_AUTHTYPE
Name used for auth type actions.- See Also:
- Constant Field Values
-
NAME_LISTENER
public static final java.lang.String NAME_LISTENER
Name used for listener actions.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DeltaRequest
public DeltaRequest()
Default constructor required byExternalizable.
-
DeltaRequest
public DeltaRequest(java.lang.String sessionId, boolean recordAllActions)Construct a new DeltaRequest.- Parameters:
sessionId- Session identifierrecordAllActions- Record all actions, including duplicates
-
-
Method Detail
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)Record a set attribute action.- Parameters:
name- Attribute namevalue- Attribute value
-
removeAttribute
public void removeAttribute(java.lang.String name)
Record a remove attribute action.- Parameters:
name- Attribute name
-
setNote
public void setNote(java.lang.String name, java.lang.Object value)Record a set note action.- Parameters:
name- Note namevalue- Note value
-
removeNote
public void removeNote(java.lang.String name)
Record a remove note action.- Parameters:
name- Note name
-
setMaxInactiveInterval
public void setMaxInactiveInterval(int interval)
Record a set max inactive interval action.- Parameters:
interval- Max inactive interval in seconds
-
setPrincipal
public void setPrincipal(java.security.Principal p)
Only support principals from typeGenericPrincipal- Parameters:
p- Session principal- See Also:
GenericPrincipal
-
setNew
public void setNew(boolean n)
Record a set new action.- Parameters:
n- New flag value
-
setAuthType
public void setAuthType(java.lang.String authType)
Record a set auth type action.- Parameters:
authType- Authentication type
-
addSessionListener
public void addSessionListener(SessionListener listener)
Record an add session listener action.- Parameters:
listener- Session listener to add
-
removeSessionListener
public void removeSessionListener(SessionListener listener)
Record a remove session listener action.- Parameters:
listener- Session listener to remove
-
addAction
protected void addAction(int type, int action, java.lang.String name, java.lang.Object value)Add an action to the list of actions to be executed.- Parameters:
type- Action typeaction- Action (set or remove)name- Attribute or property namevalue- Attribute or property value
-
execute
public void execute(DeltaSession session, boolean notifyListeners)
Execute all recorded actions on the given session.- Parameters:
session- Target sessionnotifyListeners- Whether to notify session listeners
-
reset
public void reset()
Reset this request, returning all action objects to the pool.
-
getSessionId
public java.lang.String getSessionId()
Get the session identifier.- Returns:
- Session identifier
-
setSessionId
public void setSessionId(java.lang.String sessionId)
Set the session identifier.- Parameters:
sessionId- Session identifier
-
getSize
public int getSize()
Get the number of actions recorded.- Returns:
- Number of actions
-
clear
public void clear()
Clear all actions and the action pool.
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
serialize
protected byte[] serialize() throws java.io.IOExceptionserialize DeltaRequest- Returns:
- serialized delta request
- Throws:
java.io.IOException- IO error serializing- See Also:
writeExternal(java.io.ObjectOutput)
-
-