hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: httpcore post parameter
Date Tue, 18 Dec 2007 14:47:09 GMT

On Tue, 2007-12-18 at 15:25 +0100, Matthijs Bierman wrote:
> Hi Roland,
> 
> Appearantly it adds the functionality I need. I had not realized
> parameters (which seem pretty basic, or "core" to me) would not be in
> the HttpCore package.

Matthijs

URL coding would require dependency on Commons Codec and we wanted to
avoid _any_ external dependencies for core components. 

Feel free to use Commons Codec directly to encode request parameters or
just 'borrow' this class from HttpClient:

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

> What if I wanted to add the parameter manually? Do I simply add a
> StringEntity("name=value")? This did not seem to work with the sample
> code. 

This certainly should work. 

> Or do I have to do all the work (e.g. create boundary, set content
> type etc.)? In that case I am probably better of building a "simple"
> URLConnection.
> 

Always use the best tool for the job. If URLConnection works for you,
there is no reason to use an external library.

Hope this helps

Oleg 


> Thanks,
> Matthijs
> 
> Roland Weber wrote: 
> > Matthijs Bierman wrote:
> >   
> > > Hi there,
> > > 
> > > I have a very simple question, but can't seem to figure it out.
> > > How do I add a POST parameter using HttpCore?
> > >     
> > 
> > You don't. Core is hardcore. It doesn't provide all the fancy
> > stuff like parameter encoding, cookie handling, authentication,
> > or connection management that client comes with.
> > 
> >   
> > > I would prefer using HttpCore over HttpClient as it is a lot smaller and
> > > has to be included in an applet. Therefore the 140kB makes quite a
> > > difference to me.
> > >     
> > 
> > Those 140kB are not redundant. They add functionality ;-)
> > 
> > cheers,
> >   Roland
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > 
> > 
> > 
> >   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For
> additional commands, e-mail: httpclient-users-help@hc.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message