当前位置: 首页>>代码示例>>Java>>正文


Java HttpSessionBindingEvent类代码示例

本文整理汇总了Java中javax.servlet.http.HttpSessionBindingEvent的典型用法代码示例。如果您正苦于以下问题:Java HttpSessionBindingEvent类的具体用法?Java HttpSessionBindingEvent怎么用?Java HttpSessionBindingEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HttpSessionBindingEvent类属于javax.servlet.http包,在下文中一共展示了HttpSessionBindingEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attributeUpdated

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
@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));
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:SessionListenerBridge.java

示例2: valueUnbound

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
public void valueUnbound(HttpSessionBindingEvent event) {
    try {
        Engine.logContext.debug("HTTP session stopping...");
        HttpSession httpSession = event.getSession();
        String httpSessionID = httpSession.getId();

        if (Engine.theApp != null) Engine.theApp.contextManager.removeAll(httpSessionID);
        removeSession(httpSessionID);
        
        Engine.logContext.debug("HTTP session stopped [" + httpSessionID + "]");
    } catch(Exception e) {
        Engine.logContext.error("Exception during unbinding HTTP session listener", e);
    }
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:15,代码来源:HttpSessionListener.java

示例3: valueUnbound

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
/**
 * When this object is unbound from the session (including upon session
 * expiry) the files that have been added to the ArrayList are iterated
 * and deleted.
 *
 * @param event  the session unbind event.
 */
public void valueUnbound(HttpSessionBindingEvent event) {

    Iterator iter = this.chartNames.listIterator();
    while (iter.hasNext()) {
        String filename = (String) iter.next();
        File file = new File(
            System.getProperty("java.io.tmpdir"), filename
        );
        if (file.exists()) {
            file.delete();
        }
    }
    return;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:ChartDeleter.java

示例4: removeAttribute

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:22,代码来源:HttpSessionImpl.java

示例5: serializeState

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:27,代码来源:MockHttpSession.java

示例6: shouldUnbindOnInvalidate

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
@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));
}
 
开发者ID:mcollovati,项目名称:vaadin-vertx-samples,代码行数:21,代码来源:VertxWrappedSessionUT.java

示例7: valueUnbound

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
@Override
public void valueUnbound(HttpSessionBindingEvent event) {
    String clientIp = sessionIdClientIp.remove(event.getSession().getId());
    if (clientIp != null) {
        clientIpSessionId.remove(clientIp);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:8,代码来源:CrawlerSessionManagerValve.java

示例8: removeAttribute

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:11,代码来源:HttpSessionImpl.java

示例9: setAttribute

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
@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));
    }

}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:10,代码来源:HttpSessionImpl.java

示例10: attributeAdded

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
@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));
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:SessionListenerBridge.java

示例11: attributeRemoved

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
@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));
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:SessionListenerBridge.java

示例12: valueUnbound

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
@Override
public void valueUnbound(HttpSessionBindingEvent event)
{
	// WICKET-5164 use the original sessionId
	IPageStore store = getPageStore();
	// store might be null if destroyed already
	if (store != null)
	{
		store.unbind(sessionId);
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:12,代码来源:PageStoreManager.java

示例13: valueUnbound

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
public void valueUnbound(HttpSessionBindingEvent event)
{
	if(event.getName().equals("AppSession"))
	{
		Log.logNormal("Removing session");
		OnlineSession session = (OnlineSession)event.getValue();
		m_ResourceManager.removeSession(session);
	}
	else
	{
		Log.logImportant("Removing unknown object from session: "+event.getName());
	}
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:14,代码来源:OnlineSession.java

示例14: valueUnbound

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
/**
 * When this object is unbound from the session (including upon session
 * expiry) the files that have been added to the ArrayList are iterated
 * and deleted.
 *
 * @param event  the session unbind event.
 */
public void valueUnbound(HttpSessionBindingEvent event) {

    Iterator iter = this.chartNames.listIterator();
    while (iter.hasNext()) {
        String filename = (String) iter.next();
        File file = new File(System.getProperty("java.io.tmpdir"), filename);
        if (file.exists()) {
            file.delete();
        }
    }
    return;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:ChartDeleter.java

示例15: attributeAdded

import javax.servlet.http.HttpSessionBindingEvent; //导入依赖的package包/类
/**
 * Record the fact that a servlet context attribute was added.
 *
 * @param event
 *            The session attribute event
 */
@Override
public void attributeAdded(HttpSessionBindingEvent event) {

    log("attributeAdded('" + event.getSession().getId() + "', '"
            + event.getName() + "', '" + event.getValue() + "')");

}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:14,代码来源:SessionListener.java


注:本文中的javax.servlet.http.HttpSessionBindingEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。