當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。