Java 类javax.servlet.http.HttpSessionBindingListener 实例源码
项目:lams
文件:SessionListenerBridge.java
@Override
public void attributeUpdated(final Session session, final String name, final Object value, final Object old) {
if(name.startsWith(IO_UNDERTOW)) {
return;
}
final HttpSessionImpl httpSession = SecurityActions.forSession(session, servletContext, false);
if (old != value) {
if (old instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) old).valueUnbound(new HttpSessionBindingEvent(httpSession, name, old));
}
applicationListeners.httpSessionAttributeReplaced(httpSession, name, old);
}
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueBound(new HttpSessionBindingEvent(httpSession, name, value));
}
}
项目:nebo
文件:NettyHttpSession.java
/**
* Serialize the attributes of this session into an object that can be
* turned into a byte array with standard Java serialization.
*
* @return a representation of this session's serialized state
*/
public Serializable serializeState() {
HashMap<String, Serializable> state = new HashMap<String, Serializable>();
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof Serializable) {
state.put(name, (Serializable) value);
}
else {
// Not serializable... Servlet containers usually automatically
// unbind the attribute in this case.
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
return state;
}
项目:spring4-understanding
文件:MockHttpSession.java
/**
* Serialize the attributes of this session into an object that can be
* turned into a byte array with standard Java serialization.
*
* @return a representation of this session's serialized state
*/
public Serializable serializeState() {
HashMap<String, Serializable> state = new HashMap<String, Serializable>();
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof Serializable) {
state.put(name, (Serializable) value);
}
else {
// Not serializable... Servlet containers usually automatically
// unbind the attribute in this case.
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
return state;
}
项目:spring4-understanding
文件:MockHttpSession.java
/**
* Serialize the attributes of this session into an object that can be
* turned into a byte array with standard Java serialization.
*
* @return a representation of this session's serialized state
*/
public Serializable serializeState() {
HashMap<String, Serializable> state = new HashMap<String, Serializable>();
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof Serializable) {
state.put(name, (Serializable) value);
}
else {
// Not serializable... Servlet containers usually automatically
// unbind the attribute in this case.
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
return state;
}
项目:vaadin-vertx-samples
文件:VertxWrappedSessionUT.java
@Test
public void shouldUnbindOnInvalidate() throws Exception {
Map<String, Object> sampleData = new HashMap<>();
HttpSessionBindingListener mockA = mock(HttpSessionBindingListener.class);
HttpSessionBindingListener mockC = mock(HttpSessionBindingListener.class);
sampleData.put("a", mockA);
sampleData.put("b", "b");
sampleData.put("c", mockC);
sampleData.put("b", "b");
when(session.data()).thenReturn(sampleData);
vertxWrappedSession.invalidate();
verify(session).destroy();
ArgumentCaptor<HttpSessionBindingEvent> sessionBindingEventCaptor = ArgumentCaptor.forClass(HttpSessionBindingEvent.class);
verify(mockA).valueUnbound(sessionBindingEventCaptor.capture());
verify(mockC).valueUnbound(sessionBindingEventCaptor.capture());
assertThat(sessionBindingEventCaptor.getAllValues()).hasSize(2);
assertHttpSessionBindingEvent("a", mockA, sessionBindingEventCaptor.getAllValues().get(0));
assertHttpSessionBindingEvent("c", mockC, sessionBindingEventCaptor.getAllValues().get(1));
}
项目:nbone
文件:MockHttpSession.java
/**
* Serialize the attributes of this session into an object that can be
* turned into a byte array with standard Java serialization.
*
* @return a representation of this session's serialized state
*/
public Serializable serializeState() {
HashMap<String, Serializable> state = new HashMap<String, Serializable>();
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof Serializable) {
state.put(name, (Serializable) value);
}
else {
// Not serializable... Servlet containers usually automatically
// unbind the attribute in this case.
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
return state;
}
项目:opengse
文件:HttpSessionImpl.java
/**
* Removes the object bound with the specified name from
* this session.
*/
public void removeAttribute(String name) {
maybeThrowIllegalStateException();
checkValid();
Object value = getAttribute(name);
// notify binding listeners
if (value != null) {
sessionData_.remove(name);
updateCache();
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(
new HttpSessionBindingEvent(this, name));
}
}
// notify attribute listeners
ServletSessionCache.getCache(cacheId_).
notifySessionAttributeRemoved(this, name);
}
项目:live-chat-engine
文件:MockHttpSession.java
/**
* Serialize the attributes of this session into an object that can
* be turned into a byte array with standard Java serialization.
* @return a representation of this session's serialized state
*/
public Serializable serializeState() {
HashMap state = new HashMap();
for (Iterator it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
String name = (String) entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof Serializable) {
state.put(name, value);
}
else {
// Not serializable... Servlet containers usually automatically
// unbind the attribute in this case.
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
return state;
}
项目:xslweb
文件:XSLWebHttpSession.java
public Serializable serializeState() {
HashMap<String, Serializable> state = new HashMap<String, Serializable>();
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof Serializable) {
state.put(name, (Serializable) value);
}
else {
// Not serializable... Servlet containers usually automatically
// unbind the attribute in this case.
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
return state;
}
项目:sakai
文件:EntityHttpServletRequest.java
/**
* Serialize the attributes of this session into an object that can
* be turned into a byte array with standard Java serialization.
* @return a representation of this session's serialized state
*/
public Serializable serializeState() {
HashMap<String, Object> state = new HashMap<String, Object>();
for (Iterator it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
String name = (String) entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof Serializable) {
state.put(name, value);
}
else {
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
return state;
}
项目:youtube-cache
文件:FakeSession.java
/**
* Binds an object to this session, using the name specified. If an object of
* the same name is already bound to the session, the object is replaced.
* @param name The name to which the object is bound; cannot be null.
* @param value The object to be bound.
*/
public void setAttribute(String name, Object value) {
if (!isValid())
throw new IllegalStateException(
"Method is called on an invalidated session");
if (value == null) removeAttribute(name);
else {
attributes.put(name, value);
try {
HttpSessionBindingListener listener = (HttpSessionBindingListener) value;
listener.valueBound(new HttpSessionBindingEvent(this, name, value));
listener.notifyAll();
}
catch (ClassCastException e) { }
}
}
项目:youtube-cache
文件:FakeSession.java
private void cleanUpAttributes() {
if (!isValid())
throw new IllegalStateException(
"Method is called on an invalidated session");
Iterator iter = attributes.entrySet().iterator();
while (iter.hasNext()) {
Entry e = (Entry) iter.next();
String name = e.getKey() + "";
Object value = e.getValue();
iter.remove();
try {
HttpSessionBindingListener listener = (HttpSessionBindingListener) value;
listener.valueUnbound(new HttpSessionBindingEvent(this, name, value));
listener.notifyAll();
}
catch (ClassCastException err) { }
}
}
项目:class-guard
文件:MockHttpSession.java
/**
* Serialize the attributes of this session into an object that can be
* turned into a byte array with standard Java serialization.
*
* @return a representation of this session's serialized state
*/
public Serializable serializeState() {
HashMap<String, Serializable> state = new HashMap<String, Serializable>();
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof Serializable) {
state.put(name, (Serializable) value);
}
else {
// Not serializable... Servlet containers usually automatically
// unbind the attribute in this case.
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
return state;
}
项目:class-guard
文件:MockHttpSession.java
/**
* Serialize the attributes of this session into an object that can be
* turned into a byte array with standard Java serialization.
*
* @return a representation of this session's serialized state
*/
public Serializable serializeState() {
HashMap<String, Serializable> state = new HashMap<String, Serializable>();
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof Serializable) {
state.put(name, (Serializable) value);
}
else {
// Not serializable... Servlet containers usually automatically
// unbind the attribute in this case.
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
return state;
}
项目:sakai
文件:EntityHttpServletRequest.java
/**
* Serialize the attributes of this session into an object that can
* be turned into a byte array with standard Java serialization.
* @return a representation of this session's serialized state
*/
public Serializable serializeState() {
HashMap<String, Object> state = new HashMap<String, Object>();
for (Iterator it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
String name = (String) entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof Serializable) {
state.put(name, value);
}
else {
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
return state;
}
项目:gocd
文件:MockHttpSession.java
/**
* Serialize the attributes of this session into an object that can be
* turned into a byte array with standard Java serialization.
* @return a representation of this session's serialized state
*/
public Serializable serializeState() {
HashMap<String, Serializable> state = new HashMap<>();
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof Serializable) {
state.put(name, (Serializable) value);
}
else {
// Not serializable... Servlet containers usually automatically
// unbind the attribute in this case.
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
return state;
}
项目:tomee
文件:WebContext.java
private static boolean isWeb(final Class<?> beanClass) {
if (Servlet.class.isAssignableFrom(beanClass)
|| Filter.class.isAssignableFrom(beanClass)) {
return true;
}
if (EventListener.class.isAssignableFrom(beanClass)) {
return HttpSessionAttributeListener.class.isAssignableFrom(beanClass)
|| ServletContextListener.class.isAssignableFrom(beanClass)
|| ServletRequestListener.class.isAssignableFrom(beanClass)
|| ServletContextAttributeListener.class.isAssignableFrom(beanClass)
|| HttpSessionListener.class.isAssignableFrom(beanClass)
|| HttpSessionBindingListener.class.isAssignableFrom(beanClass)
|| HttpSessionActivationListener.class.isAssignableFrom(beanClass)
|| HttpSessionIdListener.class.isAssignableFrom(beanClass)
|| ServletRequestAttributeListener.class.isAssignableFrom(beanClass);
}
return false;
}
项目:tasfe-framework
文件:HttpSessionImpl.java
@Override
public void removeAttribute(String name) {
if (attributes != null) {
Object value = attributes.get(name);
if (value != null && value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
attributes.remove(name);
}
}
项目:tasfe-framework
文件:HttpSessionImpl.java
@Override
public void setAttribute(String name, Object value) {
attributes.put(name, value);
if (value != null && value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueBound(new HttpSessionBindingEvent(this, name, value));
}
}
项目:lams
文件:SessionListenerBridge.java
@Override
public void attributeAdded(final Session session, final String name, final Object value) {
if(name.startsWith(IO_UNDERTOW)) {
return;
}
final HttpSessionImpl httpSession = SecurityActions.forSession(session, servletContext, false);
applicationListeners.httpSessionAttributeAdded(httpSession, name, value);
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueBound(new HttpSessionBindingEvent(httpSession, name, value));
}
}
项目:lams
文件:SessionListenerBridge.java
@Override
public void attributeRemoved(final Session session, final String name, final Object old) {
if(name.startsWith(IO_UNDERTOW)) {
return;
}
final HttpSessionImpl httpSession = SecurityActions.forSession(session, servletContext, false);
if (old != null) {
applicationListeners.httpSessionAttributeRemoved(httpSession, name, old);
if (old instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) old).valueUnbound(new HttpSessionBindingEvent(httpSession, name, old));
}
}
}
项目:jaffa-framework
文件:MockHttpServletRequest.java
public void setAttribute(String string, Object object) {
Object originalValue = attr.put(string, object);
if (originalValue != null && originalValue instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) originalValue).valueUnbound(new HttpSessionBindingEvent(this, string));
}
if (object != null && object instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) object).valueBound(new HttpSessionBindingEvent(this, string));
}
}
项目:HttpSessionReplacer
文件:HttpSessionNotifier.java
/**
* Notifies listeners that attribute was added. See {@link SessionNotifier}
* {@link #attributeAdded(RepositoryBackedSession, String, Object)}.
* <p>
* If the added attribute <code>value</code> is a HttpSessionBindingListener,
* it will receive the {@link HttpSessionBindingEvent}. If there are
* {@link HttpSessionAttributeListener} instances associated to
* {@link ServletContext}, they will be notified via
* {@link HttpSessionAttributeListener#attributeAdded(HttpSessionBindingEvent)}
* .
*/
@Override
public void attributeAdded(RepositoryBackedSession session, String key, Object value) {
// If the
if (session instanceof HttpSession && value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener)value).valueBound(new HttpSessionBindingEvent((HttpSession)session, key));
}
HttpSessionBindingEvent event = new HttpSessionBindingEvent((HttpSession)session, key, value);
for (HttpSessionAttributeListener listener : descriptor.getHttpSessionAttributeListeners()) {
listener.attributeAdded(event);
}
}
项目:HttpSessionReplacer
文件:TestHttpSessionNotifier.java
@Test
public void testAttributeAdded() {
HttpSessionAttributeListener listener = mock(HttpSessionAttributeListener.class);
descriptor.addHttpSessionAttributeListener(listener);
notifier.attributeAdded(session, "Test", "value");
verify(listener).attributeAdded(any(HttpSessionBindingEvent.class));
HttpSessionBindingListener bindingListener = mock(HttpSessionBindingListener.class);
notifier.attributeAdded(session, "Test", bindingListener);
verify(listener, times(2)).attributeAdded(any(HttpSessionBindingEvent.class));
verify(bindingListener).valueBound(any(HttpSessionBindingEvent.class));
}
项目:HttpSessionReplacer
文件:TestHttpSessionNotifier.java
@Test
public void testAttributeReplaced() {
HttpSessionAttributeListener listener = mock(HttpSessionAttributeListener.class);
notifier.attributeReplaced(session, "Test", "very-old-value");
verify(listener, never()).attributeReplaced(any(HttpSessionBindingEvent.class));
descriptor.addHttpSessionAttributeListener(listener);
notifier.attributeReplaced(session, "Test", "old-value");
verify(listener).attributeReplaced(any(HttpSessionBindingEvent.class));
HttpSessionBindingListener bindingListener = mock(HttpSessionBindingListener.class);
notifier.attributeReplaced(session, "Test", bindingListener);
verify(listener, times(2)).attributeReplaced(any(HttpSessionBindingEvent.class));
verify(bindingListener).valueUnbound(any(HttpSessionBindingEvent.class));
}
项目:HttpSessionReplacer
文件:TestHttpSessionNotifier.java
@Test
public void testAttributeRemoved() {
notifier.attributeRemoved(session, "Test", "very-old-value");
HttpSessionAttributeListener listener = mock(HttpSessionAttributeListener.class);
descriptor.addHttpSessionAttributeListener(listener);
notifier.attributeRemoved(session, "Test", "old-value");
verify(listener).attributeRemoved(any(HttpSessionBindingEvent.class));
HttpSessionBindingListener bindingListener = mock(HttpSessionBindingListener.class);
notifier.attributeRemoved(session, "Test", bindingListener);
verify(listener, times(2)).attributeRemoved(any(HttpSessionBindingEvent.class));
verify(bindingListener).valueUnbound(any(HttpSessionBindingEvent.class));
}
项目:nebo
文件:NettyHttpSession.java
@Override
public void setAttribute(String name, Object value) {
assertIsValid();
Assert.notNull(name, "Attribute name must not be null");
if (value != null) {
this.attributes.put(name, value);
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueBound(new HttpSessionBindingEvent(this, name, value));
}
}
else {
removeAttribute(name);
}
}
项目:nebo
文件:NettyHttpSession.java
@Override
public void removeAttribute(String name) {
assertIsValid();
Assert.notNull(name, "Attribute name must not be null");
Object value = this.attributes.remove(name);
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
项目:nebo
文件:NettyHttpSession.java
/**
* Clear all of this session's attributes.
*/
public void clearAttributes() {
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
项目:spring4-understanding
文件:MockPortletSession.java
protected void doClearAttributes(Map<String, Object> attributes) {
for (Iterator<Map.Entry<String, Object>> it = attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(
new HttpSessionBindingEvent(new MockHttpSession(), name, value));
}
}
}
项目:spring4-understanding
文件:MockHttpSession.java
@Override
public void setAttribute(String name, Object value) {
assertIsValid();
Assert.notNull(name, "Attribute name must not be null");
if (value != null) {
this.attributes.put(name, value);
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueBound(new HttpSessionBindingEvent(this, name, value));
}
}
else {
removeAttribute(name);
}
}
项目:spring4-understanding
文件:MockHttpSession.java
@Override
public void removeAttribute(String name) {
assertIsValid();
Assert.notNull(name, "Attribute name must not be null");
Object value = this.attributes.remove(name);
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
项目:spring4-understanding
文件:MockHttpSession.java
/**
* Clear all of this session's attributes.
*/
public void clearAttributes() {
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
项目:spring4-understanding
文件:MockHttpSession.java
@Override
public void setAttribute(String name, Object value) {
assertIsValid();
Assert.notNull(name, "Attribute name must not be null");
if (value != null) {
this.attributes.put(name, value);
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueBound(new HttpSessionBindingEvent(this, name, value));
}
}
else {
removeAttribute(name);
}
}
项目:spring4-understanding
文件:MockHttpSession.java
@Override
public void removeAttribute(String name) {
assertIsValid();
Assert.notNull(name, "Attribute name must not be null");
Object value = this.attributes.remove(name);
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
项目:spring4-understanding
文件:MockHttpSession.java
/**
* Clear all of this session's attributes.
*/
public void clearAttributes() {
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
}
}
}
项目:spring4-understanding
文件:MockPortletSession.java
protected void doClearAttributes(Map<String, Object> attributes) {
for (Iterator<Map.Entry<String, Object>> it = attributes.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object value = entry.getValue();
it.remove();
if (value instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) value).valueUnbound(
new HttpSessionBindingEvent(new MockHttpSession(), name, value));
}
}
}
项目:vaadin-vertx-samples
文件:VertxWrappedSession.java
@Override
// TODO: catch HttpSessionBindingListener exceptions?
public void invalidate() {
checkSessionState();
Map<String, HttpSessionBindingListener> toUnbind = delegate.data().entrySet().stream()
.filter( entry -> HttpSessionBindingListener.class.isInstance(entry.getValue()))
.collect(toMap(Map.Entry::getKey, e -> HttpSessionBindingListener.class.cast(e.getValue())));
delegate.destroy();
toUnbind.forEach( (name, listener) -> listener.valueUnbound(createHttpSessionBindingEvent(name,listener)));
toUnbind.clear();
}
项目:puzzle
文件:PluginHookListener.java
public void valueBound(HttpSessionBindingEvent event) {
for (EventListener listener: PluginWebInstanceRepository.getListeners()) {
if (listener instanceof HttpSessionBindingListener) {
((HttpSessionBindingListener) listener).valueBound(event);
}
}
}
项目:puzzle
文件:PluginHookListener.java
public void valueUnbound(HttpSessionBindingEvent event) {
for (EventListener listener: PluginWebInstanceRepository.getListeners()) {
if (listener instanceof HttpSessionActivationListener) {
((HttpSessionBindingListener) listener).valueUnbound(event);
}
}
}