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

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

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

Wrapper.setDynamic介绍

[英]Set a flag that indicates if the wrapper was added programmatically.
[中]设置一个标志,指示包装器是否以编程方式添加。

代码示例

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

public ServletRegistration.Dynamic addServlet(String servletName, String className)
    throws IllegalArgumentException, IllegalStateException {
  if (restricted) {
    throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
  }
  if (!context.isStarting()) {
    throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
            getContextPath()));
  }
  if (context.findChild(servletName) != null) {
    return null;
  }
  Wrapper wrapper = context.createWrapper();
  wrapper.setDynamic(true);
  wrapper.setName(servletName);
  wrapper.setServletClass(className);
  context.addChild(wrapper);
  return (ServletRegistration.Dynamic) wrapper.getFacade();
}

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

public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet) {
  if (restricted) {
    throw new UnsupportedOperationException(sm.getString("applicationContext.restricted"));
  }
  if (!context.isStarting()) {
    throw new IllegalStateException(sm.getString("applicationContext.alreadyInitialized",
            getContextPath()));
  }
  if (context.findChild(servletName) != null) {
    return null;
  }
  // Servlet instance unicity
  for (Container container : context.getParent().findChildren()) {
    for (Container wrapper : container.findChildren()) {
      if (((Wrapper) wrapper).getServlet() == servlet) {
        return null;
      }
    }
  }
  Wrapper wrapper = context.createWrapper();
  wrapper.setDynamic(true);
  wrapper.setName(servletName);
  wrapper.setServletClass(servlet.getClass().getName());
  wrapper.setServlet(servlet);
  context.addChild(wrapper);
  return (ServletRegistration.Dynamic) wrapper.getFacade();
}

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

wrapper.setDynamic(true);
wrapper.setName(servletName);
wrapper.setServletClass(servlet.getClass().getName());

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

相关文章