Hello!
Create ConnectionRequest to any url.
Windows Phone emulator ( http://www.microsoft.com/en-us/download/details.aspx?id=27570 ) does not work. Request fails with following exception
System.ArgumentException: This header must be modified with the appropriate property. at
System.Net.WebHeaderCollection.ThrowOnRestrictedHeader(String name, String value) at
System.Net.WebHeaderCollection.set_Item(String name, String value) at
com.codename1.impl.SilverlightImplementation.setHeader(Object n1, String n2, String n3) at
com.codename1.io.ConnectionRequest.initConnection(Object n1) at
com.codename1.io.ConnectionRequest.performOperation() at
com.codename1.io.NetworkManager_2NetworkThread.run()
See Restricted headers http://msdn.microsoft.com/en-us/library/system.net.webheadercollection%28v=vs.95%29.aspx
I'm not using any headers.
But ConnectionRequest is
protected void initConnection(Object connection) {
timeSinceLastUpdate = System.currentTimeMillis();
CodenameOneImplementation impl = Util.getImplementation();
impl.setPostRequest(connection, isPost());
if(getUserAgent() != null) {
impl.setHeader(connection, "User-Agent", getUserAgent());
}
if(getContentType() != null) {
impl.setHeader(connection, "Content-Type", getContentType());
}
if(userHeaders != null) {
Enumeration e = userHeaders.keys();
while(e.hasMoreElements()) {
String k = (String)e.nextElement();
String value = (String)userHeaders.get(k);
impl.setHeader(connection, k, value);
}
}
}
private String contentType = "application/x-www-form-urlencoded; charset=UTF-8";
private String userAgent = getDefaultUserAgent();