On Mon, 2009-02-02 at 20:47 +0100, Ortwin Glück wrote: > Patrick, > > That's not really a standard for a response. So naturally we have no such > parser. It's however easy to parse: > > 1. split by the & character using StringTokenizer > 2. split each pair by the = character using String.indexOf > 3. decode each name and value with URIDecoder > > Cheers, > > Ortwin > > > Patrick JUSSEAU wrote: > > Thanks Ortwin for the pointers, I see clearly now. I am able to send my > > post request and get a response back from the https server. I was > > however wondering if there is a utility class that parses the HttpEntity > > response content in order to get key value pairs (the content of the > > response entity is key1=value1&key2=value2&...) ? > > > > Something that would look like : > > > > HttpEntity resEntity = response.getEntity(); > > List<NameValuePair> nvps = SomeUtilityClass.getNameValuePairs(); > > > > If such a class does not exist does it mean I need to parse it myself? > >
Actually, there is a method like that in the o.a.http.client.utils.URLEncodedUtils class. Oleg > > > Thanks, > > > > Patrick > > > > On 2 févr. 09, at 18:16, Ortwin Glück wrote: > > > >> Patrick, > >> > >> Please see http://hc.apache.org/httpcomponents-client/examples.html > >> There is examples for all your questions: > >> > >> 1. see Custom SSL context, see SSLSocketFactory > >> 2. see Form based logon, see UrlEncodedFormEntity > >> 3. Response handling, see HttpResponse, see ResponseHandler and > >> HttpClient.execute(HttpUriRequest, ResponseHandler) > >> > >> Also visit the API Doc: > >> http://hc.apache.org/httpcomponents-client/httpclient/apidocs/index.html > >> > >> Cheers, > >> > >> Ortwin > >> > >> Patrick JUSSEAU wrote: > >>> Hi all, > >>> > >>> I am pretty new to the http components world but I need to use it for a > >>> simple case I need to deal with. What I need to do is : > >>> > >>> > >>> 1 - send a request using https to a remote server with a POST method > >>> 2- pass parameters to this request (key/value pairs) > >>> 3 - get a response back and read the response parameters > >>> > >>> I tried to read through the examples but I can't find an easy way to do > >>> this, I feel a little bit lost in the API. Could anyone point me to the > >>> right direction? > >>> > >>> Many thanks!! > >>> > >>> > >>> Patrick > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: [email protected] > >>> For additional commands, e-mail: [email protected] > >>> > >> > >> -- > >> [web] http://www.odi.ch/ > >> [blog] http://www.odi.ch/weblog/ > >> [pgp] key 0x81CF3416 > >> finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5 81CF 3416 > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
