- 浏览: 22651855 次
- 性别:
- 来自: 杭州
-
最新评论
-
ZY199266:
配置文件还需要额外的配置ma
Android 客户端通过内置API(HttpClient) 访问 服务器(用Spring MVC 架构) 返回的json数据全过程 -
ZY199266:
我的一访问为什么是 /mavenwebdemo/WEB-I ...
Android 客户端通过内置API(HttpClient) 访问 服务器(用Spring MVC 架构) 返回的json数据全过程 -
lvgaga:
我又一个问题就是 如果像你的这种形式写。配置文件还需要额外的 ...
Android 客户端通过内置API(HttpClient) 访问 服务器(用Spring MVC 架构) 返回的json数据全过程 -
lvgaga:
我的一访问为什么是 /mavenwebdemo/WEB-I ...
Android 客户端通过内置API(HttpClient) 访问 服务器(用Spring MVC 架构) 返回的json数据全过程 -
y1210251848:
你的那个错误应该是项目所使用的目标框架不支持吧
log4net配置(web中使用log4net,把web.config放在单独的文件中)
Openfire+Spark安装手册
Openfire+Spark安装手册
王保政
QQ:29803446
关键字:快速开发平台 openjweb 增删改查 即时通信
2009-8-29
目 录
<!--[if supportFields]><span lang=EN-US style='mso-bidi-font-size:10.5pt'><span style='mso-element:field-begin'></span><span style='mso-spacerun:yes'> </span>TOC /o "1-3" /h /z /u <span style='mso-element:field-separator'></span></span><![endif]-->第一章 Java领域的IM解决方案.... <!--[if supportFields]><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'><span style='mso-element:field-begin'></span></span><span style='color:windowtext;display:none;mso-hide:screen;text-decoration:none; text-underline:none'> PAGEREF _Toc239321433 /h </span><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-separator'></span></span><![endif]-->2<!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F0054006F0063003200330039003300320031003400330033000000</w:data> </xml><![endif]--><!--[if supportFields]><span style='color:windowtext; display:none;mso-hide:screen;text-decoration:none;text-underline:none'><span style='mso-element:field-end'></span></span><![endif]-->
<!--[if supportFields]><span lang=EN-US style='mso-bidi-font-size:10.5pt'><span style='mso-element:field-end'></span></span><![endif]-->
<!--[if !supportLists]-->第一章 <!--[endif]-->Java领域的IM解决方案
Java领域的即时通信的解决方案可以考虑openfire+spark+smack。当然也有其他的选择。
Openfire是基于Jabber协议(XMPP)实现的即时通信服务器端版本,目前建议使用3.6.4版本,这个版本是当前最新的版本,而且网上可以找到下载的源代码。
即时通信客户端可使用spark2.5.8,这个版本是目前最新的release版本,经过测试发现上一版本在视频支持,msn网关支持上可能有问题,所以选择openfire3.6.4+spark2.5.8是最合适的选择。
Smack是即时通信客户端编程库,目前我已测通通过jsp使用smack的API向openfire注册用户发送消息,并且可以通过监听器获得此用户的应答消息。
通过smack向msn用户和QQ用户,gtalk用户发送消息应该也可以实现,关于向gtalk用户发送消息的例子较多。这个留待以后研究。至少目前可以通过程序向spark发消息了。对于局域网内部应用足以解决系统与用户交互的问题,甚至可以做自动应答机器人。
Spark支持聊天,语音,视频,会议,文件收发,截屏,连接msn等功能。
第二章 安装openfire3.6.4
2.1 配置机器的域名
使用openfire需要配置机器的域名。如果局域网内没有安装域服务器,则需要手工为机器配置域名,打开C:/WINDOWS/system32/drivers/etc/hosts文件,增加一新行:
<!--[if !supportLists]-->127.0.0.1 <!--[endif]-->bzwang.tzsoft.com (用户根据自己的需要可配置称别的名字,但最好符合带.的域名格式)
其他机器使用域名访问openfire,也需要在C:/WINDOWS/system32/drivers/etc/hosts中指定bzwang.tzsoft.com对应的ip地址,假设安装openfire的主机IP为192.168.1.10,则hosts文件中应增加一新行:
192.168.1.10 bzwang.tzsoft.com
通过这种方式指定主机域名,建议安装openfire的机器配置静态ip地址以免ip发生改变。
2.2 安装openfire
2.2.1 安装
安装程序为openfire_3_6_4.exe,运行后,语言选择简体中文,见下图:
<!--[if gte vml 1]><v:shapetype id="_x0000_t75"
coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe"
filled="f" stroked="f">
<v:stroke joinstyle="miter" />
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0" />
<v:f eqn="sum @0 1 0" />
<v:f eqn="sum 0 0 @1" />
<v:f eqn="prod @2 1 2" />
<v:f eqn="prod @3 21600 pixelWidth" />
<v:f eqn="prod @3 21600 pixelHeight" />
<v:f eqn="sum @0 0 1" />
<v:f eqn="prod @6 1 2" />
<v:f eqn="prod @7 21600 pixelWidth" />
<v:f eqn="sum @8 21600 0" />
<v:f eqn="prod @7 21600 pixelHeight" />
<v:f eqn="sum @10 21600 0" />
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect" />
<o:lock v:ext="edit" aspectratio="t" />
</v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" style='width:261pt;
height:101.25pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image001.jpg"
o:title="1" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
后续按照提示安装,最后出现下面的界面:
<!--[if gte vml 1]><v:shape id="_x0000_i1026"
type="#_x0000_t75" style='width:373.5pt;height:291.75pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image002.jpg"
o:title="2" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
这时先不要运行openfire,所以不要勾选上面页面的复选框,然后点完成,如果勾选的话,在新出现的窗口中点“stop”停止openfire后续的运行,然会点”quit”退出,因为下面要配置openfire使用的数据库,需要手工将数据库驱动放到openfire的某个目录下,否则openfire不识别数据库驱动的包名。
2.2.2 运行数据库脚本
数据库运行脚本在C:/Program Files/Openfire/resources/database目录下,如果用户安装选择的不是C:/Program Files目录,可以到安装openfire目录下找到database目录,打开此目录后可看到有多种版本的数据库脚本,假定我们现在要把openfire的数据库安装在sqlserver2005中,则使用openfire_sqlserver.sql脚本,假如已经装好了2005数据库,可在Management Studio中执行数据库脚本,见下图:
<!--[if gte vml 1]><v:shape id="_x0000_i1027"
type="#_x0000_t75" style='width:415.5pt;height:279.75pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image003.jpg"
o:title="3" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
执行后,打开数据库,可看到下面创建的数据库表:
<!--[if gte vml 1]><v:shape id="_x0000_i1028"
type="#_x0000_t75" style='width:243pt;height:445.5pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image005.jpg"
o:title="4" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
2.2.3 数据库驱动jar包
如果使用sqlserver2005,则将sqlserver2005驱动jar包sqljdbc.jar复制到C:/Program Files/Openfire/lib下,使用openjweb快速开发平台的用户可直接从D:/project/apache-tomcat-5.5.27/common/lib找到此jar包复制过去,另外此目录还有mysql的mysql-connector-java-3.1.12-bin.jar和oracle的ojdbc14.jar,如果用户不选择sqlserver则复制对应数据库的驱动jar包。
2.2.4 openfire初始化配置
从开始菜单中找到openfire并运行,下面是运行界面:
<!--[if gte vml 1]><v:shape
id="_x0000_i1029" type="#_x0000_t75" style='width:300pt;height:223.5pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image006.jpg"
o:title="5" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
点”Launch Admin”,出现下面的页面,页面连接为http://127.0.0.1:9090/setup/index.jsp
<!--[if gte vml 1]><v:shape
id="_x0000_i1030" type="#_x0000_t75" style='width:414.75pt;height:255pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image007.jpg"
o:title="6" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
语种选择中文(简体),点”Continue”:(下面的页面如果出现英文,请刷新一下页面或者重新点Launch Admin)
<!--[if gte vml 1]><v:shape
id="_x0000_i1031" type="#_x0000_t75" style='width:414.75pt;height:204pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image009.jpg"
o:title="7" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
这个页面的Domain默认为机器名,请改为一开始设置的域名,例如bzwang.tzsoft.com,就是将图中的Domain中的文字换成bzwang.tzsoft.com后,点Continue(继续):
<!--[if gte vml 1]><v:shape id="_x0000_i1032"
type="#_x0000_t75" style='width:415.5pt;height:205.5pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image011.jpg"
o:title="8" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
这个页面中第一个选项,即标准数据库连接,不要选择嵌入的数据库(Embedded Database,嵌入的数据库是hsqldb数据库,生产环境不要选择此选项),然后点”继续”:
这个页面是配置是否使用LDAP,我们现在不配置LDAP,所以选择 Default默认即可,点继续:
<!--[if gte vml 1]><v:shape
id="_x0000_i1033" type="#_x0000_t75" style='width:414.75pt;height:240pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image013.jpg"
o:title="9" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
上图是sqlserver2005的配置,jdbc驱动类为: com.microsoft.sqlserver.jdbc.SQLServerDriver
数据库URL为:
jdbc:sqlserver://192.168.1.222:2324;DatabaseName=dms
数据库名和用户名及口令请根据实际环境配置。
配置完成后,点”继续”:
如果点继续出现错误提示页面,请检查
<!--[if !supportLists]-->(1) <!--[endif]-->数据库表是否按前面的步骤已在数据库中创建
<!--[if !supportLists]-->(2) <!--[endif]-->是否已将对应的数据库jar保复制到openfire的lib目录
<!--[if !supportLists]-->(3) <!--[endif]-->检查数据库连接参数,端口,数据库名等属性,可使用dos命令行检查数据库端口是否有效,例如telnet 192.168.1.222 2324
下面是配置LDAP的页面,选择”初始设置”(默认选项)即可。
<!--[if gte vml 1]><v:shape id="_x0000_i1034"
type="#_x0000_t75" style='width:414.75pt;height:207.75pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image015.jpg"
o:title="10" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
点“继续”:
下面是配置超级管理员的页面:
<!--[if gte vml 1]><v:shape id="_x0000_i1035"
type="#_x0000_t75" style='width:415.5pt;height:202.5pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image017.jpg"
o:title="11" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
输入一个邮箱和口令,例如123456
设置好后点“继续”:
<!--[if gte vml 1]><v:shape id="_x0000_i1036"
type="#_x0000_t75" style='width:414.75pt;height:169.5pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image019.jpg"
o:title="12" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
这个时候不要点“登录到管理控制台”,登录肯定失败,需要切换到这个页面:
<!--[if gte vml 1]><v:shape id="_x0000_i1037"
type="#_x0000_t75" style='width:300pt;height:223.5pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image006.jpg"
o:title="5" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
点”stop”,然后点“start”,等重启动成功后点”Launch Admin”,进入登录页面:
<!--[if gte vml 1]><v:shape
id="_x0000_i1038" type="#_x0000_t75" style='width:327pt;height:154.5pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image021.jpg"
o:title="13" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
使用admin 用户名和设置的口令123456登录,下面是登录成功的页面,恭喜!sqlserver2005上安装openfire成功!
<!--[if gte vml 1]><v:shape
id="_x0000_i1039" type="#_x0000_t75" style='width:414.75pt;height:237pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image022.jpg"
o:title="14" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
我们打开ofUser数据库表可以看到admin用户信息:(下面的口令不是用md5加密的)
<!--[if gte vml 1]><v:shape
id="_x0000_i1040" type="#_x0000_t75" style='width:414.75pt;height:54pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image024.jpg"
o:title="15" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
2.3 设置用户
在登录成功页面点“用户/组”标签维护用户信息,可在这里增加新的用户,也可以建组,下面是新建的几个组:
<!--[if gte vml 1]><v:shape id="_x0000_i1041"
type="#_x0000_t75" style='width:414.75pt;height:147pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image026.jpg"
o:title="16" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
下面新建几个测试用户,分别是abao/abao,zhangyu/zhangyu,suqi/suqi,liu/liu
<!--[if gte vml 1]><v:shape id="_x0000_i1042"
type="#_x0000_t75" style='width:414.75pt;height:209.25pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image028.jpg"
o:title="17" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
说明:当安装了spark客户端后,用户可直接在客户端注册帐号。
<!--[if !supportLists]-->第三章 <!--[endif]-->安装spark客户端
安装程序为spark_2_5_8.exe,安装过程全部默认即可。
下面是登录界面:
<!--[if gte vml 1]><v:shape id="_x0000_i1043"
type="#_x0000_t75" style='width:192pt;height:317.25pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image030.jpg"
o:title="18" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
登录时可使用openfire中创建的帐号,也可以点(A)帐户自己注册新的帐号,服务器需设置为openfire的域名地址即上面安装的bzwang.tzsoft.com,下面是登录成功界面:
<!--[if gte vml 1]><v:shape id="_x0000_i1044"
type="#_x0000_t75" style='width:231pt;height:392.25pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image031.jpg"
o:title="19" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
关于spark客户端的具体功能就不介绍了,下面介绍openfire配置msn网关及spark如何连接msn,以及red5视频的配置方式。
<!--[if !supportLists]-->第四章 <!--[endif]-->配置msn网关
4.1 服务端配置msn网关
将gateway.jar插件包(可网上下载)复制到openfire的plugin目录下,如:
C:/Program Files/Openfire/plugins,如果openfire安装到别的目录请找到对应的目录,把gateway.jar复制过去。停止openfire,重新启动并登录后,见下面的页面,多出了一个gateways的标签页:
<!--[if gte vml 1]><v:shape id="_x0000_i1045"
type="#_x0000_t75" style='width:414.75pt;height:257.25pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image032.jpg"
o:title="20" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
点Gateways,找到MSN Messagers,勾选,然后点“选项”,见下图:
<!--[if gte vml 1]><v:shape id="_x0000_i1046"
type="#_x0000_t75" style='width:414.75pt;height:343.5pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image034.jpg"
o:title="21" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
以上默认的配置不用修改,点“测试”,显示:
<!--[if gte vml 1]><v:shape id="_x0000_i1047"
type="#_x0000_t75" style='width:414pt;height:115.5pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image036.jpg"
o:title="22" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
点“测试连接”,显示测试成功。(右侧将显示绿色背景的文字提示测试成功)
4.2 spark客户端设置msn帐号:
启动spark,登录后,spark窗口的右上多出一个灰色的蝴蝶,见下图:
<!--[if gte vml 1]><v:shape id="_x0000_i1048"
type="#_x0000_t75" style='width:221.25pt;height:65.25pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image037.jpg"
o:title="23" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
点这个蝴蝶,然后选择“输入登入资讯”,显示下面的窗口:
<!--[if gte vml 1]><v:shape id="_x0000_i1049"
type="#_x0000_t75" style='width:297.75pt;height:150.75pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image038.jpg"
o:title="24" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
在这里输入msn的用户和口令,然后保存,稍后片刻,spark将从msn上获取用户列表,最后显示下面的msn好友列表:
<!--[if gte vml 1]><v:shape id="_x0000_i1050"
type="#_x0000_t75" style='width:231pt;height:387pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image039.jpg"
o:title="25" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
这时可以选择一个在线用户聊天了,spark还支持文件传输,截屏,语音,视频等。
<!--[if !supportLists]-->第五章 <!--[endif]-->Red5视频配置
5.1 部署red5.war
将red5.war复制到C:/Program Files/Openfire/plugins,如果openfire是在运行状态,一会会在这个目录下自动部署red5.war(在此目录下自动生成red5目录)。安装成功后,openfire的管理页面会多出一个red5标签,见下图:
<!--[if gte vml 1]><v:shape id="_x0000_i1051"
type="#_x0000_t75" style='width:415.5pt;height:99pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image040.jpg"
o:title="26" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
服务端不需要做任何改动。
5.2 spark客户端配置视频插件
上一步骤部署了red5后,需要停止openfire并重新启动,启动完成后,访问http://bzwang.tzsoft.com:7070/red5,显示一个red5的html首页,下拉到页面最下面,找到spark plugin,点”here”,见下图:
<!--[if gte vml 1]><v:shape id="_x0000_i1052"
type="#_x0000_t75" style='width:390.75pt;height:96pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image041.jpg"
o:title="27" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
点”here”会下载red5-plugin.jar,直接保存在C:/Program Files/Spark/plugins目录下,重新启动spark。
在spark中右键点一个人,会出现几个菜单:
<!--[if gte vml 1]><v:shape
id="_x0000_i1053" type="#_x0000_t75" style='width:141pt;height:219.75pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image042.jpg"
o:title="28" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
其中View Destop Screen和Publish Desktop Screen是相关联的,见下图:
<!--[if gte vml 1]><v:shape id="_x0000_i1054"
type="#_x0000_t75" style='width:253.5pt;height:119.25pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image043.jpg"
o:title="29" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
如果A用户用Publish Desktop Screen发布了自己的桌面,B用户选择A用户,右键选择上一个图中的View Desktop Screen,则B用户可看到A用户的计算机桌面。在http://bzwang.tzsoft.com:7070/red5页面上有一个功能和这个类似,见下图:
<!--[if gte vml 1]><v:shape id="_x0000_i1055"
type="#_x0000_t75" style='width:327.75pt;height:102.75pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image044.jpg"
o:title="30" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
To publish是发布自己的桌面,To Viewer是别人观看自己发布的桌面,多人发布是什么效果没有具体测试。可以自己发布然后观看自己的桌面(效果有点像两个镜子对照,会出现层层窗口嵌套的现象),下面是自己发布自己的桌面并观看自己的桌面的效果:
<!--[if gte vml 1]><v:shape id="_x0000_i1056"
type="#_x0000_t75" style='width:414.75pt;height:312.75pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image045.jpg"
o:title="31" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
当选择一个人,右键选择Add/Remove Video Roster后,可进行 视频聊天,可以加多个人进行视频,每选择一个热人,然后点Add/Remove Video Roster,就可以将这个人加入到视频中或者从视频中移除,下面是视频页面(我没装摄像头),可以看出一个页面中可以显示多人视频,如果其他人也装了spark,估计也能看到多人视频的效果(猜测,没有测试),见下图:
<!--[if gte vml 1]><v:shape id="_x0000_i1057"
type="#_x0000_t75" style='width:261pt;height:312pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image047.jpg"
o:title="32" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
<!--[if !supportLists]-->第六章 <!--[endif]-->使用smack开发即时通信功能
可以使用smack开源产品开发与即时通信用户交互的功能,这样我们可以使用系统来模拟一个openfire的用户来向其他用户发送消息,因而可以使应用系统产生的业务消息实时传递给即时通信用户,例如系统向某用户发送“有新的请假单需要您审批”,如果用户开启了spark客户端,则spark客户端会实时接收此消息。
Smack可从网上下载,目前最新版本为smack_3_1_0.zip,将此文件里四个smack开头的jar包放到自己的WEB应用的WEB-INF/lib目录,使用下面的jsp文件进行测试:
下面是测试向spark用户suqi发送消息的页面代码:
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="org.jivesoftware.smack.*"%>
<%@ page import="org.jivesoftware.smack.packet.*"%>
<%
//以下可以通过程序向spark帐号发信息,但没有测通想msn帐号发信息
XMPPConnection connection = new XMPPConnection("bzwang.tzsoft.com"); //openfire服务器的主机域名
// ConnectionConfiguration connectionConfig = new ConnectionConfiguration( "messenger.hotmail.com",1863,"messenger.hotmail.com");
// XMPPConnection connection = new XMPPConnection(connectionConfig);
connection.connect();//先连接服务器
try
{
connection.login("abao", "abao");//使用openfire的注册用户登录openfire服务器
System.out.println("登录成功!");
//createChat的第一个参数一定要带域名(suqi@bzwang.tzsoft.com),否则会话失败
Chat chat = connection.getChatManager().createChat("suqi@bzwang.tzsoft.com", new MessageListener()
//Chat chat = connection.getChatManager().createChat("baozhengw9999%hotmail.com@msn.bzwang.cmissoft.com", new MessageListener()
{
public void processMessage(Chat chat, Message message)
{
//如果不用connection.disconnect()断开连接,这里可以监听回复信息
System.out.println("Received message: " + message.getBody());
}
}
);
System.out.println("发送消息....");
chat.sendMessage("请问你收到我的消息了吗?");//
/* Message message = new Message("baozhengw9999%hotmail.com@msn.bzwang.cmissoft.com");
message.setBody("你好!我是个聊天机器人!");
connection.sendPacket(message);
*/
System.out.println("发送完毕...");
connection.disconnect();
} catch (Exception ex) {
System.out.println("login error");
}
%>
发送成功后,如果suqi用户打开了spark,则spark会闪烁提示有新消息,打开spark,聊天窗口显示系统用abao用户发送的消息,见下图:
<!--[if gte vml 1]><v:shape id="_x0000_i1058" type="#_x0000_t75"
style='width:414.75pt;height:105.75pt'>
<v:imagedata src="file:///C:/DOCUME~1/wu/LOCALS~1/Temp/msohtmlclip1/01/clip_image048.jpg"
o:title="33" />
</v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
这样实现了业务系统和即时通信的无缝整合,以后应该还可以实现通过smack编程使内网的openfire注册用户向自己的msn好友或QQ好友发送消息以及接收消息。
相关推荐
【标题】: "openfire+spark+sparkweb的配置指南" 【内容】: 本文将详细介绍如何配置openfire、spark和sparkweb这三款组件,它们是构建即时通讯系统的常用工具。Openfire是一款开源的XMPP服务器,Spark是基于Java的...
【Openfire、Spark和SparkWeb】是一套开源的即时通讯解决方案,主要由Openfire服务器、Spark客户端和SparkWeb网页客户端组成。Openfire是基于XMPP协议的服务器,它提供了聊天、会议、文件传输等实时通信功能。Spark...
在搭建基于Openfire、Spark和Smack的IM系统时,首先需要在服务器上安装并配置Openfire,创建用户和群组,设置安全策略。接着,用户可以在桌面端安装Spark客户端,通过输入服务器地址、用户名和密码进行连接。对于...
"OpenFire+Spark+Smack开发流程" 在本文中,我们将详细介绍OpenFire、Spark和Smack三个组件在XMPP IM开发中的作用,以及如何使用它们来开发一个完整的XMPP IM系统。 首先,让我们了解一下XMPP是什么?Extensible ...
Openfire+Spark+Spark_Web安装配置
《Openfire+Spark+SparkWeb安装配置详解》 Openfire是一款基于Jabber协议的开源即时通讯服务器,它支持多种操作系统,并自带Java环境。搭配Spark客户端,可以构建一个功能强大的企业级聊天系统。在此,我们将详细...
"openfire + spark 开发" 在本文中,我们将讨论基于 Openfire 和 Spark 的 XMPP IM 软件开发。我们将从 XMPP 协议的介绍开始,接着讨论如何使用 Spark 和 Openfire 来实现一个完整的 IM 软件开发。 什么是 XMPP? ...
openfire+spark 支持视频的插件 把插件放到 spark 安装目录中openfire+spark 支持视频的插件 把插件放到 spark 安装目录中
《Openfire+Spark安装手册》是一份详细的指南,旨在帮助用户成功地在自己的系统上安装并配置Openfire服务器以及Spark即时通讯客户端。Openfire是一款基于XMPP协议的开源即时通讯服务器,而Spark则是一个轻量级、用户...
Openfire和Spark是两个在企业通信领域常用的开源软件,它们主要提供即时消息(IM)、音频和视频通话功能。Openfire是一款基于XMPP协议的服务器,而Spark则是一个客户端应用程序,两者结合可以构建出一套完整的实时...
openfire+spark+smack工具,针对即时消息模拟以及xmpp协议测试有很大的帮助
安卓的即时通讯软件的开发工具的安装过程,openfire+spack的安装过程
【WebIM(Openfire+Spark+Smack)】是一个在Java领域实现即时通讯(IM)的解决方案,以其稳定性、安全性和高效性而受到推崇。该方案由三个主要组件构成:Openfire作为服务器端,Spark作为客户端,而Smack则负责实现...
【Openfire+Spark+Smack开发流程】 Openfire、Spark和Smack是构建XMPP即时通讯(IM)系统的三大核心组件。XMPP(Extensible Messaging and Presence Protocol)是一种基于XML的开放协议,用于实时通讯和状态传递。...
总的来说,OpenFire和Spark的部署安装过程相对简单,但为了确保稳定性和安全性,需要对服务器环境和数据库配置有深入理解。同时,二次开发能力是提升软件适用性的重要途径。在企业环境中,这种定制化的能力尤为关键...
本资源包含JAVA源码、openfire服务器和spark客户端,为开发者提供了一整套构建即时通讯系统的解决方案。 首先,我们要了解JAVA源码在即时通讯中的作用。Java作为跨平台的编程语言,广泛应用于服务器端开发,尤其...
Android AdXmpp(Openfire+asmack+spark)即时通信.zip项目安卓应用源码下载Android AdXmpp(Openfire+asmack+spark)即时通信.zip项目安卓应用源码下载 1.适合学生毕业设计研究参考 2.适合个人学习研究参考 3.适合公司...
Openfire+Spark是一个高效的企业级即时通讯解决方案,它结合了Openfire服务器和Spark客户端,两者共同构建了一个基于XMPP协议的实时协作环境。Openfire,作为服务器端,使用Java编程语言,遵循XMPP(Extensible ...
Openfire和Spark是两个在IT领域中用于即时通讯(IM)的重要开源项目。Openfire是一款基于XMPP(Extensible Messaging and Presence Protocol)协议的服务器,它允许用户进行实时通信,而Spark则是一款轻量级的XMPP...