hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Quintin Beukes" <quin...@last.za.net>
Subject Re: utility class to create URL strings
Date Sat, 21 Jun 2008 09:20:29 GMT
Besides the parameters added to your url "lang=" and "country=" isn't a
standard. That is just options used by google. There isn't even a guarentee
that any other sites in the world support them.

Encoding is usually passed through headers,
and therefore is related to the request object.

If you want to do it like you asked though, create a URL delegate class.
Basically just a class that manages the URL and you expose methods like the
ones you mentioned.

There won't be one exactly like that anywhere, since those parameters
are google specific.

You might find one that is used by the request to automatically fill in the
headers, but that is unlikely as well, because they are unrelated, and
therefore a proper design will put them into different objects.

Q

On 6/21/08, vbossica@scdi.org <vbossica@scdi.org> wrote:
>
> All,
>
> I feel kind of stupid to ask such a simple question but I couldn't find the
> right library to do this simple job (and even asking around didn't return
> much valuable information).
>
> I would like to provide a handy way to (only) create a string URL
> definition, manage the parameters and handle the encoding.  Something like:
>
>  URLDefinition def = new URLDefinition("http://google.com");
>  def.addParameter("lang", "de");
>  def.addParameter("country", "ch");
>  String a = def.toString();
>
> and a is magically "http://google.com?lang=de&country=ch" :-)
>
> I haven't seen anything ready-to-use in the various commons libraries
> (HttpParams is the closest I could find).  Is there anything out there that
> I've been missing or should I simply roll my own version?
>
> Best regards,
>
> -Vladimir
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>


-- 
Quintin Beukes

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message