I think there's a method on uri that gives you this.