I am trying to add Jersey restful service in my plugin. I am using Jersey 1.8. I followed this discussion http://community.igniterealtime.org/message/203902#203902 but my request giving me 404. Here is my code.I am try to deploy it in Openfire 3.7.0 its deployed properly.
// web-custom.xml
<?xml version="1.0" encoding="UTF-8"?>chatservice
Jersey Web Application
com.chatservice.chat.plugin.service.JerseyServletWrapper</servle t-class>
1
Jersey Web Application
/rest/*
/chatservice/rest/*
/chatservice/rest/hello
// servletWrapper
package com.chatservice.chat.plugin.service;
import com.chatservice.chat.plugin.ChatServiceApplication;
import com.sun.jersey.spi.container.servlet.ServletContainer;
public class JerseyServletWrapper extends ServletContainer {
private static final long serialVersionUID = 1L;
public JerseyServletWrapper() {
super(new ChatServiceApplication());
}
}
// Application
package com.chatservice.chat.plugin;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.core.Application;
import com.chatservice.chat.plugin.service.HelloWorldResource;
public class ChatServiceApplication extends Application {
private HashSet<Class<?>> classes = new HashSet>();
private HashSet singletones = new HashSet();
public ChatServiceApplication() {
super();
singletones.add(new HelloWorldResource());
}
@Override
public Set<Class<?>> getClasses() {
return this.classes;
}
@Override
public Set getSingletons() {
return this.singletones;
}
}
// Plugin
package com.chatservice.chat.plugin;
import java.io.File;
import org.jivesoftware.admin.AuthCheckFilter;
import org.jivesoftware.openfire.container.PluginManager;
import org.jivesoftware.util.Log;
public class ChatPlugin implements Plugin {
@Override
public void destroyPlugin() {
AuthCheckFilter.removeExclude(“chatservice/rest/*”);
}
@Override
public void initializePlugin(PluginManager pluginManager, File pluginDirectory) {
Log.info(“Starting Chat Plugin”);
AuthCheckFilter.addExclude(“chatservice/rest/*”);
}
}
I am accessing http://localhost:9090/plugins/chatservice/rest/hello, I am not getting any error in openfire log.