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 官网代码很 ...
随机推荐
- linux:date命令(转)
在linux环境中,不管是编程还是其他维护,时间是必不可少的,也经常会用到时间的运算,熟练运用date命令来表示自己想要表示的时间,肯定可以给自己的工作带来诸多方便. 1.命令格式: date [参数 ...
- jQuery与ajax的应用(一)
<body> <div id="resText"></div> <div id="reshtml"></d ...
- Deploying Docker images via SSH
Original URL:https://advancedweb.hu/2015/04/14/deploying-docker-images-via-ssh/ Background When we b ...
- 制作个人开发IDE
1.打开VS2013,新建项目: 2.点击下一步,下一步.到达例如以下界面: 3.下一步 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdG90b3R ...
- Struts2学习四----------动态方法调用
© 版权声明:本文为博主原创文章,转载请注明出处 Struts2动态方法调用 - 默认:默认执行方法中的execute方法,若指定类中没有该方法,默认返回success <package nam ...
- Ajax请求的跨域(CORS)问题
用浏览器,通过XHR(XMLHttpRequest)请求向另外一个域名请求数据时.会碰到跨域(CORS)问题. CORS:Cross-Origin Resource Sharing 什么是跨域? 简单 ...
- Linux系统运维之路
九月份开始,半年内搞定运维,博客会慢慢的更新,vim编辑器,Nginx配置文件优化 运维基础 运维基础-Linux发展史.安装.基本操作 运维基础-用户和组管理 运维基础-文件权限管理 运维基础-进程 ...
- python中strip()函数的理解
1.strip()函数 函数原型 声明:s为字符串.rm为要删除的字符序列 s.strip(rm) :删除s字符串中开头.结尾处.位于 rm删除序列的字符 s.lstrip(rm) :删除s字符串中开 ...
- Mysql 5.7.18 利用 MySQL proxies_priv(模拟角色)实现类似用户组管理
利用 MySQL proxies_priv(模拟角色)实现类似用户组管理 角色(Role)可以用来批量管理用户,同一个角色下的用户,拥有相同的权限. MySQL5.7.X以后可以模拟角色(Role)的 ...
- 【WPF学习笔记】之如何通过后台C#代码添加(增/删/改按钮)实现对SQLServer数据库数据的更改
首先,需要连接SQLServer数据库的服务器名称server.数据库名database.数据库用户名uid以及密码pwd,如下图: 然后需要以下数据库SQL代码段,还有一个myHelper.cs代码 ...