ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jone...@apache.org
Subject svn commit: r644149 - in /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util: UtilHttp.java UtilProperties.java
Date Thu, 03 Apr 2008 03:34:17 GMT
Author: jonesde
Date: Wed Apr  2 20:34:14 2008
New Revision: 644149

URL: http://svn.apache.org/viewvc?rev=644149&view=rev
Log:
Added some utility methods to parse partial URL strings common in OFBiz links, especially
in the widgets

Modified:
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java?rev=644149&r1=644148&r2=644149&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilHttp.java Wed Apr  2 20:34:14
2008
@@ -673,6 +673,33 @@
         }
         return buf.toString();
     }
+    
+    public static String getRequestUriFromTarget(String target) {
+        int endOfRequestUri = target.length();
+        if (target.indexOf('?') > 0) {
+            endOfRequestUri = target.indexOf('?');
+        }
+        int slashBeforeRequestUri = target.lastIndexOf('/', endOfRequestUri);
+        String requestUri = null;
+        if (slashBeforeRequestUri < 0) {
+            requestUri = target.substring(0, endOfRequestUri);
+        } else {
+            requestUri = target.substring(slashBeforeRequestUri, endOfRequestUri);
+        }
+        return requestUri;
+    }
+
+    public static String getWebappMountPointFromTarget(String target) {
+        int firstChar = 0;
+        if (target.charAt(0) == '/') firstChar = 1;
+        int pathSep = target.indexOf('/', 1);
+        String webappMountPoint = null;
+        if (pathSep > 0) {
+            // if not then no good, supposed to be a inter-app, but there is no path sep!
will do general search with null and treat like an intra-app
+            webappMountPoint = target.substring(firstChar, pathSep);
+        }
+        return webappMountPoint;
+    }
 
     public static String encodeAmpersands(String htmlString) {
         StringBuilder htmlBuffer = new StringBuilder(htmlString);

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java?rev=644149&r1=644148&r2=644149&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java Wed Apr  2
20:34:14 2008
@@ -383,9 +383,9 @@
 
         String value = null;
         try {
-            value = (String)bundle.getString(name);
+            value = (String) bundle.getString(name);
         } catch (Exception e) {
-            Debug.log(e.getMessage(), module);
+            //Debug.log(e.getMessage(), module);
         }
         return value == null ? "" : value.trim();
     }



Mime
View raw message