سؤال

somebody knows why I get the ResponseCode 400 on android 2.x ? In Android 4.x it works and the server returns 200.

        URL url = new URL(url_in);
        URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef());
        url = uri.toURL();
        HttpURLConnection c = (HttpURLConnection) url.openConnection();
        c.setRequestMethod("GET");
        c.setRequestProperty("Accept-Encoding", "identity");
        c.setRequestProperty("Accept-Charset", "UTF-8");
        c.setRequestProperty("Content-Type", "text/html");

        c.setConnectTimeout(timeout);
        c.setReadTimeout(timeout);
        c.connect();
        int status = c.getResponseCode();

Where is the difference?

هل كانت مفيدة؟

المحلول

ok i found this post.

and this..

topic: Avoiding Bugs In Earlier Releases

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top