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 官网代码很 ...
随机推荐
- 非常酷的word技巧---删除行前的空格
今天整理一篇文章的时间遇见一个问题,非常多行前的空格严重影响美观.搞计算机的就是爱折腾.于是做了各种尝试完美解决,以下把方法发布例如以下,事实上非常easy哦! 问题例如以下情况所看到的: 解决的方法 ...
- C#实现多级子目录Zip压缩解压实例 NET4.6下的UTC时间转换 [译]ASP.NET Core Web API 中使用Oracle数据库和Dapper看这篇就够了 asp.Net Core免费开源分布式异常日志收集框架Exceptionless安装配置以及简单使用图文教程 asp.net core异步进行新增操作并且需要判断某些字段是否重复的三种解决方案 .NET Core开发日志
C#实现多级子目录Zip压缩解压实例 参考 https://blog.csdn.net/lki_suidongdong/article/details/20942977 重点: 实现多级子目录的压缩, ...
- Mode Standby
Modern Standby 1.Connected Standby和 Connected Standby是Windows 8全新的电源管理系统,即当系统进入休眠状态时,应用程式虽处於暂停(suspe ...
- Hibernate学习三----------session详解
© 版权声明:本文为博主原创文章,转载请注明出处 如何获取session对象 1. openSession 2. getCurrentSession - 如果使用getCurrentSession需要 ...
- 图片压缩CompressUtil解析
CompressUtil 流程图: CompressUtil 类 具体解释 public class CompressUtil { /** * 终于封装的压缩方法 * @param imgPath * ...
- conda清华源 pip 清华源ubuntu 清华镜像 R代理以及包的安装
vim ~/.condarc channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/ - https:// ...
- 已知某公司总人数为W,平均年龄为Y岁(每年3月末计算,同时每年3月初入职新人),假设每年离职率为x,x>0&&x<1,每年保持所有员工总数不变进行招聘,新员工平均年龄21岁。 从今年3月末开始,请实现一个算法,可以计算出第N年后公司员工的平均年龄。(最后结果向上取整)。
// ConsoleApplication12.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" // ConsoleApplication1 ...
- 前端编程提高之旅(三)----浏览器兼容之IE6
在爱奇艺实习期间,乐帝主要负责移动端活动页面的制作,因为移动浏览器是随着智能手机兴起的,这就决定了移动端不会重蹈浏览器兼容问题的覆辙.一開始就比較好的支持web标准,而纵观整个互联网行业,移动web开 ...
- ubuntu 中文显示乱码问题 (转)
添加中文字符编码: $sudo vim /var/lib/locales/supported.d/local #添加下面的中文字符集 zh_CN.GBK GBK zh_CN.GB2312 GB2312 ...
- python 基础 8.1 r 正则对象
...