如何在本地服务器上使用Smack API UserSearchManager? [英] How to uses Smack API UserSearchManager with local server?

查看:164
本文介绍了如何在本地服务器上使用Smack API UserSearchManager?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个非常基本的问题,但是我在使用以下代码访问OpenFire搜索功能时遇到问题:

This may look a very basic question but I am having a problem accessing OpenFire search function using this code:

    try {

        UserSearchManager search = new UserSearchManager(connection.getConnection());
        Form searchForm = search.getSearchForm("search." + server);
        ...

    } catch (Exception e) {...}

这里的服务器是一个字符串,其值类似于"192.168.242.132",该代码从以下行得到错误:Form searchForm = search.getSearchForm("search." + server);

The server here is a String with value something like "192.168.242.132", the code gets error from this line: Form searchForm = search.getSearchForm("search." + server);

基本上,服务器可以启动并运行,因为我可以创建帐户并登录/注销.

Essentially, the server is up and running as I can create account and login/logout.

我认为问题出在服务器"字符串值.有人遇到过这种问题吗?

I assume that the problem is with the "server" String value. Any one have encountered this kind of problem before?

我已经在/etc/hosts中添加了将IP地址解析为myelastix-local.com的文件,但是仍然存在相同的问题,它可以访问create/login api,但是搜索仍然无法进行.我也需要修改openfire服务器设置吗?

I have already added in /etc/hosts to resolve the IP address to myelastix-local.com and still having the same problem, it can access create / login api but search still does not work. Do I have to modify openfire server settings too?

推荐答案

这就是我所做的:

Form searchForm = search.getSearchForm("search." + connection.getServiceName());

连接是XMPPConnection.

connection is the XMPPConnection.

这篇关于如何在本地服务器上使用Smack API UserSearchManager?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆