我正在尝试为校园网络创建一个登录应用程序.我已经走得很远,但现在我被卡住了.
我正处于java返回一个页面,其中包含一个应该自动提交的简单表单:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<body onload="document.forms[0].submit()">
<noscript>
<p>
<strong>Note:</strong> Since your browser does not support JavaScript, you must press the Continue button once to proceed.
</p>
</noscript>
<form action="url" method="post">
<div>
<input type="hidden" name="RelayState" value="ss:mem:43141e4108638211a81427d145c7e9de"/>
<input type="hidden" name="SAMLResponse" value="base64string"/>
</div>
<noscript>
<div>
<input type="submit" value="Continue"/>
</div>
</noscript>
</form>
</body></html>
Run Code Online (Sandbox Code Playgroud)
当我将此字符串复制到.html文件并单击提交时,它会让我记录下来.现在我正在尝试在java中执行此操作,因此我提取RelayState和SAMLResponse并使用以下代码提交:
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
String params = "RelayState="+relayState+"&SAMLResponse="+saml;
System.out.println(params.length());
urlConnection.setRequestMethod("POST");
urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
urlConnection.setRequestProperty("Content-Length", Integer.toString(params.getBytes().length));
urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20100101 Firefox/10.0.2");
urlConnection.setDoInput(true);
urlConnection.setDoOutput(true);
DataOutputStream …Run Code Online (Sandbox Code Playgroud) 我正在使用NSUserDefaults在我的应用程序中保存一些数据.我在哪里可以找到开发过程中存储数据的文件?这是一个普通的可可应用程序(所以没有ios/iphone!)
一旦部署,它应该在Library/Preferences/appname.plist中可用,对吧?但是,当我还在处理应用程序时,我在哪里可以找到它?