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

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

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

Wrapper.isOverridable介绍

[英]Is the Servlet overridable by a ServletContainerInitializer?
[中]Servlet是否可以被ServletContainerInitializer覆盖?

代码示例

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

@Override
public Set<String> addMapping(String... urlPatterns) {
  if (urlPatterns == null) {
    return Collections.emptySet();
  }
  Set<String> conflicts = new HashSet<>();
  for (String urlPattern : urlPatterns) {
    String wrapperName = context.findServletMapping(urlPattern);
    if (wrapperName != null) {
      Wrapper wrapper = (Wrapper) context.findChild(wrapperName);
      if (wrapper.isOverridable()) {
        // Some Wrappers (from global and host web.xml) may be
        // overridden rather than generating a conflict
        context.removeServletMapping(urlPattern);
      } else {
        conflicts.add(urlPattern);
      }
    }
  }
  if (!conflicts.isEmpty()) {
    return conflicts;
  }
  for (String urlPattern : urlPatterns) {
    context.addServletMapping(urlPattern, wrapper.getName());
  }
  return Collections.emptySet();
}

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

@Override
public Set<String> addMapping(String... urlPatterns) {
  if (urlPatterns == null) {
    return Collections.emptySet();
  }
  
  Set<String> conflicts = new HashSet<String>();
  
  for (String urlPattern : urlPatterns) {
    String wrapperName = context.findServletMapping(urlPattern);
    if (wrapperName != null) {
      Wrapper wrapper = (Wrapper) context.findChild(wrapperName);
      if (wrapper.isOverridable()) {
        // Some Wrappers (from global and host web.xml) may be
        // overridden rather than generating a conflict
        context.removeServletMapping(urlPattern);
      } else {
        conflicts.add(urlPattern);
      }
    }
  }
  if (!conflicts.isEmpty()) {
    return conflicts;
  }
  
  for (String urlPattern : urlPatterns) {
    context.addServletMapping(urlPattern, wrapper.getName());
  }
  return Collections.emptySet();
}

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

@Override
public Set<String> addMapping(String... urlPatterns) {
  if (urlPatterns == null) {
    return Collections.emptySet();
  }
  
  Set<String> conflicts = new HashSet<String>();
  
  for (String urlPattern : urlPatterns) {
    String wrapperName = context.findServletMapping(urlPattern);
    if (wrapperName != null) {
      Wrapper wrapper = (Wrapper) context.findChild(wrapperName);
      if (wrapper.isOverridable()) {
        // Some Wrappers (from global and host web.xml) may be
        // overridden rather than generating a conflict
        context.removeServletMapping(urlPattern);
      } else {
        conflicts.add(urlPattern);
      }
    }
  }
  if (!conflicts.isEmpty()) {
    return conflicts;
  }
  
  for (String urlPattern : urlPatterns) {
    context.addServletMapping(urlPattern, wrapper.getName());
  }
  return Collections.emptySet();
}

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

if (wrapperName != null) {
  Wrapper wrapper = (Wrapper) context.findChild(wrapperName);
  if (wrapper.isOverridable()) {

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

if (wrapperName != null) {
  Wrapper wrapper = (Wrapper) context.findChild(wrapperName);
  if (wrapper.isOverridable()) {

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

if (wrapper.getName() != null &&
    wrapper.getServletClass() != null) {
  if (wrapper.isOverridable()) {
    wrapper.setOverridable(false);
  } else {

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

if (wrapper.getName() != null &&
    wrapper.getServletClass() != null) {
  if (wrapper.isOverridable()) {
    wrapper.setOverridable(false);
  } else {

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

if (wrapper.getName() != null &&
    wrapper.getServletClass() != null) {
  if (wrapper.isOverridable()) {
    wrapper.setOverridable(false);
  } else {

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

if (wrapper.getName() != null &&
    wrapper.getServletClass() != null) {
  if (wrapper.isOverridable()) {
    wrapper.setOverridable(false);
  } else {

代码示例来源:origin: org.jboss.web/jbossweb

public Set<String> addMapping(String... urlPatterns) {
  Set<String> conflicts = new HashSet<String>();
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw MESSAGES.cannotAddServletRegistrationAfterInit(((Context) wrapper.getParent()).getPath());
  }
  if (urlPatterns == null || urlPatterns.length == 0) {
    throw MESSAGES.invalidServletRegistrationArguments();
  }
  for (String urlPattern : urlPatterns) {
    Context context = ((Context) wrapper.getParent());
    String wrapperName = context.findServletMapping(urlPattern);
    if (wrapperName != null) {
      Wrapper servletWrapper = (Wrapper) context.findChild(wrapperName);
      if (servletWrapper.isOverridable()) {
        // Some Wrappers (from global and host web.xml) may be
        // overridden rather than generating a conflict
        context.removeServletMapping(urlPattern);
      } else {
        conflicts.add(urlPattern);
      }
    }
  }
  if (conflicts.isEmpty()) {
    for (String urlPattern : urlPatterns) {
      ((Context) wrapper.getParent()).addServletMapping(urlPattern, wrapper.getName());
    }
  }
  return conflicts;
}

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

if (wrapper.getName() != null &&
    wrapper.getServletClass() != null) {
  if (wrapper.isOverridable()) {
    wrapper.setOverridable(false);
  } else {

代码示例来源:origin: org.jboss.web/jbossweb

if (existingWrapper.isOverridable()) {
  existingWrapper.setOverridable(false);
} else {

代码示例来源:origin: org.jboss.web/jbossweb

public ServletRegistration.Dynamic addServlet(String servletName, String className)
    throws IllegalArgumentException, IllegalStateException {
  if (restricted) {
    throw MESSAGES.restrictedListenerCannotCallMethod();
  }
  if (!context.isStarting()) {
    throw MESSAGES.contextAlreadyInitialized(getContextPath());
  }
  Wrapper existingWrapper = (Wrapper)context.findChild(servletName);
  if (existingWrapper != null) {
    if (existingWrapper.isOverridable()) {
      existingWrapper.setOverridable(false);
    } else {
      return null;
    }
  }
  Wrapper wrapper = context.createWrapper();
  wrapper.setDynamic(true);
  wrapper.setName(servletName);
  wrapper.setServletClass(className);
  context.addChild(wrapper);
  return (ServletRegistration.Dynamic) wrapper.getFacade();
}

相关文章