org.apache.catalina.startup.Tomcat.initSimpleAuth()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中org.apache.catalina.startup.Tomcat.initSimpleAuth()方法的一些代码示例,展示了Tomcat.initSimpleAuth()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tomcat.initSimpleAuth()方法的具体详情如下:
包路径:org.apache.catalina.startup.Tomcat
类名称:Tomcat
方法名:initSimpleAuth

Tomcat.initSimpleAuth介绍

[英]Create an in-memory realm. You can replace it for contexts with a real one. The Realm created here will be added to the Engine by default and may be replaced at the Engine level or over-ridden (as per normal Tomcat behaviour) at the Host or Context level.
[中]创建一个内存领域。你可以用一个真实的上下文替换它。默认情况下,这里创建的领域将被添加到引擎中,并可能在引擎级别被替换,或者在主机或上下文级别被过度使用(根据Tomcat的正常行为)。

代码示例

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * For complex configurations, this accessor allows callers of this class
 * to obtain the simple realm created by default.
 * @return the simple in-memory realm created by default.
 * @deprecated Will be removed in Tomcat 8.0.x
 */
@Deprecated
public Realm getDefaultRealm() {
  if (defaultRealm == null) {
    initSimpleAuth();
  }
  return defaultRealm;
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * For complex configurations, this accessor allows callers of this class
 * to obtain the simple realm created by default.
 * @return the simple in-memory realm created by default.
 * @deprecated Will be removed in Tomcat 8.0.x
 */
@Deprecated
public Realm getDefaultRealm() {
  if (defaultRealm == null) {
    initSimpleAuth();
  }
  return defaultRealm;
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

/** 
 * Access to the engine, for further customization.
 */
public Engine getEngine() {
  if(engine == null ) {
    getServer();
    engine = new StandardEngine();
    engine.setName( "Tomcat" );
    engine.setDefaultHost(hostname);
    if (defaultRealm == null) {
      initSimpleAuth();
    }
    engine.setRealm(defaultRealm);
    service.setContainer(engine);
  }
  return engine;
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

/** 
 * Access to the engine, for further customization.
 */
public Engine getEngine() {
  if(engine == null ) {
    getServer();
    engine = new StandardEngine();
    engine.setName( "Tomcat" );
    engine.setDefaultHost(hostname);
    if (defaultRealm == null) {
      initSimpleAuth();
    }
    engine.setRealm(defaultRealm);
    service.setContainer(engine);
  }
  return engine;
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

public Context addWebapp(Host host, String url, String path) {
  silence(url);
  Context ctx = new StandardContext();
  ctx.setPath( url );
  ctx.setDocBase(path);
  if (defaultRealm == null) {
    initSimpleAuth();
  }
  ctx.setRealm(defaultRealm);
  ctx.addLifecycleListener(new DefaultWebXmlListener());
  
  ContextConfig ctxCfg = new ContextConfig();
  ctx.addLifecycleListener(ctxCfg);
  
  // prevent it from looking ( if it finds one - it'll have dup error )
  ctxCfg.setDefaultWebXml("org/apache/catalin/startup/NO_DEFAULT_XML");
  
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

public Context addWebapp(Host host, String url, String path) {
  silence(url);
  Context ctx = new StandardContext();
  ctx.setPath( url );
  ctx.setDocBase(path);
  if (defaultRealm == null) {
    initSimpleAuth();
  }
  ctx.setRealm(defaultRealm);
  ctx.addLifecycleListener(new DefaultWebXmlListener());
  
  ContextConfig ctxCfg = new ContextConfig();
  ctx.addLifecycleListener(ctxCfg);
  
  // prevent it from looking ( if it finds one - it'll have dup error )
  ctxCfg.setDefaultWebXml("org/apache/catalin/startup/NO_DEFAULT_XML");
  
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

public Context addWebapp(Host host, String url, String path) {
  silence(url);
  Context ctx = new StandardContext();
  ctx.setPath( url );
  ctx.setDocBase(path);
  if (defaultRealm == null) {
    initSimpleAuth();
  }
  ctx.setRealm(defaultRealm);
  ctx.addLifecycleListener(new DefaultWebXmlListener());
  
  ContextConfig ctxCfg = new ContextConfig();
  ctx.addLifecycleListener(ctxCfg);
  
  // prevent it from looking ( if it finds one - it'll have dup error )
  ctxCfg.setDefaultWebXml("org/apache/catalin/startup/NO_DEFAULT_XML");
  
  if (host == null) {
    getHost().addChild(ctx);
  } else {
    host.addChild(ctx);
  }
  return ctx;
}

相关文章