Content-Type URLConnection

I need to set my content type to be XML. I used the following:

HttpURLConnection urlConn = null;

URL u = new URL( url );

urlConn = (HttpURLConnection)u.openConnection();

urlConn.setDoOutput( true );

urlConn.setDoInput( true );

urlConn.setRequestMethod("POST");

urlConn.setRequestProperty("Content-Type","text/xml");

Why then does urlConn.getContentType() return text/html;charset=ISO-8859-1?

Liz

[456 byte] By [Lizziea] at [2007-11-27 9:48:25]
# 1

Hi Liz,

a call of getContentType() receives data from the net and returns the content type of the fetched data.

"http://www.tutego.com/index.html" -> text/html

"http://www.tutego.com/images/customer-transition.gif" -> image/gif

Best wishes,

Christian Ullenboom | http://www.tutego.com/

Christian.Ullenbooma at 2007-7-13 0:16:51 > top of Java-index,Core,Core APIs...