org.apache.catalina.Context.addChild()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(124)

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

Context.addChild介绍

暂无

代码示例

代码示例来源:origin: apache/geode

public StandardWrapper addServlet(String path, String name, String clazz)
  throws ServletException {
 StandardWrapper servlet = (StandardWrapper) rootContext.createWrapper();
 servlet.setName(name);
 servlet.setServletClass(clazz);
 servlet.setLoadOnStartup(1);
 rootContext.addChild(servlet);
 rootContext.addServletMapping(path, name);
 servlet.setParent(rootContext);
 // servlet.load();
 return servlet;
}

代码示例来源:origin: org.springframework.boot/spring-boot

private void addJspServlet(Context context) {
  Wrapper jspServlet = context.createWrapper();
  jspServlet.setName("jsp");
  jspServlet.setServletClass(getJsp().getClassName());
  jspServlet.addInitParameter("fork", "false");
  getJsp().getInitParameters().forEach(jspServlet::addInitParameter);
  jspServlet.setLoadOnStartup(3);
  context.addChild(jspServlet);
  context.addServletMappingDecoded("*.jsp", "jsp");
  context.addServletMappingDecoded("*.jspx", "jsp");
}

代码示例来源:origin: org.springframework.boot/spring-boot

private void addDefaultServlet(Context context) {
  Wrapper defaultServlet = context.createWrapper();
  defaultServlet.setName("default");
  defaultServlet.setServletClass("org.apache.catalina.servlets.DefaultServlet");
  defaultServlet.addInitParameter("debug", "0");
  defaultServlet.addInitParameter("listings", "false");
  defaultServlet.setLoadOnStartup(1);
  // Otherwise the default location of a Spring DispatcherServlet cannot be set
  defaultServlet.setOverridable(true);
  context.addChild(defaultServlet);
  context.addServletMappingDecoded("/", "default");
}

代码示例来源:origin: pippo-java/pippo

wrapper.setLoadOnStartup(1);
wrapper.setServlet(pippoServlet);
context.addChild(wrapper);
context.addServletMapping(pippoFilterPath, name);

代码示例来源:origin: stackoverflow.com

Context context = (Context) wrapper.getParent();
Wrapper newWrapper = context.createWrapper();
newWrapper.setName(name);
newWrapper.setLoadOnStartup(1);
newWrapper.setServletClass(servletClass);
context.addChild(newWrapper);
context.addServletMapping(pattern, name);

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

/**
 * Static version of {@link #addServlet(String, String, Servlet)}.
 * @param ctx           Context to add Servlet to
 * @param servletName   Servlet name (used in mappings)
 * @param servlet       The Servlet to add
 * @return The wrapper for the servlet
 */
public static Wrapper addServlet(Context ctx,
                 String servletName, 
                 Servlet servlet) {
  // will do class for name and set init params
  Wrapper sw = new ExistingStandardWrapper(servlet);
  sw.setName(servletName);
  ctx.addChild(sw);
  
  return sw;
}

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

/**
 * Static version of {@link #addServlet(String, String, Servlet)}.
 * @param ctx           Context to add Servlet to
 * @param servletName   Servlet name (used in mappings)
 * @param servlet       The Servlet to add
 * @return The wrapper for the servlet
 */
public static Wrapper addServlet(Context ctx,
                 String servletName,
                 Servlet servlet) {
  // will do class for name and set init params
  Wrapper sw = new ExistingStandardWrapper(servlet);
  sw.setName(servletName);
  ctx.addChild(sw);
  return sw;
}

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

/**
 * Static version of {@link #addServlet(String, String, Servlet)}.
 * @param ctx           Context to add Servlet to
 * @param servletName   Servlet name (used in mappings)
 * @param servlet       The Servlet to add
 * @return The wrapper for the servlet
 */
public static Wrapper addServlet(Context ctx,
                 String servletName, 
                 Servlet servlet) {
  // will do class for name and set init params
  Wrapper sw = new ExistingStandardWrapper(servlet);
  sw.setName(servletName);
  ctx.addChild(sw);
  
  return sw;
}

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

/**
 * Static version of {@link #addServlet(String, String, Servlet)}.
 * @param ctx           Context to add Servlet to
 * @param servletName   Servlet name (used in mappings)
 * @param servlet       The Servlet to add
 * @return The wrapper for the servlet
 */
public static Wrapper addServlet(Context ctx,
                 String servletName, 
                 Servlet servlet) {
  // will do class for name and set init params
  Wrapper sw = new ExistingStandardWrapper(servlet);
  sw.setName(servletName);
  ctx.addChild(sw);
  
  return sw;
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Static version of {@link #addServlet(String, String, Servlet)}.
 * @param ctx           Context to add Servlet to
 * @param servletName   Servlet name (used in mappings)
 * @param servlet       The Servlet to add
 * @return The wrapper for the servlet
 */
public static Wrapper addServlet(Context ctx,
                 String servletName,
                 Servlet servlet) {
  // will do class for name and set init params
  Wrapper sw = new ExistingStandardWrapper(servlet);
  sw.setName(servletName);
  ctx.addChild(sw);
  return sw;
}

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

/**
 * Static version of {@link #addServlet(String, String, Servlet)}.
 * @param ctx           Context to add Servlet to
 * @param servletName   Servlet name (used in mappings)
 * @param servlet       The Servlet to add
 * @return The wrapper for the servlet
 */
public static Wrapper addServlet(Context ctx,
                 String servletName, 
                 Servlet servlet) {
  // will do class for name and set init params
  Wrapper sw = new ExistingStandardWrapper(servlet);
  sw.setName(servletName);
  ctx.addChild(sw);
  
  return sw;
}

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

/**
 * Static version of {@link #addServlet(String, String, String)}
 * @param ctx           Context to add Servlet to
 * @param servletName   Servlet name (used in mappings)
 * @param servletClass  The class to be used for the Servlet
 * @return The wrapper for the servlet
 */
public static Wrapper addServlet(Context ctx, 
                 String servletName, 
                 String servletClass) {
  // will do class for name and set init params
  Wrapper sw = ctx.createWrapper();
  sw.setServletClass(servletClass);
  sw.setName(servletName);
  ctx.addChild(sw);
  
  return sw;
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Static version of {@link #addServlet(String, String, String)}
 * @param ctx           Context to add Servlet to
 * @param servletName   Servlet name (used in mappings)
 * @param servletClass  The class to be used for the Servlet
 * @return The wrapper for the servlet
 */
public static Wrapper addServlet(Context ctx,
                 String servletName,
                 String servletClass) {
  // will do class for name and set init params
  Wrapper sw = ctx.createWrapper();
  sw.setServletClass(servletClass);
  sw.setName(servletName);
  ctx.addChild(sw);
  return sw;
}

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

/**
 * Static version of {@link #addServlet(String, String, String)}
 * @param ctx           Context to add Servlet to
 * @param servletName   Servlet name (used in mappings)
 * @param servletClass  The class to be used for the Servlet
 * @return The wrapper for the servlet
 */
public static Wrapper addServlet(Context ctx,
                 String servletName,
                 String servletClass) {
  // will do class for name and set init params
  Wrapper sw = ctx.createWrapper();
  sw.setServletClass(servletClass);
  sw.setName(servletName);
  ctx.addChild(sw);
  return sw;
}

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

/**
 * Static version of {@link #addServlet(String, String, String)}
 * @param ctx           Context to add Servlet to
 * @param servletName   Servlet name (used in mappings)
 * @param servletClass  The class to be used for the Servlet
 * @return The wrapper for the servlet
 */
public static Wrapper addServlet(Context ctx, 
                 String servletName, 
                 String servletClass) {
  // will do class for name and set init params
  Wrapper sw = ctx.createWrapper();
  sw.setServletClass(servletClass);
  sw.setName(servletName);
  ctx.addChild(sw);
  
  return sw;
}

代码示例来源:origin: chrismattmann/lucene-geo-gazetteer

public static void launchService(int port, String indexPath)
    throws IOException, LifecycleException {
  Tomcat server = new Tomcat();
  Context context = server.addContext("/", new File(".").getAbsolutePath());
  System.setProperty(INDEX_PATH_PROP, indexPath);
  Wrapper servlet = context.createWrapper();
  servlet.setName("CXFNonSpringJaxrs");
  servlet.setServletClass(CXFNonSpringJaxrsServlet.class.getName());
  servlet.addInitParameter("jaxrs.serviceClasses", SearchResource.class.getName() + " " + HealthCheckAPI.class.getName());
  servlet.setLoadOnStartup(1);
  context.addChild(servlet);
  context.addServletMapping("/api/*", "CXFNonSpringJaxrs");
  System.out.println("Starting Embedded Tomcat on port : " + port );
  server.setPort(port);
  server.start();
  server.getServer().await();
}

代码示例来源:origin: apache/tomcat-maven-plugin

private void createStaticContext( final Tomcat container, Context context, Host host )
{
  if ( staticContextDocbase != null )
  {
    Context staticContext = container.addContext( staticContextPath, staticContextDocbase );
    staticContext.setPrivileged( true );
    Wrapper servlet = context.createWrapper();
    servlet.setServletClass( DefaultServlet.class.getName() );
    servlet.setName( "staticContent" );
    staticContext.addChild( servlet );
    staticContext.addServletMapping( "/", "staticContent" );
    // see https://issues.apache.org/jira/browse/MTOMCAT-238
    //host.addChild( staticContext );
  }
}

代码示例来源:origin: net.disy.legato/legato-testing

@Override
public void addServletWithMapping(
  final String contextPath,
  final String servletClassName,
  final String servletMapping) {
 final Context context = getContext(contextPath);
 final Wrapper wrapper = context.createWrapper();
 wrapper.setName(servletClassName);
 wrapper.setServletClass(servletClassName);
 context.addChild(wrapper);
 context.addServletMapping(contextPath + servletMapping, servletClassName);
}

代码示例来源:origin: apache/tomcat-maven-plugin

private void createStaticContext( final Embedded container, Context context, Host host )
{
  if ( staticContextDocbase != null )
  {
    Context staticContext = container.createContext( staticContextPath, staticContextDocbase );
    staticContext.setPrivileged( true );
    Wrapper servlet = context.createWrapper();
    servlet.setServletClass( DefaultServlet.class.getName() );
    servlet.setName( "staticContent" );
    staticContext.addChild( servlet );
    staticContext.addServletMapping( "/", "staticContent" );
    host.addChild( staticContext );
  }
}

代码示例来源:origin: apache/tomcat-maven-plugin

private void createStaticContext( final Tomcat container, Context context, Host host )
{
  if ( staticContextDocbase != null )
  {
    Context staticContext = container.addContext( staticContextPath, staticContextDocbase );
    Tomcat.initWebappDefaults(staticContext);
    staticContext.setPrivileged( true );
    Wrapper servlet = context.createWrapper();
    servlet.setServletClass( DefaultServlet.class.getName() );
    servlet.setName( "staticContent" );
    staticContext.addChild( servlet );
    staticContext.addServletMapping( "/", "staticContent" );
    // see https://issues.apache.org/jira/browse/MTOMCAT-238
    //host.addChild( staticContext );
  }
}

相关文章

微信公众号

最新文章

更多

Context类方法