static {
    // Note: Java Package versioning is useless during development when
    //       we have no JARs, whereas this technique works with non-JAR
    //       classpaths as well.
    String version = "unknown";

    try {
      URL resource = ClassLoaderUtils.getResource("META-INF/trinidad-version.txt");
      if (resource != null) {
        BufferedReader br = null;
        try {
          InputStream in = resource.openStream();
          br = new BufferedReader(new InputStreamReader(in));
          version = br.readLine();
        } catch (IOException e) {
          _LOG.severe(e);
        } finally {
          if (br != null) br.close();
        }
      }
    } catch (IOException e) {
      _LOG.severe(e);
    } finally {
      _VERSION = version;
    }
  }
  @Override
  protected URL getURL(String name) {
    if (_base == null) return ClassLoaderUtils.getResource(name);

    return _base.getResource(name);
  }
  public static RequestContextBean parseConfigFile(ExternalContext externalContext) {
    RequestContextBean bean = new RequestContextBean();

    InputStream in = externalContext.getResourceAsStream(_CONFIG_FILE);
    if (in != null) {
      try {
        InputSource input = new InputSource();
        input.setByteStream(in);
        input.setPublicId(_CONFIG_FILE);

        XMLReader reader = _SAX_PARSER_FACTORY.newSAXParser().getXMLReader();

        reader.setContentHandler(new Handler(bean, externalContext));
        reader.parse(input);
      } catch (IOException ioe) {
        _LOG.warning(ioe);
      } catch (ParserConfigurationException pce) {
        _LOG.warning(pce);
      } catch (SAXException saxe) {
        _LOG.warning(saxe);
      } finally {
        try {
          in.close();
        } catch (IOException ioe) {
          // Ignore
          ;
        }
      }
    }

    String classNameString =
        (String) bean.getProperty(RequestContextBean.UPLOADED_FILE_PROCESSOR_KEY);
    if (classNameString != null) {
      classNameString = classNameString.trim();

      // check if this contains multiple class names for chained processors usecase.
      // Usually the class named are separated by space char.
      String classNames[] = classNameString.split("[ ]+");
      if (classNames.length == 1) {
        // This could be a single processor full override usecase or a chained
        // processor usecase that has only one processor.
        try {
          Class<UploadedFileProcessor> clazz =
              (Class<UploadedFileProcessor>) ClassLoaderUtils.loadClass(classNames[0]);
          if (ChainedUploadedFileProcessor.class.isAssignableFrom(clazz)) {
            // this single chained processor case
            ChainedUploadedFileProcessor cufp[] = {
              (ChainedUploadedFileProcessor) clazz.newInstance()
            };
            bean.setProperty(
                RequestContextBean.UPLOADED_FILE_PROCESSOR_KEY,
                new CompositeUploadedFileProcessorImpl(Arrays.asList(cufp)));
          } else {
            // this is full override usecase
            bean.setProperty(RequestContextBean.UPLOADED_FILE_PROCESSOR_KEY, clazz.newInstance());
          }

        } catch (Exception e) {
          _LOG.severe("CANNOT_INSTANTIATE_UPLOADEDFILEPROCESSOR", e);
          bean.setProperty(
              RequestContextBean.UPLOADED_FILE_PROCESSOR_KEY,
              new CompositeUploadedFileProcessorImpl());
        }
      } else {
        try {
          // chained processors usecase, Multiple processors
          List<ChainedUploadedFileProcessor> processors =
              new ArrayList<ChainedUploadedFileProcessor>(classNames.length);
          for (String className : classNames) {
            Class<ChainedUploadedFileProcessor> clazz =
                (Class<ChainedUploadedFileProcessor>) ClassLoaderUtils.loadClass(className);
            processors.add(clazz.newInstance());
          }
          bean.setProperty(
              RequestContextBean.UPLOADED_FILE_PROCESSOR_KEY,
              new CompositeUploadedFileProcessorImpl(processors));
        } catch (Exception e) {
          _LOG.severe("CANNOT_INSTANTIATE_UPLOADEDFILEPROCESSOR", e);
          bean.setProperty(
              RequestContextBean.UPLOADED_FILE_PROCESSOR_KEY,
              new CompositeUploadedFileProcessorImpl());
        }
      }
    } else {
      // nothing specified, hence use default.
      bean.setProperty(
          RequestContextBean.UPLOADED_FILE_PROCESSOR_KEY, new CompositeUploadedFileProcessorImpl());
    }

    UploadedFileProcessor ufp =
        (UploadedFileProcessor) bean.getProperty(RequestContextBean.UPLOADED_FILE_PROCESSOR_KEY);

    ufp.init(externalContext.getContext());

    if (_LOG.isInfo()) {
      Object debug = bean.getProperty(RequestContextBean.DEBUG_OUTPUT_KEY);
      if (Boolean.TRUE.equals(debug)) _LOG.info("RUNNING_IN_DEBUG_MODE", _CONFIG_FILE);
    }
    return bean;
  }