You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Sachin Mehrotra <sm...@tibco.com> on 2007/08/03 15:19:14 UTC

How to get parmeters from http request

Hi,

I am not able to figure out how I will get the httprequest parameters on
the Http server side using http-core API. 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?  

 

Thanks,

Sachin

 


Re: How to get parmeters from http request

Posted by Oleg Kalnichevski <ol...@apache.org>.
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