本文整理汇总了Java中org.apache.catalina.SessionListener类的典型用法代码示例。如果您正苦于以下问题:Java SessionListener类的具体用法?Java SessionListener怎么用?Java SessionListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SessionListener类属于org.apache.catalina包,在下文中一共展示了SessionListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSessionListener
import org.apache.catalina.SessionListener; //导入依赖的package包/类
public void addSessionListener(SessionListener listener, boolean addDeltaRequest) {
lock();
try {
super.addSessionListener(listener);
if (addDeltaRequest && deltaRequest != null && listener instanceof ReplicatedSessionListener) {
deltaRequest.addSessionListener(listener);
}
} finally {
unlock();
}
}
示例2: removeSessionListener
import org.apache.catalina.SessionListener; //导入依赖的package包/类
public void removeSessionListener(SessionListener listener, boolean addDeltaRequest) {
lock();
try {
super.removeSessionListener(listener);
if (addDeltaRequest && deltaRequest != null && listener instanceof ReplicatedSessionListener) {
deltaRequest.removeSessionListener(listener);
}
} finally {
unlock();
}
}
示例3: fireSessionEvent
import org.apache.catalina.SessionListener; //导入依赖的package包/类
/**
* Notify all session event listeners that a particular event has
* occurred for this Session. The default implementation performs
* this notification synchronously using the calling thread.
*
* @param type Event type
* @param data Event data
*/
public void fireSessionEvent(String type, Object data) {
if (listeners.size() < 1)
return;
SessionEvent event = new SessionEvent(this, type, data);
SessionListener list[] = new SessionListener[0];
synchronized (listeners) {
list = listeners.toArray(list);
}
for (int i = 0; i < list.length; i++){
(list[i]).sessionEvent(event);
}
}
示例4: fireSessionEvent
import org.apache.catalina.SessionListener; //导入依赖的package包/类
/**
* Notify all session event listeners that a particular event has
* occurred for this Session. The default implementation performs
* this notification synchronously using the calling thread.
*
* @param type Event type
* @param data Event data
*/
public void fireSessionEvent(String type, Object data) {
if (listeners.size() < 1)
return;
SessionEvent event = new SessionEvent(this, type, data);
SessionListener list[] = new SessionListener[0];
synchronized (listeners) {
list = (SessionListener[]) listeners.toArray(list);
}
for (int i = 0; i < list.length; i++){
((SessionListener) list[i]).sessionEvent(event);
}
}
示例5: addSessionListener
import org.apache.catalina.SessionListener; //导入依赖的package包/类
/**
* Add a session event listener to this component.
*/
public void addSessionListener(SessionListener listener) {
synchronized (listeners) {
listeners.add(listener);
}
}
示例6: removeSessionListener
import org.apache.catalina.SessionListener; //导入依赖的package包/类
/**
* Remove a session event listener from this component.
*/
public void removeSessionListener(SessionListener listener) {
synchronized (listeners) {
listeners.remove(listener);
}
}
示例7: fireSessionEvent
import org.apache.catalina.SessionListener; //导入依赖的package包/类
/**
* Notify all session event listeners that a particular event has
* occurred for this Session. The default implementation performs
* this notification synchronously using the calling thread.
*
* @param type Event type
* @param data Event data
*/
public void fireSessionEvent(String type, Object data) {
if (listeners.size() < 1)
return;
SessionEvent event = new SessionEvent(this, type, data);
SessionListener list[] = new SessionListener[0];
synchronized (listeners) {
list = (SessionListener[]) listeners.toArray(list);
}
for (int i = 0; i < list.length; i++)
((SessionListener) list[i]).sessionEvent(event);
}
示例8: addSessionListener
import org.apache.catalina.SessionListener; //导入依赖的package包/类
public void addSessionListener(SessionListener listener, boolean addDeltaRequest) {
lock();
try {
super.addSessionListener(listener);
if (addDeltaRequest && deltaRequest != null && listener instanceof ReplicatedSessionListener) {
deltaRequest.addSessionListener(listener);
}
} finally {
unlock();
}
}
示例9: removeSessionListener
import org.apache.catalina.SessionListener; //导入依赖的package包/类
public void removeSessionListener(SessionListener listener, boolean addDeltaRequest) {
lock();
try {
super.removeSessionListener(listener);
if (addDeltaRequest && deltaRequest != null && listener instanceof ReplicatedSessionListener) {
deltaRequest.removeSessionListener(listener);
}
} finally {
unlock();
}
}
示例10: fireSessionEvent
import org.apache.catalina.SessionListener; //导入依赖的package包/类
/**
* Notify all session event listeners that a particular event has occurred
* for this Session. The default implementation performs this notification
* synchronously using the calling thread.
*
* @param type
* Event type
* @param data
* Event data
*/
public void fireSessionEvent(String type, Object data) {
if (listeners.size() < 1)
return;
SessionEvent event = new SessionEvent(this, type, data);
SessionListener list[] = new SessionListener[0];
synchronized (listeners) {
list = listeners.toArray(list);
}
for (int i = 0; i < list.length; i++) {
(list[i]).sessionEvent(event);
}
}
示例11: readObject
import org.apache.catalina.SessionListener; //导入依赖的package包/类
private void readObject(ObjectInput stream) throws ClassNotFoundException, IOException {
// Deserialize the scalar instance variables (except Manager)
authType = null; // Transient only
creationTime = ( (Long) stream.readObject()).longValue();
lastAccessedTime = ( (Long) stream.readObject()).longValue();
maxInactiveInterval = ( (Integer) stream.readObject()).intValue();
isNew = ( (Boolean) stream.readObject()).booleanValue();
isValid = ( (Boolean) stream.readObject()).booleanValue();
thisAccessedTime = ( (Long) stream.readObject()).longValue();
version = ( (Long) stream.readObject()).longValue();
boolean hasPrincipal = stream.readBoolean();
principal = null;
if (hasPrincipal) {
principal = SerializablePrincipal.readPrincipal(stream);
}
// setId((String) stream.readObject());
id = (String) stream.readObject();
if (log.isDebugEnabled()) log.debug(sm.getString("deltaSession.readSession", id));
// Deserialize the attribute count and attribute values
if (attributes == null) attributes = new ConcurrentHashMap<String, Object>();
int n = ( (Integer) stream.readObject()).intValue();
boolean isValidSave = isValid;
isValid = true;
for (int i = 0; i < n; i++) {
String name = (String) stream.readObject();
final Object value;
try {
value = stream.readObject();
} catch (WriteAbortedException wae) {
if (wae.getCause() instanceof NotSerializableException) {
// Skip non serializable attributes
continue;
}
throw wae;
}
// Handle the case where the filter configuration was changed while
// the web application was stopped.
if (exclude(name, value)) {
continue;
}
attributes.put(name, value);
}
isValid = isValidSave;
// Session listeners
n = ((Integer) stream.readObject()).intValue();
if (listeners == null || n > 0) {
listeners = new ArrayList<SessionListener>();
}
for (int i = 0; i < n; i++) {
SessionListener listener = (SessionListener) stream.readObject();
listeners.add(listener);
}
if (notes == null) {
notes = new Hashtable<String,Object>();
}
activate();
}
示例12: addSessionListener
import org.apache.catalina.SessionListener; //导入依赖的package包/类
public void addSessionListener(SessionListener listener) {
addAction(TYPE_LISTENER, ACTION_SET, NAME_LISTENER ,listener);
}
示例13: removeSessionListener
import org.apache.catalina.SessionListener; //导入依赖的package包/类
public void removeSessionListener(SessionListener listener) {
addAction(TYPE_LISTENER, ACTION_REMOVE, NAME_LISTENER ,listener);
}
示例14: execute
import org.apache.catalina.SessionListener; //导入依赖的package包/类
public void execute(DeltaSession session, boolean notifyListeners) {
if ( !this.sessionId.equals( session.getId() ) )
throw new java.lang.IllegalArgumentException("Session id mismatch, not executing the delta request");
session.access();
for ( int i=0; i<actions.size(); i++ ) {
AttributeInfo info = actions.get(i);
switch ( info.getType() ) {
case TYPE_ATTRIBUTE:
if ( info.getAction() == ACTION_SET ) {
if ( log.isTraceEnabled() ) log.trace("Session.setAttribute('"+info.getName()+"', '"+info.getValue()+"')");
session.setAttribute(info.getName(), info.getValue(),notifyListeners,false);
} else {
if ( log.isTraceEnabled() ) log.trace("Session.removeAttribute('"+info.getName()+"')");
session.removeAttribute(info.getName(),notifyListeners,false);
}
break;
case TYPE_ISNEW:
if ( log.isTraceEnabled() ) log.trace("Session.setNew('"+info.getValue()+"')");
session.setNew(((Boolean)info.getValue()).booleanValue(),false);
break;
case TYPE_MAXINTERVAL:
if ( log.isTraceEnabled() ) log.trace("Session.setMaxInactiveInterval('"+info.getValue()+"')");
session.setMaxInactiveInterval(((Integer)info.getValue()).intValue(),false);
break;
case TYPE_PRINCIPAL:
Principal p = null;
if ( info.getAction() == ACTION_SET ) {
SerializablePrincipal sp = (SerializablePrincipal)info.getValue();
p = sp.getPrincipal();
}
session.setPrincipal(p,false);
break;
case TYPE_AUTHTYPE:
String authType = null;
if ( info.getAction() == ACTION_SET ) {
authType = (String)info.getValue();
}
session.setAuthType(authType,false);
break;
case TYPE_LISTENER:
SessionListener listener = (SessionListener) info.getValue();
if (info.getAction() == ACTION_SET) {
session.addSessionListener(listener,false);
} else {
session.removeSessionListener(listener,false);
}
break;
default :
throw new java.lang.IllegalArgumentException("Invalid attribute info type="+info);
}//switch
}//for
session.endAccess();
reset();
}
示例15: getSessionListener
import org.apache.catalina.SessionListener; //导入依赖的package包/类
@Override
protected SessionListener getSessionListener(String ssoId) {
return new ClusterSingleSignOnListener(ssoId);
}