A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
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 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
I agree. Here's the link:
subject: Setting content-type in HTTPURLConnection ?
HTTPUrlConnection only works with Debugger-without I'm to fast??!!
DELETE http request in HttpURLConnection....
FileNotFoundException Response 500
Some of you are experts this could be your next problem!
sending PUT,DELETE requests to HttpServlet (urgent)
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015