A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java 8 in Action
this week in the
Sockets and Internet Protocols
Setting content-type in HTTPURLConnection ?
Joined: Aug 03, 2002
Apr 30, 2010 12:14:56
I was adding this method in my client code:
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
When i try to call the following method : it does retrieve "
" What can be the possible reason for this or i am doing something wrong for setting the content type.
Any clues ?
Joined: Oct 27, 2005
Apr 30, 2010 13:37:12
connection.getContentType() returns the Content-Type as returned by the server.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions
How To Answer Questions
I agree. Here's the link:
subject: Setting content-type in HTTPURLConnection ?
sending PUT,DELETE requests to HttpServlet (urgent)
Some of you are experts this could be your next problem!
FileNotFoundException Response 500
DELETE http request in HttpURLConnection....
HTTPUrlConnection only works with Debugger-without I'm to fast??!!
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014