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

x33g5p2x  于2022-02-02 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(160)

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

Wrapper.setName介绍

暂无

代码示例

代码示例来源: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

String name = "pippoServlet";
wrapper.setName(name);
wrapper.setLoadOnStartup(1);
wrapper.setServlet(pippoServlet);

代码示例来源: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: 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.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * 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-tomcat7

/**
 * 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.tomee/tomee-catalina

@Override
  protected void initInternal() throws LifecycleException {
    super.initInternal();
    final Wrapper servlet = createWrapper();
    servlet.setName(ServerServlet.class.getSimpleName());
    servlet.setServletClass(ServerServlet.class.getName());
    addChild(servlet);
    addServletMappingDecoded(MAPPING, ServerServlet.class.getSimpleName());
  }
}

代码示例来源: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: 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: 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: org.apache.geronimo.modules/geronimo-tomcat6

public TomcatEJBWebServiceContext(String contextPath, WebServiceContainer webServiceContainer, ClassLoader classLoader) {
  this.webServiceContainer = webServiceContainer;
  this.setPath(contextPath);
  this.setDocBase("");
  this.setParentClassLoader(classLoader);
  this.setDelegate(true);
  log.debug("EJB Webservice Context = " + contextPath);
  this.classLoader = classLoader;
  
  //Create a dummy wrapper
  Wrapper wrapper = this.createWrapper();
  String name = System.currentTimeMillis() + "";
  wrapper.setName(name);
  this.addChild(wrapper);
  this.addServletMapping("/*", name);
}

代码示例来源: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 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: com.tomitribe.tribestream/tribestream-container

public ProgrammaticContext addServlet(final String name, final Class<?> type, final String mapping, final String... initParams) {
  final Wrapper wrapper = createWrapper();
  wrapper.setServletClass(type.getName());
  wrapper.setName(name);
  if (initParams != null && initParams.length > 0) {
    for (int i = 0; i < initParams.length; i+=2) {
      wrapper.addInitParameter(initParams[i], initParams[i+1]);
    }
  }
  wrapper.setLoadOnStartup(1); // otherwise we would miss reposgitry integration at least
  addChild(wrapper);
  addServletMapping(mapping, wrapper.getName(), false);
  return this;
}

代码示例来源: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: nutzam/nutzboot

private void addDefaultServlet() {
  Wrapper defaultServlet = this.tomcatContext.createWrapper();
  defaultServlet.setName("default");
  defaultServlet.setServletClass("org.apache.catalina.servlets.DefaultServlet");
  defaultServlet.addInitParameter("debug", "0");
  defaultServlet.addInitParameter("listings", "false");
  defaultServlet.setLoadOnStartup(1);
  defaultServlet.setOverridable(true);
  this.tomcatContext.addChild(defaultServlet);
  addServletMapping("/", "default");
}

相关文章