MY Domino Sever 已启用会话验证,并且 HTTP 端口号配置为 8080。
当我执行下面的程序来获得一个多米诺 HTTP 会话时,我总是得到下面的输出。
我知道 RESPONSE CODE 200 表示运行平稳。但我没有看到在服务器上创建任何 HTTP 会话。即使我向 UsernamePasswordCredentials("xxxxx", "xxxxx") 提供了错误的凭据,它仍然返回 200 作为其响应代码。对此有什么建议吗?
public class ClientAuthentication {
public static void main(String[] args) {
DefaultHttpClient httpclient = new DefaultHttpClient();
try {
httpclient.getCredentialsProvider().setCredentials( new AuthScope("10.40.xx.xx", 8080),
new UsernamePasswordCredentials("xxxxx", "xxxxx"));
HttpPost httppost = new HttpPost("http://10.40.xx.xx:8080/names.nsf?Login");
System.out.println("executing request" + httppost.getRequestLine());
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
if (response.getStatusLine().getStatusCode() == HttpURLConnection.HTTP_OK){
System.out.println("---------------OKAY OKAY-------------------------");
System.out.println("RESPONSE CODE " + response.getStatusLine().getStatusCode());
}
if (entity != null) {
System.out.println("Response content length: " + entity.getContentLength());
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
输出 :
executing requestPOST http://10.40.xx.xx:8080/names.nsf?Login HTTP/1.1
---------------OKAY OKAY-------------------------
RESPONSE CODE 200
Response content length: 4256