@Test
 public void versions() {
   ServletContext context = new ServletContext1(new MockWebContext());
   assertEquals(3, context.getMajorVersion());
   assertEquals(0, context.getMinorVersion());
   assertEquals(3, context.getEffectiveMajorVersion());
   assertEquals(0, context.getEffectiveMinorVersion());
 }
 @Override
 public int getEffectiveMajorVersion() {
   return proxy.getEffectiveMajorVersion();
 }
  private void processWebDotXml() {

    // Very, very unlikely but just in case...
    if (ctxt.getEffectiveMajorVersion() < 2) {
      defaultIsELIgnored = "true";
      defaultDeferedSyntaxAllowedAsLiteral = "true";
      return;
    }
    if (ctxt.getEffectiveMajorVersion() == 2) {
      if (ctxt.getEffectiveMinorVersion() < 5) {
        defaultDeferedSyntaxAllowedAsLiteral = "true";
      }
      if (ctxt.getEffectiveMinorVersion() < 4) {
        defaultIsELIgnored = "true";
        return;
      }
    }

    JspConfigDescriptor jspConfig = ctxt.getJspConfigDescriptor();

    if (jspConfig == null) {
      return;
    }

    jspProperties = new Vector<>();
    Collection<JspPropertyGroupDescriptor> jspPropertyGroups = jspConfig.getJspPropertyGroups();

    for (JspPropertyGroupDescriptor jspPropertyGroup : jspPropertyGroups) {

      Collection<String> urlPatterns = jspPropertyGroup.getUrlPatterns();

      if (urlPatterns.size() == 0) {
        continue;
      }

      JspProperty property =
          new JspProperty(
              jspPropertyGroup.getIsXml(),
              jspPropertyGroup.getElIgnored(),
              jspPropertyGroup.getScriptingInvalid(),
              jspPropertyGroup.getPageEncoding(),
              jspPropertyGroup.getIncludePreludes(),
              jspPropertyGroup.getIncludeCodas(),
              jspPropertyGroup.getDeferredSyntaxAllowedAsLiteral(),
              jspPropertyGroup.getTrimDirectiveWhitespaces(),
              jspPropertyGroup.getDefaultContentType(),
              jspPropertyGroup.getBuffer(),
              jspPropertyGroup.getErrorOnUndeclaredNamespace());

      // Add one JspPropertyGroup for each URL Pattern.  This makes
      // the matching logic easier.
      for (String urlPattern : urlPatterns) {
        String path = null;
        String extension = null;

        if (urlPattern.indexOf('*') < 0) {
          // Exact match
          path = urlPattern;
        } else {
          int i = urlPattern.lastIndexOf('/');
          String file;
          if (i >= 0) {
            path = urlPattern.substring(0, i + 1);
            file = urlPattern.substring(i + 1);
          } else {
            file = urlPattern;
          }

          // pattern must be "*", or of the form "*.jsp"
          if (file.equals("*")) {
            extension = "*";
          } else if (file.startsWith("*.")) {
            extension = file.substring(file.indexOf('.') + 1);
          }

          // The url patterns are reconstructed as the following:
          // path != null, extension == null:  / or /foo/bar.ext
          // path == null, extension != null:  *.ext
          // path != null, extension == "*":   /foo/*
          boolean isStar = "*".equals(extension);
          if ((path == null && (extension == null || isStar)) || (path != null && !isStar)) {
            if (log.isWarnEnabled()) {
              log.warn(
                  Localizer.getMessage("jsp.warning.bad.urlpattern.propertygroup", urlPattern));
            }
            continue;
          }
        }

        JspPropertyGroup propertyGroup = new JspPropertyGroup(path, extension, property);

        jspProperties.addElement(propertyGroup);
      }
    }
  }
 public int getEffectiveMajorVersion() {
   return servletContext.getEffectiveMajorVersion();
 }