Aug 3, 2012 4:09 AM

How to do HTTP binding for Openfire plugin

This question has been Answered.

I'm using Openfire as the chat server for my company. And now I need to create a plugin for Openfire.

As I can see from other plugins, they can have HTTP binding to themself through port 7070. For example: http://example.com:7070/redfire where redfireis the name of the plugin.

The name of my plugin is toplug, so I want to be able to access the JSP pages of my plugin through:http://example.com:7070/toplug/index.jsp where 'index.jsp' is some example page.

But when I try to access my JSP pages through port 7070, the Jetty server (on which Openfire runs) always reports error 404 'page not found'. I guess this is because the binding to my folder which contains JSP pages hasn't been set. How to do this binding thing please?

Correct Answer by Dele Olajide  on Aug 3, 2012 6:54 AM
Dele Olajide

You do not need a plugin to access the web service for the http bing port. Just put your web pages in a folder under

 

OPENFIRE_HOME/openfire/resources/spank

 

and access with

 

http://your_server:7070/your_folder/your_page.html

 

Note that Openfire does not compile JSP pages unless you replace jasper-xxxx.jar files in the lib folder

 

 

If you still want to create a jetty web context (application) from your plugin, see source code of Redfire plugin

 

 

import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.webapp.WebAppContext;
 
.....
 
public void initializePlugin(PluginManager manager, File pluginDirectory)
  {
      ContextHandlerCollection contexts = HttpBindManager.getInstance().getContexts();
      context = new WebAppContext(contexts, pluginDirectory.getPath(), "/" + NAME);
      context.setWelcomeFiles(new String[]{"index.html"})
See the answer in context
  • Dele OlajideKeyContributor896 posts since 
    Apr 10, 2006

    You do not need a plugin to access the web service for the http bing port. Just put your web pages in a folder under

     

    OPENFIRE_HOME/openfire/resources/spank

     

    and access with

     

    http://your_server:7070/your_folder/your_page.html

     

    Note that Openfire does not compile JSP pages unless you replace jasper-xxxx.jar files in the lib folder

     

     

    If you still want to create a jetty web context (application) from your plugin, see source code of Redfire plugin

     

     

    import org.eclipse.jetty.server.handler.ContextHandlerCollection;
    import org.eclipse.jetty.webapp.WebAppContext;
     
    .....
     
    public void initializePlugin(PluginManager manager, File pluginDirectory)
      {
          ContextHandlerCollection contexts = HttpBindManager.getInstance().getContexts();
          context = new WebAppContext(contexts, pluginDirectory.getPath(), "/" + NAME);
          context.setWelcomeFiles(new String[]{"index.html"})
    





'OpenSource > Openfire' 카테고리의 다른 글

smack - chat state notification  (0) 2014.11.04
openfire - hessian RMI example in plugin  (0) 2013.08.09
file transfer - proxy ip를 잘 못 설정 하는 경우  (0) 2013.04.02
Openfire Properties  (0) 2013.03.12
Posted by linuxism
,