I don't know Java libraries, but it seems unlikely that you should be 
using setRequestProperty() for both User-Agent (an HTTP header) and uri 
(a form parameter).

POST's are supposed to put their parameters in the payload (like your 
web browser does) by spec.

Take a look at how they encode and attach the form payload on these 
examples:
http://www.javaworld.com/javaworld/javatips/jw-javatip34.html
http://developers.sun.com/mobility/midp/ttips/HTTPPost/

Cheers,
Martin

Benjamin Good wrote:
> Usually adding the parameters into the URL works .. why would it not in 
> this case?
> 
> I get the same error (400) if I set the params in the code
> 
> URL connoU = new URL("http://www.connotea.org/data/add";);
> 
> 
> HttpURLConnection conno = (HttpURLConnection) connoU.openConnection();
> conno.setRequestProperty("User-Agent", "WWW::Connotea");
> conno.setRequestProperty("uri", URLEncoder.encode(uri,"UTF-8"));
> conno.setRequestProperty("tag", URLEncoder.encode(tag,"UTF-8"));
> conno.setRequestMethod("POST");
> 
> I've been digging for some else that has this running in Java, but the 
> only one I could find (from Pierre Lindenbaum) didn't use the web api - 
> it emulated a user session by storing and sending cookies for 
> authentication and sending requests including button clicks.  (His 
> ConnoteaClient program - but it doesn't seem to be work ing anymore).
> 
> -Ben


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Connotea-code-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/connotea-code-devel

Reply via email to