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


Java MemoryRealm类代码示例

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


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

示例1: createMemoryRealm

import org.apache.catalina.realm.MemoryRealm; //导入依赖的package包/类
/**
 * Create a new Memory Realm.
 *
 * @param parent MBean Name of the associated parent component
 *
 * @exception Exception if an MBean cannot be created or registered
 */
public String createMemoryRealm(String parent)
    throws Exception {

     // Create a new MemoryRealm instance
    MemoryRealm realm = new MemoryRealm();

    // Add the new instance to its parent component
    ObjectName pname = new ObjectName(parent);
    ContainerBase containerBase = getParentContainerFromParent(pname);
    // Add the new instance to its parent component
    containerBase.setRealm(realm);
    // Return the corresponding MBean name
    ObjectName oname = realm.getObjectName();
    if (oname != null) {
        return (oname.toString());
    } else {
        return null;
    }   

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:28,代码来源:MBeanFactory.java

示例2: createMemoryRealm

import org.apache.catalina.realm.MemoryRealm; //导入依赖的package包/类
/**
 * Create a new Memory Realm.
 *
 * @param parent
 *            MBean Name of the associated parent component
 *
 * @exception Exception
 *                if an MBean cannot be created or registered
 */
public String createMemoryRealm(String parent) throws Exception {

	// Create a new MemoryRealm instance
	MemoryRealm realm = new MemoryRealm();

	// Add the new instance to its parent component
	ObjectName pname = new ObjectName(parent);
	ContainerBase containerBase = getParentContainerFromParent(pname);
	// Add the new instance to its parent component
	containerBase.setRealm(realm);
	// Return the corresponding MBean name
	ObjectName oname = realm.getObjectName();
	if (oname != null) {
		return (oname.toString());
	} else {
		return null;
	}

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:29,代码来源:MBeanFactory.java

示例3: app

import org.apache.catalina.realm.MemoryRealm; //导入依赖的package包/类
@Deployment(testable = false)
public static Archive<?> app() {
    return ShrinkWrap.create(WebArchive.class, "mp.war")
        .addClasses(ConcurrencyServlet.class, User.class)
        .addAsManifestResource(new StringAsset(
            "<Context>" +
            "   <Realm className=\"" + MemoryRealm.class.getName() +
                "\" pathname=\"" +
                new File("src/test/resources/managed/tomcat-users.xml").getAbsolutePath() + "\" />" +
            "</Context>"), "context.xml");
}
 
开发者ID:apache,项目名称:tomee,代码行数:12,代码来源:ManagedExecutorServiceGetPrincipalInTaskTest.java

示例4: configure

import org.apache.catalina.realm.MemoryRealm; //导入依赖的package包/类
@Override
public Embedded configure() throws Exception {
    final URL root = new URL(Tomcat6Configurator.class.getResource("/"), "../../../tomcat-core/target/test-classes");
    final String cleanedRoot = URLDecoder.decode(root.getFile(), "UTF-8");

    final String docBase = cleanedRoot + File.separator + appName;

    MemoryRealm memoryRealm = new MemoryRealm();
    memoryRealm.setPathname(docBase + File.separator + "tomcat-users.xml");

    final Embedded catalina = new Embedded(memoryRealm);
    if (!clientOnly) {
        P2PLifecycleListener listener = new P2PLifecycleListener();
        listener.setConfigLocation(configLocation);
        catalina.addLifecycleListener(listener);
    } else {
        catalina.addLifecycleListener(new ClientServerLifecycleListener());
    }

    final StandardServer server = new StandardServer();
    server.addService(catalina);

    final Engine engine = catalina.createEngine();
    engine.setName("engine-" + port);
    engine.setDefaultHost(DEFAULT_HOST);
    engine.setJvmRoute("tomcat-" + port);

    catalina.addEngine(engine);
    engine.setService(catalina);

    final Host host = catalina.createHost(DEFAULT_HOST, docBase);
    engine.addChild(host);

    final Context context = createContext(catalina, "/", docBase);
    host.addChild(context);

    this.manager = new HazelcastSessionManager();
    context.setManager((HazelcastSessionManager) manager);
    updateManager((HazelcastSessionManager) manager);
    context.setBackgroundProcessorDelay(1);
    context.setCookies(true);

    final Connector connector = catalina.createConnector("localhost", port, false);
    connector.setProperty("bindOnInit", "false");
    catalina.addConnector(connector);

    return catalina;
}
 
开发者ID:hazelcast,项目名称:hazelcast-tomcat-sessionmanager,代码行数:49,代码来源:Tomcat6Configurator.java


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