Windows Phone ConnectionRequest does not work

33 views
Skip to first unread message

maxim...@gmail.com

unread,
Jul 29, 2013, 1:13:48 AM7/29/13
to codenameone...@googlegroups.com
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();

Shai Almog

unread,
Jul 29, 2013, 12:33:45 PM7/29/13
to codenameone...@googlegroups.com, maxim...@gmail.com
Hi,
I'm guessing you are targeting the Windows Phone 7 port which has quite a few problems. The Windows Phone 8 port should work better.

maxim...@gmail.com

unread,
Jul 30, 2013, 1:05:15 PM7/30/13
to codenameone...@googlegroups.com, maxim...@gmail.com
Yes, I'm using WP7.
Is it supported and bug will be fixed?

Shai Almog

unread,
Jul 30, 2013, 2:53:12 PM7/30/13
to codenameone...@googlegroups.com, maxim...@gmail.com
We don't have any short term plans in that direction. Windows Phone 7 is completely incompatible with 8 and effectively dead, so this isn't something we are looking into right now.

Максим Дубов

unread,
Jul 30, 2013, 3:46:50 PM7/30/13
to Shai Almog, codenameone...@googlegroups.com
Is there any workaround?
Is it possible to submit fix to svn?
Is it possible to build offline?


2013/7/31 Shai Almog <shai....@gmail.com>

Shai Almog

unread,
Jul 31, 2013, 12:42:07 AM7/31/13
to codenameone...@googlegroups.com, Shai Almog, maxim...@gmail.com
The workaround is using Windows Phone 8.
Do you mean a fix contributed by yourself? Some developers have contributed fixes for the Windows Phone 8 but 7 didn't get much attention.
I know one developer at least was able to build offline for Windows Phone 8 which isn't too different. We only provide support for offline build to our enterprise customers.

Максим Дубов

unread,
Jul 31, 2013, 12:55:51 AM7/31/13
to Shai Almog, codenameone...@googlegroups.com
I don't think it's possible to use WP8 jn WP7 device.
Yes, I mean a fix contributed by myself. Is it possible?


2013/7/31 Shai Almog <shai....@gmail.com>

Shai Almog

unread,
Jul 31, 2013, 12:59:09 PM7/31/13
to codenameone...@googlegroups.com, Shai Almog, maxim...@gmail.com
No it won't run on a Windows Phone 7 device but very few of them were sold, fewer than Bada devices.
Everything is possible, we got a few Windows Phone 8 contributions the code for Windows Phone 7 shouldn't be that different. You should also be able to backport quite a few of the fixes to 7 although most of the architecture (UI etc.) is completely different.
Reply all
Reply to author
Forward
0 new messages