Package com.thetransactioncompany.util

Examples of com.thetransactioncompany.util.PropertyParseException


          try {
            allowedOrigins.add(new Origin(url).validate());

                                  } catch (OriginException e) {
         
                                          throw new PropertyParseException("Bad origin URL in property cors.allowOrigin: " + url);
                                  }
        }
      }
     
      // Parse the allow origin suffix matching option
      allowSubdomains = pr.getOptBoolean("cors.allowSubdomains", false);
     

      // Parse the supported methods list

      String methodSpec = pr.getOptString("cors.supportedMethods", "GET, POST, HEAD, OPTIONS").trim().toUpperCase();

      String[] methodNames = parseWords(methodSpec);

      supportedMethods = new HashSet<HTTPMethod>();

      for (String methodName: methodNames) {

        try {
          supportedMethods.add(HTTPMethod.valueOf(methodName));

        } catch (IllegalArgumentException e) {
          throw new PropertyParseException("Bad HTTP method name in property cors.allowMethods: " + methodName);
        }
      }
     

      // Parse the supported headers list
      String headerSpec;

      // Empty value has special meaning of "no supported headers"
      try {
        headerSpec = pr.getString("cors.supportedHeaders");

      } catch (PropertyParseException e) {

        headerSpec = "*";
      }

      if (headerSpec.equals("*")) {

        supportAnyHeader = true;
        supportedHeaders = Collections.unmodifiableSet(new HashSet<HeaderFieldName>());

      } else {

        supportAnyHeader = false;

        String[] headers = parseWords(headerSpec);

        supportedHeaders = new HashSet<HeaderFieldName>();

        for (String header: headers) {

          try {
            supportedHeaders.add(new HeaderFieldName(header));

          } catch (IllegalArgumentException e) {

            throw new PropertyParseException("Bad header field name in property cors.supportedHeaders: " + header);
          }
        }
      }


      // Parse the exposed headers list
      exposedHeaders = new HashSet<HeaderFieldName>();

      for (String header: parseWords(pr.getOptString("cors.exposedHeaders", ""))) {

        try {
          exposedHeaders.add(new HeaderFieldName(header));

        } catch (IllegalArgumentException e) {
          throw new PropertyParseException("Bad header field name in property cors.exposedHeaders: " + header);
        }
      }


      // Parse the allow credentials option
View Full Code Here


          try {
            allowedOrigins.add(new Origin(url).validate());

                                  } catch (OriginException e) {
         
                                          throw new PropertyParseException("Bad origin URL in property cors.allowOrigin: " + url);
                                  }
        }
      }
     
      // Parse the allow origin suffix matching option
      allowSubdomains = pr.getOptBoolean("cors.allowSubdomains", false);
     

      // Parse the supported methods list

      String methodSpec = pr.getOptString("cors.supportedMethods", "GET, POST, HEAD, OPTIONS").trim().toUpperCase();

      supportedMethods = new HashSet<String>();

      for (String methodName: parseWords(methodSpec)) {

        supportedMethods.add(methodName);
      }
     

      // Parse the supported headers list
      String headerSpec;

      // Empty value has special meaning of "no supported headers"
      try {
        headerSpec = pr.getString("cors.supportedHeaders");

      } catch (PropertyParseException e) {

        headerSpec = "*";
      }

      if (headerSpec.equals("*")) {

        supportAnyHeader = true;
        supportedHeaders = Collections.unmodifiableSet(new HashSet<String>());

      } else {

        supportAnyHeader = false;

        String[] headers = parseWords(headerSpec);

        supportedHeaders = new HashSet<String>();

        for (String header: headers) {

          try {
            supportedHeaders.add(HeaderName.formatCanonical(header));

          } catch (IllegalArgumentException e) {

            throw new PropertyParseException("Bad header field name in property cors.supportedHeaders: " + header);
          }
        }
      }


      // Parse the exposed headers list
      exposedHeaders = new HashSet<String>();

      for (String header: parseWords(pr.getOptString("cors.exposedHeaders", ""))) {

        try {
          exposedHeaders.add(HeaderName.formatCanonical(header));

        } catch (IllegalArgumentException e) {
          throw new PropertyParseException("Bad header field name in property cors.exposedHeaders: " + header);
        }
      }


      // Parse the allow credentials option
View Full Code Here

TOP

Related Classes of com.thetransactioncompany.util.PropertyParseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.