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


Java HashSessionManager类代码示例

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


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

示例1: controllerIdentification

import org.mortbay.jetty.servlet.HashSessionManager; //导入依赖的package包/类
@Test
public void controllerIdentification() throws Exception {
	// setup
	Messages messages = new Messages(Locale.getDefault());
	Runtime runtime = new TestRuntime();
	View view = new TestView();
	Controller controller = new Controller(view, runtime, messages);

	// make sure that the session cookies are passed during conversations
	CookieManager cookieManager = new CookieManager();
	cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
	CookieHandler.setDefault(cookieManager);

	// operate
	controller.run();

	// verify
	LOG.debug("verify...");
	SessionHandler sessionHandler = this.servletTester.getContext().getSessionHandler();
	SessionManager sessionManager = sessionHandler.getSessionManager();
	LOG.debug("session manager type: " + sessionManager.getClass().getName());
	HashSessionManager hashSessionManager = (HashSessionManager) sessionManager;
	LOG.debug("# sessions: " + hashSessionManager.getSessions());
	assertEquals(1, hashSessionManager.getSessions());
	Map<String, HttpSession> sessionMap = hashSessionManager.getSessionMap();
	LOG.debug("session map: " + sessionMap);
	Entry<String, HttpSession> sessionEntry = sessionMap.entrySet().iterator().next();
	HttpSession httpSession = sessionEntry.getValue();
	assertNotNull(httpSession.getAttribute("eid"));
	Identity identity = (Identity) httpSession.getAttribute("eid.identity");
	assertNotNull(identity);
	assertNotNull(identity.name);
	LOG.debug("name: " + identity.name);
	LOG.debug("document type: " + identity.getDocumentType());
	LOG.debug("duplicate: " + identity.getDuplicate());
	assertNull(httpSession.getAttribute("eid.identifier"));
	assertNull(httpSession.getAttribute("eid.address"));
	assertNull(httpSession.getAttribute("eid.photo"));
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:40,代码来源:ControllerTest.java

示例2: controllerAuthentication

import org.mortbay.jetty.servlet.HashSessionManager; //导入依赖的package包/类
@Test
public void controllerAuthentication() throws Exception {
	// setup
	Messages messages = new Messages(Locale.getDefault());
	Runtime runtime = new TestRuntime();
	View view = new TestView();
	Controller controller = new Controller(view, runtime, messages);

	// make sure that the session cookies are passed during conversations
	CookieManager cookieManager = new CookieManager();
	cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
	CookieHandler.setDefault(cookieManager);

	this.servletHolder.setInitParameter("AuthenticationServiceClass", TestAuthenticationService.class.getName());
	this.servletHolder.setInitParameter("Logoff", "true");

	// operate
	controller.run();

	// verify
	LOG.debug("verify...");
	SessionHandler sessionHandler = this.servletTester.getContext().getSessionHandler();
	SessionManager sessionManager = sessionHandler.getSessionManager();
	LOG.debug("session manager type: " + sessionManager.getClass().getName());
	HashSessionManager hashSessionManager = (HashSessionManager) sessionManager;
	LOG.debug("# sessions: " + hashSessionManager.getSessions());
	assertEquals(1, hashSessionManager.getSessions());
	Map<String, HttpSession> sessionMap = hashSessionManager.getSessionMap();
	LOG.debug("session map: " + sessionMap);
	Entry<String, HttpSession> sessionEntry = sessionMap.entrySet().iterator().next();
	HttpSession httpSession = sessionEntry.getValue();
	assertNotNull(httpSession.getAttribute("eid"));
	assertNull(httpSession.getAttribute("eid.identity"));
	assertNull(httpSession.getAttribute("eid.address"));
	assertNull(httpSession.getAttribute("eid.photo"));
	String identifier = (String) httpSession.getAttribute("eid.identifier");
	assertNotNull(identifier);
	LOG.debug("identifier: " + identifier);
	assertTrue(TestAuthenticationService.called);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:41,代码来源:ControllerTest.java

示例3: controllerIdentificationWithAddressAndPhoto

import org.mortbay.jetty.servlet.HashSessionManager; //导入依赖的package包/类
@Test
public void controllerIdentificationWithAddressAndPhoto() throws Exception {
	// setup
	Messages messages = new Messages(Locale.getDefault());
	Runtime runtime = new TestRuntime();
	View view = new TestView();
	Controller controller = new Controller(view, runtime, messages);

	// make sure that the session cookies are passed during conversations
	CookieManager cookieManager = new CookieManager();
	cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
	CookieHandler.setDefault(cookieManager);

	this.servletHolder.setInitParameter("IncludeAddress", "true");
	this.servletHolder.setInitParameter("IncludePhoto", "true");

	// operate
	controller.run();

	// verify
	LOG.debug("verify...");
	SessionHandler sessionHandler = this.servletTester.getContext().getSessionHandler();
	SessionManager sessionManager = sessionHandler.getSessionManager();
	LOG.debug("session manager type: " + sessionManager.getClass().getName());
	HashSessionManager hashSessionManager = (HashSessionManager) sessionManager;
	LOG.debug("# sessions: " + hashSessionManager.getSessions());
	assertEquals(1, hashSessionManager.getSessions());
	Map<String, HttpSession> sessionMap = hashSessionManager.getSessionMap();
	LOG.debug("session map: " + sessionMap);
	Entry<String, HttpSession> sessionEntry = sessionMap.entrySet().iterator().next();
	HttpSession httpSession = sessionEntry.getValue();
	assertNotNull(httpSession.getAttribute("eid"));
	Identity identity = (Identity) httpSession.getAttribute("eid.identity");
	assertNotNull(identity);
	assertNotNull(identity.name);
	LOG.debug("name: " + identity.name);
	LOG.debug("nationality: " + identity.getNationality());
	LOG.debug("national number: " + identity.getNationalNumber());
	assertNull(httpSession.getAttribute("eid.identifier"));
	assertNotNull(httpSession.getAttribute("eid.address"));
	assertNotNull(httpSession.getAttribute("eid.photo"));
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:43,代码来源:ControllerTest.java

示例4: testAuthnSessionIdChannelBinding

import org.mortbay.jetty.servlet.HashSessionManager; //导入依赖的package包/类
@Test
public void testAuthnSessionIdChannelBinding() throws Exception {
	// setup
	Messages messages = new Messages(Locale.getDefault());
	Runtime runtime = new TestRuntime();
	View view = new TestView();
	Controller controller = new Controller(view, runtime, messages);

	// make sure that the session cookies are passed during conversations
	CookieManager cookieManager = new CookieManager();
	cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
	CookieHandler.setDefault(cookieManager);

	this.servletHolder.setInitParameter("AuthenticationServiceClass", TestAuthenticationService.class.getName());
	this.servletHolder.setInitParameter("Logoff", "true");
	this.servletHolder.setInitParameter("SessionIdChannelBinding", "true");

	// operate
	controller.run();

	// verify
	LOG.debug("verify...");
	SessionHandler sessionHandler = this.servletTester.getContext().getSessionHandler();
	SessionManager sessionManager = sessionHandler.getSessionManager();
	LOG.debug("session manager type: " + sessionManager.getClass().getName());
	HashSessionManager hashSessionManager = (HashSessionManager) sessionManager;
	LOG.debug("# sessions: " + hashSessionManager.getSessions());
	assertEquals(1, hashSessionManager.getSessions());
	Map<String, HttpSession> sessionMap = hashSessionManager.getSessionMap();
	LOG.debug("session map: " + sessionMap);
	Entry<String, HttpSession> sessionEntry = sessionMap.entrySet().iterator().next();
	HttpSession httpSession = sessionEntry.getValue();
	assertNotNull(httpSession.getAttribute("eid"));
	assertNull(httpSession.getAttribute("eid.identity"));
	assertNull(httpSession.getAttribute("eid.address"));
	assertNull(httpSession.getAttribute("eid.photo"));
	String identifier = (String) httpSession.getAttribute("eid.identifier");
	assertNotNull(identifier);
	LOG.debug("identifier: " + identifier);
	assertTrue(TestAuthenticationService.called);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:42,代码来源:ControllerTest.java

示例5: testAuthnServerCertificateChannelBinding

import org.mortbay.jetty.servlet.HashSessionManager; //导入依赖的package包/类
@Test
public void testAuthnServerCertificateChannelBinding() throws Exception {
	// setup
	Messages messages = new Messages(Locale.getDefault());
	Runtime runtime = new TestRuntime();
	View view = new TestView();
	Controller controller = new Controller(view, runtime, messages);

	// make sure that the session cookies are passed during conversations
	CookieManager cookieManager = new CookieManager();
	cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
	CookieHandler.setDefault(cookieManager);

	this.servletHolder.setInitParameter("AuthenticationServiceClass", TestAuthenticationService.class.getName());
	this.servletHolder.setInitParameter("Logoff", "true");
	File tmpCertFile = File.createTempFile("ssl-server-cert-", ".crt");
	FileUtils.writeByteArrayToFile(tmpCertFile, this.certificate.getEncoded());
	this.servletHolder.setInitParameter("ChannelBindingServerCertificate", tmpCertFile.toString());

	// operate
	controller.run();

	// verify
	LOG.debug("verify...");
	SessionHandler sessionHandler = this.servletTester.getContext().getSessionHandler();
	SessionManager sessionManager = sessionHandler.getSessionManager();
	LOG.debug("session manager type: " + sessionManager.getClass().getName());
	HashSessionManager hashSessionManager = (HashSessionManager) sessionManager;
	LOG.debug("# sessions: " + hashSessionManager.getSessions());
	assertEquals(1, hashSessionManager.getSessions());
	Map<String, HttpSession> sessionMap = hashSessionManager.getSessionMap();
	LOG.debug("session map: " + sessionMap);
	Entry<String, HttpSession> sessionEntry = sessionMap.entrySet().iterator().next();
	HttpSession httpSession = sessionEntry.getValue();
	assertNotNull(httpSession.getAttribute("eid"));
	assertNull(httpSession.getAttribute("eid.identity"));
	assertNull(httpSession.getAttribute("eid.address"));
	assertNull(httpSession.getAttribute("eid.photo"));
	String identifier = (String) httpSession.getAttribute("eid.identifier");
	assertNotNull(identifier);
	LOG.debug("identifier: " + identifier);
	assertTrue(TestAuthenticationService.called);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:44,代码来源:ControllerTest.java

示例6: testAuthnHybridChannelBinding

import org.mortbay.jetty.servlet.HashSessionManager; //导入依赖的package包/类
@Test
public void testAuthnHybridChannelBinding() throws Exception {
	// setup
	Messages messages = new Messages(Locale.getDefault());
	Runtime runtime = new TestRuntime();
	View view = new TestView();
	Controller controller = new Controller(view, runtime, messages);

	// make sure that the session cookies are passed during conversations
	CookieManager cookieManager = new CookieManager();
	cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
	CookieHandler.setDefault(cookieManager);

	this.servletHolder.setInitParameter("AuthenticationServiceClass", TestAuthenticationService.class.getName());
	this.servletHolder.setInitParameter("Logoff", "true");
	File tmpCertFile = File.createTempFile("ssl-server-cert-", ".crt");
	FileUtils.writeByteArrayToFile(tmpCertFile, this.certificate.getEncoded());
	this.servletHolder.setInitParameter("ChannelBindingServerCertificate", tmpCertFile.toString());
	this.servletHolder.setInitParameter("SessionIdChannelBinding", "true");

	// operate
	controller.run();

	// verify
	LOG.debug("verify...");
	SessionHandler sessionHandler = this.servletTester.getContext().getSessionHandler();
	SessionManager sessionManager = sessionHandler.getSessionManager();
	LOG.debug("session manager type: " + sessionManager.getClass().getName());
	HashSessionManager hashSessionManager = (HashSessionManager) sessionManager;
	LOG.debug("# sessions: " + hashSessionManager.getSessions());
	assertEquals(1, hashSessionManager.getSessions());
	Map<String, HttpSession> sessionMap = hashSessionManager.getSessionMap();
	LOG.debug("session map: " + sessionMap);
	Entry<String, HttpSession> sessionEntry = sessionMap.entrySet().iterator().next();
	HttpSession httpSession = sessionEntry.getValue();
	assertNotNull(httpSession.getAttribute("eid"));
	assertNull(httpSession.getAttribute("eid.identity"));
	assertNull(httpSession.getAttribute("eid.address"));
	assertNull(httpSession.getAttribute("eid.photo"));
	String identifier = (String) httpSession.getAttribute("eid.identifier");
	assertNotNull(identifier);
	LOG.debug("identifier: " + identifier);
	assertTrue(TestAuthenticationService.called);
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:45,代码来源:ControllerTest.java

示例7: setHashSessionManager

import org.mortbay.jetty.servlet.HashSessionManager; //导入依赖的package包/类
/**
 * Set the HashSessionManager
 *
 * @param hashSessionManager
 */
public void setHashSessionManager(HashSessionManager hashSessionManager)
{
    this.hashSessionManager = hashSessionManager;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:10,代码来源:VtiServer.java


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