You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Brian Eaton <be...@google.com> on 2008/03/25 19:24:09 UTC
URL manipulation library
I'm getting tired of writing str.indexOf("?") == -1. Does anyone know
of a good library for parsing and modifying URLs, something with a
compatible license?
Re: URL manipulation library
Posted by Brian Eaton <be...@google.com>.
On Tue, Mar 25, 2008 at 11:57 AM, Kevin Brown <et...@google.com> wrote:
> I don't know of one myself, but for this trivial example why don't you just
> use the URI class?
Because it creates immutable objects. I want something that can add
query parameters, etc...
> I'm all for writing a url builder / extractor to get at individual query
> parameters if there isn't a decent one we can borrow from elsewhere though.
+1.
Re: URL manipulation library
Posted by Kevin Brown <et...@google.com>.
On Tue, Mar 25, 2008 at 11:24 AM, Brian Eaton <be...@google.com> wrote:
> I'm getting tired of writing str.indexOf("?") == -1. Does anyone know
> of a good library for parsing and modifying URLs, something with a
> compatible license?
I don't know of one myself, but for this trivial example why don't you just
use the URI class?
URI uri = URI.create("http://opensocial.org/request?foo=bar&bar=baz#blah");
String scheme = uri.getScheme(); // "http"
String host = uri.getAuthority(); // "opensocial.org"
String path = uri.getPath(); // "/request"
String query = uri.getQuery(); // "foo=bar&bar=baz"
String fragment = uri.getFragment(); // "blah"
I'm all for writing a url builder / extractor to get at individual query
parameters if there isn't a decent one we can borrow from elsewhere though.
--
~Kevin
Re: URL manipulation library
Posted by James M Snell <ja...@gmail.com>.
Abdera includes an IRI implementation that may work out. We're getting
ready to release the 0.4.0 version. Just grab the i18n jar.
- James
Brian Eaton wrote:
> I'm getting tired of writing str.indexOf("?") == -1. Does anyone know
> of a good library for parsing and modifying URLs, something with a
> compatible license?
>