[Yanel-commits] rev 59485 - public/yanel/trunk/src/core/java/org/wyona/yanel/core

michi at wyona.com michi at wyona.com
Wed Jul 20 14:55:44 CEST 2011


Author: michi
Date: 2011-07-20 14:55:44 +0200 (Wed, 20 Jul 2011)
New Revision: 59485

Modified:
   public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfigurationMapV2.java
Log:
check for query strings to match

Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfigurationMapV2.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfigurationMapV2.java	2011-07-20 12:48:20 UTC (rev 59484)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/ResourceConfigurationMapV2.java	2011-07-20 12:55:44 UTC (rev 59485)
@@ -50,7 +50,7 @@
      * @return String which contains the path of a rc file
      */
     public static String getRCPath(Realm realm, String path, String queryString) {
-        log.warn("DEBUG: Try to get resource configuration for request: " + path);
+        //log.debug("Try to get resource configuration for request: " + path + ", " + queryString);
 
         InputStream rcMapIS = getRCMap(realm);
         if (rcMapIS == null) {
@@ -70,13 +70,20 @@
                 if (event == XMLStreamConstants.START_ELEMENT) {
                     if (parser.getLocalName().equals("matcher")) {
                         String pattern = parser.getAttributeValue("", "pattern");
-                        if (WildcardMatcherHelper.match(pattern, path) != null) {
+         
+                        String pathToMatch = path;
+                        if (queryString != null && pattern.indexOf("?") >= 0) {
+                            log.warn("DEBUG: Also check/match query string: " + pattern + ", " + queryString);
+                            pathToMatch = path + "?" + queryString;
+                        }
+                        if (WildcardMatcherHelper.match(pattern, pathToMatch) != null) {
                             if (log.isDebugEnabled()) {
-                                log.debug("CoR pattern: '" + pattern + "' matched with path: '" + path + "'. will use following path in the RTIRepository to reach the rc: " + parser.getAttributeValue("", "rcpath"));
+                                log.debug("CoR pattern: '" + pattern + "' matched with path: '" + pathToMatch + "'. will use following path in the RTIRepository to reach the rc: " + parser.getAttributeValue("", "rcpath"));
                             }
-                            log.warn("DEBUG: CoR pattern: '" + pattern + "' matched with path: '" + path + "'. will use following path in the RTIRepository to reach the rc: " + parser.getAttributeValue("", "rcpath"));
                             return parser.getAttributeValue("", "rcpath");
                         }
+                    } else {
+                        //log.debug("No matcher element '" + parser.getLocalName() + "', hence ignore.");
                     }
                 }
             }



More information about the Yanel-commits mailing list