Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 63962 invoked from network); 21 Jun 2008 09:20:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Jun 2008 09:20:59 -0000 Received: (qmail 59041 invoked by uid 500); 21 Jun 2008 09:20:59 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 59004 invoked by uid 500); 21 Jun 2008 09:20:59 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 58993 invoked by uid 99); 21 Jun 2008 09:20:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Jun 2008 02:20:59 -0700 X-ASF-Spam-Status: No, hits=3.2 required=10.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.200.174] (HELO wf-out-1314.google.com) (209.85.200.174) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Jun 2008 09:20:10 +0000 Received: by wf-out-1314.google.com with SMTP id 23so1528930wfg.10 for ; Sat, 21 Jun 2008 02:20:29 -0700 (PDT) Received: by 10.143.42.3 with SMTP id u3mr2148814wfj.148.1214040029340; Sat, 21 Jun 2008 02:20:29 -0700 (PDT) Received: by 10.142.131.13 with HTTP; Sat, 21 Jun 2008 02:20:29 -0700 (PDT) Message-ID: <1f3854d50806210220l77e62a1av99176eabdf237f2c@mail.gmail.com> Date: Sat, 21 Jun 2008 11:20:29 +0200 From: "Quintin Beukes" Sender: quintin@skywalk.co.za To: "HttpClient User Discussion" Subject: Re: utility class to create URL strings In-Reply-To: <20080621010140.37tc2osy6sys0g4w@mail.scdi.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_9278_29802172.1214040029333" References: <20080621010140.37tc2osy6sys0g4w@mail.scdi.org> X-Google-Sender-Auth: 4f5570f281cb9d66 X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_9278_29802172.1214040029333 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 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 ------=_Part_9278_29802172.1214040029333--