Webview postURL正在发送GET而不是POST

时间:2014-09-16 16:38:35

标签: android webview

我正在使用webview尝试通过postURL方法发送POST请求。不幸的是,以下代码正如您对loadURL所期望的那样发送GET。我能看到这种情况的唯一情况是isNetworkURL失败。我记录这些结果,isNetworkURL返回true。有没有人在webview中看到过这种行为或任何其他错误的postURL?

WebView myWebView = (WebView) findViewById(R.id.webview);

String nextPage = "https://my.url.com/";

String postURL = "https://my.url.com/oauth_loginx";

String postData = "next="+nextPage+"&access_token="+creds.getAccessToken();
Log.d(TAG, "Attempting to POST to this URL: " + postURL + " with these variables: " + postData);
Log.d(TAG, "POST is network URL: " + URLUtil.isNetworkUrl(postURL));
myWebView.postUrl(postURL, EncodingUtils.getBytes(postData, "BASE64"));

WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
myWebView.setWebViewClient(new WebViewClient());

0 个答案:

没有答案