Author: lindner
Date: Fri Mar 27 18:41:12 2009
New Revision: 759300
URL: http://svn.apache.org/viewvc?rev=759300&view=rev
Log:
fix the build for now..
Modified:
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/uri/Uri.java
Modified:
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/uri/Uri.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/uri/Uri.java?rev=759300&r1=759299&r2=759300&view=diff
==============================================================================
---
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/uri/Uri.java
(original)
+++
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/uri/Uri.java
Fri Mar 27 18:41:12 2009
@@ -20,6 +20,7 @@
import com.google.common.base.Join;
import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import com.google.inject.Inject;
@@ -127,10 +128,16 @@
* @return The new url.
*/
public Uri resolve(Uri other) {
+ // return this.resolveNew(other);
+ return fromJavaUri(toJavaUri().resolve(other.toJavaUri()));
+ }
+
+ public Uri resolveNew(Uri other) {
if (other == null) {
return null;
}
+
String scheme = other.getScheme();
String authority = other.getAuthority();
String path = other.getPath();
@@ -179,11 +186,13 @@
// Optimization: just accept other.
return otherPath;
}
+
// Relative path. Treat current path as a stack, otherPath as a List
// in order to merge.
LinkedList<String> pathStack = new LinkedList<String>();
String curPath = getPath() != null ? getPath() : "/"; // Just in case.
StringTokenizer tok = new StringTokenizer(curPath, "/");
+
while (tok.hasMoreTokens()) {
pathStack.add(tok.nextToken());
}
@@ -219,7 +228,10 @@
}
}
- return "/" + Join.join("/", pathStack);
+ if (getAuthority() != null) {
+ pathStack.addFirst(""); // get an initial / on the front..
+ }
+ return Join.join("/", pathStack);
}
/**