|ProtocolException while HTTP POST||Amit||9/8/10 5:15 AM|
I am trying to do HTTP Post through HttpURLConnection. But in the
OutputStream output = httpCon.getOutputStream();
I am getting exception-
problem in connection - java.net.ProtocolException: Does not support
output URL - my url
What may be the reason? Kindly help.
|Re: ProtocolException while HTTP POST||Indicator Veritatis||9/8/10 11:13 AM|
Well, the obvious reason is that the URL you gave it has something
wrong in it. But you didn't tell us the URL, so we can only guess.
|Re: ProtocolException while HTTP POST||Jason||9/8/10 11:41 PM|
Usually this means the protocol portion of the URL is not valid.
So for example in "http://www.google.com", the protocol is HTTP. As
Veritatis says, your URL is probably invalid.
If it's indeed an HTTP url, make your you prefix it the http:// or https://
as it may barf if you try just www.google.com (dunno about this.. may
still work and just assume http), or if you try a non HTTP url using
|Re: ProtocolException while HTTP POST||Amit||9/25/10 7:06 AM|
Finally the problem got solved. Just needed to call an API on the
HttpConnection object - setDoOutput(true).
> as it may barf if you try justwww.google.com(dunno about this.. may