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

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

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

Context.isStarting介绍

[英]Return the application starting flag for this Context.
[中]返回此上下文的应用程序启动标志。

代码示例

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

public void setAsyncSupported(boolean asyncSupported) {
  if (!context.isStarting()) {
    throw new IllegalStateException(sm.getString("filterRegistration.ise", context.getPath()));
  }
  filterDef.setAsyncSupported(asyncSupported);
  context.addFilterDef(filterDef);
}

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

public Set<String> setInitParameters(Map<String, String> initParameters) {
  if (!context.isStarting()) {
    throw new IllegalStateException(sm.getString("filterRegistration.ise", context.getPath()));
  }
  if (initParameters == null) {
    throw new IllegalArgumentException(sm.getString("filterRegistration.iae"));
  }
  Set<String> conflicts = new HashSet<String>();
  Iterator<String> parameterNames = initParameters.keySet().iterator();
  while (parameterNames.hasNext()) {
    String parameterName = parameterNames.next();
    if (filterDef.getInitParameter(parameterName) != null) {
      conflicts.add(parameterName);
    } else {
      String value = initParameters.get(parameterName);
      if (value == null) {
        throw new IllegalArgumentException(sm.getString("filterRegistration.iae"));
      }
      filterDef.addInitParameter(parameterName, value);
    }
  }
  context.addFilterDef(filterDef);
  return conflicts;
}

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

public Set<String> setInitParameters(Map<String, String> initParameters) {
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw new IllegalStateException(sm.getString
        ("servletRegistration.ise", ((Context) wrapper.getParent()).getPath()));
  }
  if (initParameters == null) {
    throw new IllegalArgumentException(sm.getString("servletRegistration.iae"));
  }
  Set<String> conflicts = new HashSet<String>();
  Iterator<String> parameterNames = initParameters.keySet().iterator();
  while (parameterNames.hasNext()) {
    String parameterName = parameterNames.next();
    if (wrapper.findInitParameter(parameterName) != null) {
      conflicts.add(parameterName);
    } else {
      String value = initParameters.get(parameterName);
      if (value == null) {
        throw new IllegalArgumentException(sm.getString("servletRegistration.iae"));
      }
      wrapper.addInitParameter(parameterName, value);
    }
  }
  return conflicts;
}

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

public void setRunAsRole(String roleName) {
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw new IllegalStateException(sm.getString
        ("servletRegistration.ise", ((Context) wrapper.getParent()).getPath()));
  }
  if (roleName == null) {
    throw new IllegalArgumentException(sm.getString("servletRegistration.iae"));
  }
  wrapper.setRunAs(roleName);
}

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

public Set<String> setServletSecurity(ServletSecurityElement servletSecurity) {
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw new IllegalStateException(sm.getString
        ("servletRegistration.ise", ((Context) wrapper.getParent()).getPath()));
  }
  if (servletSecurity == null) {
    throw new IllegalArgumentException(sm.getString("servletRegistration.iae"));
  }
  return wrapper.setServletSecurity(servletSecurity);
}

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

public void setLoadOnStartup(int loadOnStartup) {
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw new IllegalStateException(sm.getString
        ("servletRegistration.ise", ((Context) wrapper.getParent()).getPath()));
  }
  wrapper.setLoadOnStartup(loadOnStartup);
}

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

public void setAsyncSupported(boolean asyncSupported) {
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw new IllegalStateException(sm.getString
        ("servletRegistration.ise", ((Context) wrapper.getParent()).getPath()));
  }
  wrapper.setAsyncSupported(asyncSupported);
}

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

public boolean setInitParameter(String name, String value) {
  if (!context.isStarting()) {
    throw new IllegalStateException(sm.getString("filterRegistration.ise", context.getPath()));
  }
  if (name == null || value == null) {
    throw new IllegalArgumentException(sm.getString("filterRegistration.iae"));
  }
  if (filterDef.getInitParameter(name) != null) {
    return false;
  }
  filterDef.addInitParameter(name, value);
  context.addFilterDef(filterDef);
  return true;
}

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

public void setAsyncSupported(boolean asyncSupported) {
  if (!context.isStarting()) {
    throw MESSAGES.cannotAddFilterRegistrationAfterInit(context.getPath());
  }
  filterDef.setAsyncSupported(asyncSupported);
  context.addFilterDef(filterDef);
}

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

public boolean setInitParameter(String name, String value) {
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw new IllegalStateException(sm.getString
        ("servletRegistration.ise", ((Context) wrapper.getParent()).getPath()));
  }
  if (name == null || value == null) {
    throw new IllegalArgumentException(sm.getString("servletRegistration.iae"));
  }
  if (wrapper.findInitParameter(name) == null) {
    wrapper.addInitParameter(name, value);
    return true;
  } else {
    return false;
  }
}

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

public Set<String> addMapping(String... urlPatterns) {
  Set<String> conflicts = new HashSet<String>();
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw new IllegalStateException(sm.getString
        ("servletRegistration.ise", ((Context) wrapper.getParent()).getPath()));
  }
  if (urlPatterns == null || urlPatterns.length == 0) {
    throw new IllegalArgumentException(sm.getString("servletRegistration.iae"));
  }
  for (String urlPattern : urlPatterns) {
    if (((Context) wrapper.getParent()).findServletMapping(urlPattern) != null) {
      conflicts.add(urlPattern);
    }
  }
  if (conflicts.isEmpty()) {
    for (String urlPattern : urlPatterns) {
      ((Context) wrapper.getParent()).addServletMapping(urlPattern, wrapper.getName());
    }
  }
  return conflicts;
}

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

public void setLoadOnStartup(int loadOnStartup) {
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw MESSAGES.cannotAddServletRegistrationAfterInit(((Context) wrapper.getParent()).getPath());
  }
  wrapper.setLoadOnStartup(loadOnStartup);
}

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

public void setAsyncSupported(boolean asyncSupported) {
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw MESSAGES.cannotAddServletRegistrationAfterInit(((Context) wrapper.getParent()).getPath());
  }
  wrapper.setAsyncSupported(asyncSupported);
}

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

public Set<String> setServletSecurity(ServletSecurityElement servletSecurity) {
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw MESSAGES.cannotAddServletRegistrationAfterInit(((Context) wrapper.getParent()).getPath());
  }
  if (servletSecurity == null) {
    throw MESSAGES.invalidServletRegistrationArguments();
  }
  return wrapper.setServletSecurity(servletSecurity);
}

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

public void setRunAsRole(String roleName) {
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw MESSAGES.cannotAddServletRegistrationAfterInit(((Context) wrapper.getParent()).getPath());
  }
  if (roleName == null) {
    throw MESSAGES.invalidServletRegistrationArguments();
  }
  wrapper.setRunAs(roleName);
}

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

public boolean setInitParameter(String name, String value) {
  if (!context.isStarting()) {
    throw MESSAGES.cannotAddFilterRegistrationAfterInit(context.getPath());
  }
  if (name == null || value == null) {
    throw MESSAGES.invalidFilterRegistrationArguments();
  }
  if (filterDef.getInitParameter(name) != null) {
    return false;
  }
  filterDef.addInitParameter(name, value);
  context.addFilterDef(filterDef);
  return true;
}

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

public boolean setInitParameter(String name, String value) {
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw MESSAGES.cannotAddServletRegistrationAfterInit(((Context) wrapper.getParent()).getPath());
  }
  if (name == null || value == null) {
    throw MESSAGES.invalidServletRegistrationArguments();
  }
  if (wrapper.findInitParameter(name) == null) {
    wrapper.addInitParameter(name, value);
    return true;
  } else {
    return false;
  }
}

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

public boolean addMappingForUrlPatterns(
    EnumSet<DispatcherType> dispatcherTypes, boolean isMatchAfter,
    String... urlPatterns) {
  if (!context.isStarting()) {
    throw new IllegalStateException(sm.getString("filterRegistration.ise", context.getPath()));
  }
  if (urlPatterns == null || urlPatterns.length == 0) {
    throw new IllegalArgumentException(sm.getString("filterRegistration.iae"));
  }
  FilterMap filterMap = new FilterMap(); 
  for (String urlPattern : urlPatterns) {
    filterMap.addURLPattern(urlPattern);
  }
  filterMap.setFilterName(filterDef.getFilterName());
  if (dispatcherTypes != null) {
    for (DispatcherType dispatcherType: dispatcherTypes) {
      filterMap.setDispatcher(dispatcherType.name());
    }
  }
  if (isMatchAfter) {
    context.addFilterMap(filterMap);
  } else {
    context.addFilterMapBefore(filterMap);
  }
  return true;
}

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

public void setMultipartConfig(MultipartConfigElement multipartConfig) {
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw new IllegalStateException(sm.getString
        ("servletRegistration.ise", ((Context) wrapper.getParent()).getPath()));
  }
  if (multipartConfig == null) {
    throw new IllegalArgumentException(sm.getString("servletRegistration.iae"));
  }
  Multipart multipart = new Multipart();
  multipart.setLocation(multipartConfig.getLocation());
  multipart.setMaxFileSize(multipartConfig.getMaxFileSize());
  multipart.setMaxRequestSize(multipartConfig.getMaxRequestSize());
  multipart.setFileSizeThreshold(multipartConfig.getFileSizeThreshold());
  wrapper.setMultipartConfig(multipart);
}

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

public void setMultipartConfig(MultipartConfigElement multipartConfig) {
  if (!((Context) wrapper.getParent()).isStarting()) {
    throw MESSAGES.cannotAddServletRegistrationAfterInit(((Context) wrapper.getParent()).getPath());
  }
  if (multipartConfig == null) {
    throw MESSAGES.invalidServletRegistrationArguments();
  }
  Multipart multipart = new Multipart();
  multipart.setLocation(multipartConfig.getLocation());
  multipart.setMaxFileSize(multipartConfig.getMaxFileSize());
  multipart.setMaxRequestSize(multipartConfig.getMaxRequestSize());
  multipart.setFileSizeThreshold(multipartConfig.getFileSizeThreshold());
  wrapper.setMultipartConfig(multipart);
}

相关文章

微信公众号

最新文章

更多

Context类方法