openfire build(2)
- InterceptorManager
- PluginManager
- openfire 插件的中servlet 在web-custom.xml 中的配置 url 一定要小写,访问时不区别大写小 否则404
如:
<servlet>
<servlet-name>Sample1Servlet</servlet-name>
<servlet-class>com.myyule.openfire.plugin.Sample1Servlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Sample1Servlet</servlet-name>
<url-pattern>/servlet1</url-pattern>
<!-- 此处一定要小写,访问时大小时无关,否则404
http://127.0.0.1:9090/plugins/sample/ServLet1 也可以访问成功
-->
</servlet-mapping>
- 自定用户表:
--设置JDBC连接方式
insert into OFPROPERTY (NAME, PROPVALUE)
values ('jdbcProvider.connectionString',
'jdbc:oracle:thin:@10.35.246.178:1521:orcl');
insert into OFPROPERTY (NAME, PROPVALUE)
values ('jdbcProvider.driver', 'oracle.jdbc.driver.OracleDriver');
--设置管理员账号
insert into OFPROPERTY (NAME, PROPVALUE)
values ('admin.authorizedJIDs', 'admin@localhost');
--自定义用户认证
insert into OFPROPERTY (NAME, PROPVALUE)
values ('jdbcAuthProvider.useConnectionProvider', 'true');
insert into OFPROPERTY (NAME, PROPVALUE)
values ('jdbcAuthProvider.passwordSQL', 'select ''123456'' as pwd from
t_sys_user t where t.code=?');
insert into OFPROPERTY (NAME, PROPVALUE)
values ('jdbcAuthProvider.passwordType', 'plain');
--自定义用户管理
insert into OFPROPERTY (NAME, PROPVALUE)
values ('jdbcUserProvider.allUsersSQL', 'select code from t_sys_user
t');
insert into OFPROPERTY (NAME, PROPVALUE)
values ('jdbcUserProvider.nameField', 'name');
insert into OFPROPERTY (NAME, PROPVALUE)
values ('jdbcUserProvider.searchSQL', 'select code from t_sys_user t
where code=?');
insert into OFPROPERTY (NAME, PROPVALUE)
values ('jdbcUserProvider.useConnectionProvider', 'true');
insert into OFPROPERTY (NAME, PROPVALUE)
values ('jdbcUserProvider.emailField', 'email');
insert into OFPROPERTY (NAME, PROPVALUE)
values ('jdbcUserProvider.userCountSQL', 'select count(*) from
t_sys_user t');
insert into OFPROPERTY (NAME, PROPVALUE)
values ('jdbcUserProvider.loadUserSQL', 'select t.name,t.email,t.code
from t_sys_user t where t.code=?');
insert into OFPROPERTY (NAME, PROPVALUE)
values ('jdbcUserProvider.usernameField', 'code');
--使用不同的数据源
update OFPROPERTY set
PROPVALUE='org.jivesoftware.openfire.user.JDBCUserProvider'
where NAME='provider.user.className';
update OFPROPERTY set
PROPVALUE='org.jivesoftware.openfire.auth.JDBCAuthProvider'
where NAME='provider.auth.className';
commit;
openfire 包错误 的类型与情形
在 org.xmpp.packet.PacketError 类中
Type:可用的类型:
Error.Type. cancel --do not retry (the error is unrecoverable).
不要重试(错误是不可恢复)
Error.Type. continue_processing -- proceed (the condition was only a warning). Equivalent to the XMPP error type "continue".
继续(条件只有一个警告)。这表示存在"continue"错误代码在XMPP中; 因为"continue"在Java中是保留的关键字(enum的名称已被更改)。
Error.Type. modify -- retry after changing the data sent.
更改发送数据后重试。
Eror.Type. auth -- retry after providing credentials.
提供凭据后重试。
Error.Type. wait -- retry after waiting (the error is temporary).
等待后重试(错误是暂时的)。
Condition
安全
枚举
类型的错误条件:
bad_request("bad-request", Type.modify, 400),
/**
* 发件人发送的XML是不正确格式或不能处理的
*(例如,一个IQ节,其中包括一个无法识别的'type'属性) ;
* 关联的错误类型应该为"modify"。
*
* The sender has sent XML that is malformed or that cannot be processed
* (e.g., an IQ stanza that includes an unrecognized value of the 'type'
* attribute); the associated error type SHOULD be "modify".
*/
conflict("conflict", Type.cancel, 409),
/**
* 访问不能被授权,因为一个正存在的资源或会话与原来存在的名称或地址相同;
* 关联的错误类型应该为"cancel" 。
*
* Access cannot be granted because an existing resource or session
* exists with the same name or address; the associated error type
* SHOULD be "cancel".
*/
feature_not_implemented("feature-not-implemented", Type.cancel, 501),
/**
* 请求的功能没有被由收件人或服务器实现,因此不能被处理;
* 关联的错误类型应该为"cancel" 。
*
* The feature requested is not implemented by the recipient or
* server and therefore cannot be processed; the associated error
* type SHOULD be "cancel".
*/
forbidden("forbidden", Type.auth, 403),
/**
* 正在请求的实体不具备所需的权限来完成操作;
* 关联的错误类型应该为"auth" 。
*
* The requesting entity does not possess the required permissions to
* perform the action; the associated error type SHOULD be "auth".
*/
gone("gone", Type.modify, 302),
/**
* 接受者或服务器不再使用这个地址进行联系(在XML字符数据的<gone/>元素中,这个错误节可以包含一个新的地址) ;
* 关联的错误类型应该为"modify"。
*
* The recipient or server can no longer be contacted at this address
* (the error stanza MAY contain a new address in the XML character
* data of the <gone/> element); the associated error type SHOULD be
* "modify".
*/
internal_server_error("internal-server-error", Type.wait, 500),
/**
* 服务器无法处理节,因为配置错误或其他未定义的内部服务器错误;
* 关联的错误类型应该为"wait"。
*
* The server could not process the stanza because of a misconfiguration
* or an otherwise-undefined internal server error; the associated error
* type SHOULD be "wait".
*/
item_not_found("item-not-found", Type.cancel, 404),
/**
* 无法找到需要的JID地址 或 item(项目)
* 关联的错误类型应该为"cancel"。
*
* The addressed JID or item requested cannot be found; the associated
* error type SHOULD be "cancel".
*/
jid_malformed("jid-malformed", Type.modify, 400),
/**
* 发送实体提供或连接到一个XMPP地址(例如, 'to'属性的值)或由于这方面(例如,资源标识符)
* 在在寻址方案中不遵守的已定义的语法(第3节)
* 关联的错误类型应该为"modify"。
*
* The sending entity has provided or communicated an XMPP address
* (e.g., a value of the 'to' attribute) or aspect thereof (e.g.,
* a resource identifier) that does not adhere to the syntax defined
* in Addressing Scheme (Section 3); the associated error type SHOULD
* be "modify".
*/
not_acceptable("not-acceptable", Type.modify, 406),
/**
* 接收者或服务器不理解该请求,而拒绝处理它,因为它不符合被接收者或服务器定义的标准
* (例如,一个局部的方针,在消息中看作可接受的词);
* 关联的错误类型应该为"modify"
*
* The recipient or server understands the request but is refusing
* to process it because it does not meet criteria defined by the
* recipient or server (e.g., a local policy regarding acceptable
* words in messages); the associated error type SHOULD be "modify".
*/
not_allowed("not-allowed", Type.cancel, 405),
/**
* 收件人或服务器不允许任何实体完成该操作;
* 关联的错误类型应该为"cancel"
*
* The recipient or server does not allow any entity to perform
* the action; the associated error type SHOULD be "cancel".
*/
not_authorized("not-authorized", Type.auth, 401),
/**
* 发送者在被允许执行操作之前 必须提供正确的凭据,或已经提供不正确的凭据;
* 关联的错误类型应该为"auth"
*
* The sender must provide proper credentials before being allowed
* to perform the action, or has provided improper credentials;
* the associated error type SHOULD be "auth".
*/
payment_required("payment-required", Type.auth, 402),
/**
*
* 因为需要支付(认证),请求实体未被授权访问所请求的服务;
*关联的错误类型应该为"auth"
*
* The requesting entity is not authorized to access the requested
* service because payment is required; the associated error type
* SHOULD be "auth".
*/
recipient_unavailable("recipient-unavailable", Type.wait, 404),
/**
* 预期的收件人暂时没空(没在线);
* 关联的错误类型应该为"wait"。
* (注:应用程序不能返回这个错误,如果这样做会提供有关预期的信息收件人的网络
*
* The intended recipient is temporarily unavailable; the associated
* error type SHOULD be "wait" (note: an application MUST NOT return
* this error if doing so would provide information about the intended
* recipient's network availability to an entity that is not authorized
* to know such information).
*/
redirect("redirect", Type.modify, 302),
/**
* 接收者或服务器重定向这个请求另一个实体,
* 通常是暂时的(错误节应该包含备用地址,它必须是有效的JID ,在<redirect/>元素的XML字符数据) ;
* 关联的错误类型应该为"modify"。
*
* The recipient or server is redirecting requests for this
* information to another entity, usually temporarily (the error
* stanza SHOULD contain the alternate address, which MUST be a
* valid JID, in the XML character data of the <redirect/> element);
* the associated error type SHOULD be "modify".
*/
registration_required("registration-required", Type.auth, 407),
/**
* 请求实体未被授权访问所请求的服务,因为需要注册;
* 关联的错误类型应该为"auth"。
*
* The requesting entity is not authorized to access the requested
* service because registration is required; the associated error
* type SHOULD be "auth".
*/
remote_server_not_found("remote-server-not-found", Type.cancel, 404),
/**
* 远程服务器或指定的服务,不存在预定的接收者(的部分或全部的JID);
* 关联的错误类型应该为"cancel"
* A remote server or service specified as part or all of the JID
* of the intended recipient does not exist;
* the associated error type SHOULD be "cancel".
*/
remote_server_timeout("remote-server-timeout", Type.wait, 504),
/**
* 远程服务器或指定的服务,不能在一个适当的时间内联系到预定的接收者的部分或全部的JID(或须履行请求);
* 关联的错误类型应该为"wait"
*
* A remote server or service specified as part or all of the JID of
* the intended recipient (or required to fulfill a request) could not
* be contacted within a reasonable amount of time; the associated
* error type SHOULD be "wait".
*/
resource_constraint("resource-constraint", Type.wait, 500),
/**
* 服务器或接收者缺乏必要的系统资源到请求的服务
* 关联的错误类型应该为"wait"
*
* The server or recipient lacks the system resources necessary to
* service the request; the associated error type SHOULD be "wait".
*/
service_unavailable("service-unavailable", Type.cancel, 503),
/**
* 服务器或接收者目前不提供请求的服务;
* 关联的错误类型应该为"cancel"
*
* The server or recipient does not currently provide the requested
* service; the associated error type SHOULD be "cancel".
*/
subscription_required("subscription-required", Type.auth, 407),
/**
* 因为需要订阅,请求实体未被授权访问所请求的的服务;
* 关联的错误类型应该为"auth"
*
* The requesting entity is not authorized to access the requested
* service because a subscription is required; the associated error
* type SHOULD be "auth".
*/
undefined_condition("undefined-condition", Type.wait, 500),
/**
* 没有定义的条件
*
* The error condition is not one of those defined by the other
* conditions in this list; any error type may be associated with
* this condition, and it SHOULD be used only in conjunction with
* an application-specific condition.<p>
*
* Implementation note: the default type for this condition is
* {@link Type#wait}, which is not specified in the XMPP protocol.
*/
unexpected_request("unexpected-request", Type.wait, 400);
/**
* 没有预料的请求
*
* The recipient or server understood the request but was not
* expecting it at this time (e.g., the request was out of order);
* the associated error type SHOULD be "wait".
*/
修改服务器名后出现错误,
解决办法:
1、登陆openfire管理页面,点击主页面下方“编辑属性”,修改服务器名称为当前主机名称,点击“保存属性”,重启服务器。
2、 重启后,主页的“服务器属性”的‘服务器名称“出现叹号, 这是RSA认证无效造成的,对新的服务器进行RSA证书的配置。
3、选择【服务器设置】菜单,选择左下方【服务器证书】,点击后面的删除按钮将两个证书全部删除。删除后重启服务器。
4、重启后,系统提示“一个或更多的证书丢失。单击 这里 产生自定义签名证书”。点击后,自动生成和新的服务器匹配的RSA证书。
5、 重启服务器。 再次登录,主界面服务器名称的叹号消失,客户端可以正常登陆。
openfire build(2)的更多相关文章
- openfire build
1. build path: a) source folder:包括openfire和各插件的代码. b) libraries:build/lib下jar包和插件下jar包,jdk/lib/tools ...
- 配置Openfire的eclipse项目
官方文档在这里 Install JDK Download JDK and install them. The least version should be 1.5. I use 1.6. Sorry ...
- 跟我一步一步开发自己的Openfire插件
http://www.blogjava.net/hoojo/archive/2013/03/07/396146.html 跟我一步一步开发自己的Openfire插件 这篇是简单插件开发,下篇聊天记录插 ...
- openfire :openfire 不同类型插件的开发示例
新建一个自己的Javaproject工程,添加的jar包如下: 将jasper-compiler.jar.jasper-runtime.jar.servlet.jar添加到新建的工程中.如果没有jar ...
- 部署openfire到linux环境下
1.java环境部署:具体参考 http://blog.csdn.net/gufachongyang02/article/details/45337379 2.ant环境部署: 具体参考 http:/ ...
- openfire插件开发环境
创建java工程 SamplePlugin: package com.hoo.server.plugin; import java.io.File; import org.jivesoftware.o ...
- eclipse下编译openfire3.9.1源码
[一].下载源码 打开网址:http://www.igniterealtime.org/downloads/source.jsp 选择目前最新版本 openfire_src_3_9_1.zip 下载. ...
- 技术笔记:XMPP之openfire+spark+smack
在即时通信这个领域目前只找到一个XMPP协议,在其协议基础上还是有许多成熟的产品,而且是开源的.所以还是想在这个领域多多了解一下. XMPP协议:具体的概念我就不写了,毕竟这东西网上到处是.简单的说就 ...
- Openfire Strophe开发中文乱码问题
网站上有很多Openfire Web方案,之前想用Smack 但是jar包支持客户端版本的,还有JDK版本问题 一直没调试成功 估计成功的方法只能拜读源码进行修改了. SparkWeb 官网代码很 ...
随机推荐
- Vue DOM事件
本文参考自:https://mp.weixin.qq.com/s?src=3×tamp=1527154113&ver=1&signature=tWGeTa86gyK* ...
- SAS中的自动变量
Sas自动变量:由数据步语句自动创建的. _n_ :观测序号: _error_:错误信息变量; _numeric_ :所有数值变量: _character_:所有字符变量; _all_:所有变量; f ...
- win10多用户远程登录
实现效果:不同的电脑可以同时登录一台windows主机,但是必须使用不同的账号 首先,我们来创建一个新用户 点击设置,搜索用户 点击下一步,一个普通用户就创建完成了. 然后,打开远程设置,右键此电脑, ...
- Django之信息聚合
feeds.py #coding:utf-8 __author__ = 'similarface' from django.contrib.syndication.views import Feed ...
- TP 自动验证规则
#自动验证 protected $_validate=array( #参数最后代表1 表示必须验证,0表示当这个字段存在的时候验证 array('username','require','账号不能为空 ...
- 2015最流行的Android组件、工具、框架大全(转)
转自:2015最流行的Android组件.工具.框架大全 Android 是目前最流行的移动操作系统之一. 随着新版本的不断发布, Android的功能也日益强大, 涌现了很多流行的应用程序, 也催生 ...
- Angular1.0路由的Hashbang和HTML5模式
原文答主jupiter http://stackoverflow.com/questions/16677528/location-switching-between-html5-and-hashban ...
- Python—发邮件总结
来自: http://my.oschina.net/jhao104/blog/613774 1.登录SMTP服务器 首先使用网上的方法(这里使用163邮箱,smtp.163.com是smtp服务器地址 ...
- 【BZOJ1499】[NOI2005]瑰丽华尔兹 单调队列+DP
[BZOJ1499][NOI2005]瑰丽华尔兹 Description 你跳过华尔兹吗?当音乐响起,当你随着旋律滑动舞步,是不是有一种漫步仙境的惬意?众所周知,跳华尔兹时,最重要的是有好的音乐.但是 ...
- 【BZOJ3864】Hero meet devil DP套DP
[BZOJ3864]Hero meet devil Description There is an old country and the king fell in love with a devil ...