博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
openfire插件开发环境
阅读量:4703 次
发布时间:2019-06-10

本文共 6222 字,大约阅读时间需要 20 分钟。

创建java工程

SamplePlugin:

package com.hoo.server.plugin;import java.io.File;import org.jivesoftware.openfire.XMPPServer;import org.jivesoftware.openfire.container.Plugin;import org.jivesoftware.openfire.container.PluginManager;public class SamplePlugin implements Plugin {     private XMPPServer server;        @Override    public void initializePlugin(PluginManager manager, File pluginDirectory) {        server = XMPPServer.getInstance();        System.out.println("初始化…… 安装插件!");        System.out.println(server.getServerInfo());    }     @Override    public void destroyPlugin() {        System.out.println("服务器停止,销毁插件!");    }}

web-custom.xml 为空

plugin.xml

com.hoo.server.plugin.SamplePlugin
SimplePlugin
This is the my sample plugin.
1.0
28/03/2014
http://127.0.0.1:9090/openfire/plugins.jsp
3.9.1
gpl

build.properties:

java.home=/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Hometomcat.home=/Users/hujihong/Desktop/java_tools/apache-tomcat-6.0.39# If you want to build a plugin, please set the value to the plugin name.# Note:The plugin name must is the same as the plugins folder.plugin.name=sample

build.xml

 

 增加servlet

package com.hoo.server.plugin;import java.io.IOException;import java.io.PrintWriter;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;public class SampleServlet extends HttpServlet {        private static final long serialVersionUID = -5404916983906926869L;     @Override    public void init() throws ServletException {        super.init();    }        @Override    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {                response.setContentType("text/plain");        PrintWriter out = response.getWriter();        System.out.println("请求SampleServlet GET Method");        out.print("请求SampleServlet GET Method");        out.flush();        out.close();    }     @Override    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {                response.setContentType("text/plain");        PrintWriter out = response.getWriter();        System.out.println("请求SampleServlet GET Method");        out.print("请求SampleServlet POST Method");        out.flush();        out.close();    }     @Override    public void destroy() {        super.destroy();    }}

在web-custom.xml中增加:

SampleServlet
com.hoo.server.plugin.SampleServlet
SampleServlet
/servlet

打包发布后: 可以访问 ( 也可以访问)

增加jsp

 在 web目录下增加sample-service.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>      hello world: 你好openfire    

hello world jsp!! SampleServlet

jive-contentBoxHeader
jive-contentBox
 sss a b
asdf asdf asdf
asdf asdf asdf
asdf asdf asdf

在plugin.xml中增加:

打包发布运行效果:

 

 

 

 

 

 

 

转载于:https://www.cnblogs.com/hujihon/p/3699785.html

你可能感兴趣的文章
31、任务三十一——表单联动
查看>>
python之hasattr、getattr和setattr函数
查看>>
maven使用阿里镜像配置文件
查看>>
Copy code from eclipse to word, save syntax.
查看>>
arguments.callee的作用及替换方案
查看>>
PHP echo 和 print 语句
查看>>
第一讲 一个简单的Qt程序分析
查看>>
Centos 6.5下的OPENJDK卸载和SUN的JDK安装、环境变量配置
查看>>
poj 1979 Red and Black(dfs)
查看>>
【.Net基础03】HttpWebRequest模拟浏览器登陆
查看>>
zTree async 动态参数处理
查看>>
Oracle学习之常见错误整理
查看>>
数据库插入数据乱码问题
查看>>
altium annotate 选项设置 complete existing packages
查看>>
【模式识别与机器学习】——SVM举例
查看>>
【转】IT名企面试:微软笔试题(1)
查看>>
IO流入门-第十章-DataInputStream_DataOutputStream
查看>>
DRF的分页
查看>>
Mysql 模糊匹配(字符串str中是否包含子字符串substr)
查看>>
python:open/文件操作
查看>>