本文整理汇总了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;
}
}
示例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;
}
}
示例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");
}
示例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;
}