Return-Path: X-Original-To: apmail-hc-httpclient-users-archive@www.apache.org Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3F4D09AFD for ; Fri, 19 Dec 2014 13:56:23 +0000 (UTC) Received: (qmail 94397 invoked by uid 500); 19 Dec 2014 13:56:22 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 94360 invoked by uid 500); 19 Dec 2014 13:56:22 -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 93805 invoked by uid 99); 19 Dec 2014 13:56:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Dec 2014 13:56:21 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jhz.mailgroups@gmail.com designates 209.85.217.178 as permitted sender) Received: from [209.85.217.178] (HELO mail-lb0-f178.google.com) (209.85.217.178) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Dec 2014 13:55:53 +0000 Received: by mail-lb0-f178.google.com with SMTP id f15so918408lbj.23 for ; Fri, 19 Dec 2014 05:55:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=/h9VRQSw7eBk1BS1Koo/hNHBh1cnv2OvXhcAqsyi79c=; b=CaPA5LndA+y1osis0MOsbXXpSF8iW7M9/SeEj8vDNURAyqGyCO0nl65ZcbnYsLyLrb Q0zJJ9RBgxJFGQIyL/1llms2Lj2z/4C50so6PTGW5e1iKSCFQxZ/h3BujzxuHnUbp3fd F2R+3VYvKTOuzp62i7OUqCdhpjtqwUylu7DIxVEuc4RHIlOA9bT3dKAoH+33aWHjPnfE 02vFnZN64zngjyt/gQ9ljb1LZv6ctSVMXianQIV6uFNbFsv/EFgzcEeT7naeo+GId02x gLhK4VN+clIh7eEmdomtEtG+oWnnTme6WUD35Tpgd8aTv8klhHfqD8MvsAWL6jpa04px +SFQ== X-Received: by 10.112.135.197 with SMTP id pu5mr7937993lbb.22.1418997352521; Fri, 19 Dec 2014 05:55:52 -0800 (PST) Received: from [192.168.1.216] (c-89dfe555.016-20-6c6b7012.cust.bredbandsbolaget.se. [85.229.223.137]) by mx.google.com with ESMTPSA id x1sm2744039laa.20.2014.12.19.05.55.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Dec 2014 05:55:51 -0800 (PST) Message-ID: <54942E69.70709@gmail.com> Date: Fri, 19 Dec 2014 14:55:53 +0100 From: Johan Hertz User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: httpclient-users@hc.apache.org Subject: Re: How to get the parameters from HttpRequest? References: <549307DE.4090604@gmail.com> <1418996831.21015.5.camel@apache.org> In-Reply-To: <1418996831.21015.5.camel@apache.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 2014-12-19 14:47, Oleg Kalnichevski wrote: > On Thu, 2014-12-18 at 17:59 +0100, Johan Hertz wrote: >> Hi, >> >> I am creating a class that implements the interface HttpRequestHandler. >> The handle method has a parameter of type HttpRequest on which I would >> expect to find the payload/parameters sent to the server. It does have a >> getParams method but it is deprecated. The deprecated message is /"use >> configuration classes provided 'org.apache.http.config' and >> 'org.apache.http.client.config//"/. >> >> Looking at this classes I can't seem to find what I am after, anyone >> know where I should look? >> >> Regards >> Johan >> > Johan > > URIBuilder [1] and URLEncodedUtils [2] from HttpClient should do the > trick. You can use URIBuilder to manipulate request URIs and extract > request query parameters. URLEncodedUtils can be used to parse request > entity to extract form parameters. > > Hope this helps. > > Oleg > > [1] > http://hc.apache.org/httpcomponents-client-4.3.x/httpclient/apidocs/org/apache/http/client/utils/URIBuilder.html > [2] > http://hc.apache.org/httpcomponents-client-4.3.x/httpclient/apidocs/org/apache/http/client/utils/URLEncodedUtils.html > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org > For additional commands, e-mail: httpclient-users-help@hc.apache.org > Hi, Thanks for replying. I am doing this on the server side so I don't know if the solution you suggested applies? But what I found was that the request was of type HttpEntityEnclosingRequest. So I just cast to that and then get the payload data using entityRequest.getEntity() and then read the data from the input stream returned by entity.getContent(). Regards Johan --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org