Lotus Domino服务器上的Android HTTP认证

Lotus Domino服务器上的Android HTTP认证,第1张

概述我正在开发一个能够从LotusDomino数据库读取数据的android应用程序.我开始创建一个页面来测试HTTP身份验证,但遇到了很多困难.这是我的代码段:publicvoidGoAuth(Viewv){finalStringhttpsURL="http://xxx.xxx.xxx.xxxames.nsf/mypage?openpage";finalDef

我正在开发一个能够从Lotus Domino数据库读取数据的android应用程序.
我开始创建一个页面来测试http身份验证,但遇到了很多困难.这是我的代码段:

    public voID GoAuth(VIEw v){    final String httpsURL = "http://xxx.xxx.xxx.xxx/names.nsf/mypage?openpage";    final DefaulthttpClIEnt clIEnt = new DefaulthttpClIEnt();    final httpPost httppost = new httpPost(httpsURL);    String username = "demo";    String password = "demo";    try {        //authentication block:        final List<BasicnameValuePair> nvps = new ArrayList<BasicnameValuePair>();        nvps.add(new BasicnameValuePair("Username", username));        nvps.add(new BasicnameValuePair("Password", password));        final UrlEncodedFormEntity p_entity = new UrlEncodedFormEntity(nvps, http.UTF_8);        httppost.setEntity(p_entity);        //sending the request and retrIEving the response:        httpResponse response = clIEnt.execute(httppost);        httpentity responseEntity = response.getEntity();        if (response.getStatusline().getStatusCode() == httpURLConnection.http_OK){            //handling the response             final inputSource inputSource = new inputSource(responseEntity.getContent());            TextVIEw res=(TextVIEw)findVIEwByID(R.ID.result);            res.setText("Server response: "+inputSource.toString());        }    } catch (UnsupportedEnCodingException e) {        // Todo auto-generated catch block        e.printstacktrace();    } catch (ClIEntProtocolException e) {        // Todo auto-generated catch block        e.printstacktrace();    } catch (IllegalStateException e) {        // Todo auto-generated catch block        e.printstacktrace();    } catch (IOException e) {        // Todo auto-generated catch block        e.printstacktrace();    }}

服务器响应为:
    org.xml.sax
    inputSource @ 40575700

在浏览器中尝试同样的 *** 作,我看到登录页面,然后看到“ mypage”的内容.
对于在AndroID上必须遵循的正确方法和机制,我有些困惑.
任何帮助将不胜感激!

解决方法:

正如Richard在评论中提到的那样,您可能会看到“ session based authentication表格”,要处理任何类型的代码都相当麻烦.

为了获得“ http基本身份验证”(可能是任何一种语言都可以轻松处理)(基于浏览器的用户名/密码提示),您可以/应该在服务器端实现Override Session Authentication Rule.

另请参见Domino 7.0.2 allows for overriding of session-based authentication

总结

以上是内存溢出为你收集整理的Lotus Domino服务器上的Android HTTP认证全部内容,希望文章能够帮你解决Lotus Domino服务器上的Android HTTP认证所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1085534.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存