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

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

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

Wrapper.addInitParameter介绍

[英]Add a new servlet initialization parameter for this servlet.
[中]为此servlet添加新的servlet初始化参数。

代码示例

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

wrapper.addInitParameter("javax.ws.rs.Application", OryxApplication.class.getName());

代码示例来源:origin: org.apache.openejb/tomee-webservices

private void setWsContainer(Context context, Wrapper wrapper, HttpListener wsContainer) {
    // Make up an ID for the WebServiceContainer
    // put a reference the ID in the init-params
    // put the WebServiceContainer in the webapp context keyed by its ID
    String webServicecontainerID = wrapper.getName() + WsServlet.WEBSERVICE_CONTAINER + wsContainer.hashCode();
    context.getServletContext().setAttribute(webServicecontainerID, wsContainer);
    wrapper.addInitParameter(WsServlet.WEBSERVICE_CONTAINER, webServicecontainerID);
  }
}

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

private void setWsContainer(Context context, Wrapper wrapper, HttpListener wsContainer) {
    // Make up an ID for the WebServiceContainer
    // put a reference the ID in the init-params
    // put the WebServiceContainer in the webapp context keyed by its ID
    String webServicecontainerID = wrapper.getName() + WsServlet.WEBSERVICE_CONTAINER + wsContainer.hashCode();
    context.getServletContext().setAttribute(webServicecontainerID, wsContainer);
    wrapper.addInitParameter(WsServlet.WEBSERVICE_CONTAINER, webServicecontainerID);
  }
}

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

@Override
public boolean setInitParameter(String name, String value) {
  if (name == null || value == null) {
    throw new IllegalArgumentException(
        sm.getString("applicationFilterRegistration.nullInitParam",
            name, value));
  }
  if (getInitParameter(name) != null) {
    return false;
  }
  wrapper.addInitParameter(name, value);
  return true;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
public boolean setInitParameter(String name, String value) {
  if (name == null || value == null) {
    throw new IllegalArgumentException(
        sm.getString("applicationFilterRegistration.nullInitParam",
            name, value));
  }
  if (getInitParameter(name) != null) {
    return false;
  }
  wrapper.addInitParameter(name, value);
  return true;
}

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

@Override
public boolean setInitParameter(String name, String value) {
  if (name == null || value == null) {
    throw new IllegalArgumentException(
        sm.getString("applicationFilterRegistration.nullInitParam",
            name, value));
  }
  if (getInitParameter(name) != null) {
    return false;
  }
  
  wrapper.addInitParameter(name, value);
  return true;
}

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

@Override
public boolean setInitParameter(String name, String value) {
  if (name == null || value == null) {
    throw new IllegalArgumentException(
        sm.getString("applicationFilterRegistration.nullInitParam",
            name, value));
  }
  if (getInitParameter(name) != null) {
    return false;
  }
  
  wrapper.addInitParameter(name, value);
  return true;
}

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

@Override
public boolean setInitParameter(String name, String value) {
  if (name == null || value == null) {
    throw new IllegalArgumentException(
        sm.getString("applicationFilterRegistration.nullInitParam",
            name, value));
  }
  if (getInitParameter(name) != null) {
    return false;
  }
  
  wrapper.addInitParameter(name, value);
  return true;
}

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

@Override
public boolean setInitParameter(String name, String value) {
  if (name == null || value == null) {
    throw new IllegalArgumentException(
        sm.getString("applicationFilterRegistration.nullInitParam",
            name, value));
  }
  if (getInitParameter(name) != null) {
    return false;
  }
  wrapper.addInitParameter(name, value);
  return true;
}

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

@Override
public boolean setInitParameter(String name, String value) {
  if (name == null || value == null) {
    throw new IllegalArgumentException(
        sm.getString("applicationFilterRegistration.nullInitParam",
            name, value));
  }
  if (getInitParameter(name) != null) {
    return false;
  }
  
  wrapper.addInitParameter(name, value);
  return true;
}

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

@Override
public boolean setInitParameter(String name, String value) {
  if (name == null || value == null) {
    throw new IllegalArgumentException(
        sm.getString("applicationFilterRegistration.nullInitParam",
            name, value));
  }
  if (getInitParameter(name) != null) {
    return false;
  }
  
  wrapper.addInitParameter(name, value);
  return true;
}

代码示例来源:origin: com.bsb.common.vaadin/com.bsb.common.vaadin7.embed

@Override
  protected void configure() {
    initConfiguration();
    // Setup vaadin servlet
    final Wrapper wrapper = initializeVaadinServlet(new VaadinServlet());
    wrapper.addInitParameter("UI", uiClass.getName());
  }
}

代码示例来源: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");
}

代码示例来源:origin: org.glassfish.web/web-glue

/**
 * Creates an ad-hoc servlet wrapper from the given ad-hoc servlet info.
 *
 * @param servletInfo Ad-hoc servlet info from which to generate
 * ad-hoc servlet wrapper
 *
 * @return The generated ad-hoc servlet wrapper
 */
private Wrapper createAdHocWrapper(AdHocServletInfo servletInfo) {
  Wrapper adHocWrapper = new StandardWrapper();
  adHocWrapper.setServletClassName(
    servletInfo.getServletClass().getName());
  adHocWrapper.setName(servletInfo.getServletName());
  Map<String,String> initParams = servletInfo.getServletInitParams();
  if (initParams != null && !initParams.isEmpty()) {
    for(String paramName : initParams.keySet()) {
      adHocWrapper.addInitParameter(paramName, initParams.get(paramName));
    }
  }
  return adHocWrapper;
}

代码示例来源: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.nuxeo.runtime/nuxeo-runtime-server

@Override
public void addServlet(ServletDescriptor descriptor) {
  String name = descriptor.getName();
  Context context = getContextForPath(descriptor.getContext());
  // remove existing servlet, to allow overrides (usually to change init params)
  Container previous = context.findChild(name);
  if (previous != null) {
    context.removeChild(previous);
  }
  Wrapper servlet = Tomcat.addServlet(context, name, descriptor.getClazz().getName());
  Map<String, String> initParams = descriptor.getInitParams();
  if (initParams != null) {
    for (Entry<String, String> es : initParams.entrySet()) {
      servlet.addInitParameter(es.getKey(), es.getValue());
    }
  }
  for (String urlPattern : descriptor.getUrlPatterns()) {
    context.addServletMappingDecoded(urlPattern, name);
  }
}

代码示例来源: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: com.bsb.common.vaadin/com.bsb.common.vaadin7.embed

/**
 * Initializes the vaadin servlet and maps it to <tt>/*</tt>.
 * <p/>
 * Returns the associated {@link Wrapper} for further customization.
 *
 * @param servlet the servlet to use to handle vaadin calls.
 * @param <T> the type of the servlet
 * @return the created wrapper for the servlet
 */
protected <T extends VaadinServlet> Wrapper initializeVaadinServlet(T servlet) {
  // Setup vaadin servlet
  final Wrapper wrapper = Tomcat.addServlet(getContext(),
      "vaadin", servlet);
  if (getConfig().getWidgetSet() != null) {
    wrapper.addInitParameter("widgetset", getConfig().getWidgetSet());
  }
  wrapper.addMapping("/*");
  return wrapper;
}

相关文章