hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: How to get parmeters from http request
Date Fri, 03 Aug 2007 13:47:42 GMT
On Fri, 2007-08-03 at 06:19 -0700, Sachin Mehrotra wrote:
> Hi,
> 
> I am not able to figure out how I will get the httprequest parameters on
> the Http server side using http-core API. 

Hi Sachin,

The philosophy of HttpCore is that it provides, well, only core
functionality: a transport to deliver HTTP messages from one endpoint to
another. Everything that has to do with application specific content
should be provided externally. 

> Do I have to retrieve them
> from the input stream which I get from the Entity object by writing my
> own logic or is there some API there in HTTP-Core?  
> 
>  

Yes, you do. HttpClient has an HttpEntity implementation intended to
generate URL encoded form content [1]. What you have to do is to
implement an HttpEntity wrapper that performs the reverse operation:
reads the content from the InputStream, parses it into an array of
name / value pairs, and finally URL decodes the values.

Since requests about HTTP parameter parsing started to come up with a
depressing regularity, I'll try to find time to implement
UrlDecodedFormEntity but cannot commit myself to any time line for that.

Hope this helps in some way.

Cheers

Oleg


[1]
http://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/methods/UrlEncodedFormEntity.java


> 
> Thanks,
> 
> Sachin
> 
>  
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message