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?
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"})
- Aug 3, 2012 6:54 AM (in response to Paul Dinh)Correct AnswerRe: How to do HTTP binding for Openfire plugin
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"})
- Report Abuse
- Like (1)
- Aug 3, 2012 9:48 PM (in response to Dele Olajide)Re: How to do HTTP binding for Openfire plugin
thanks dele, however, by this method i can only access pure html or data files.
is it able to access JSP files also?
i put the JSP files in my plugin folder, but [ant plugins] doesn't compile it at all.
it only compiles those JSP files in 'my-plugin/src/web', these files are for admin console,
not for opening through public port 7070.
- Report Abuse
- Like (0)
- Aug 7, 2012 5:05 AM (in response to Paul Dinh)Re: How to do HTTP binding for Openfire plugin
this thread solves the problem by allowing public access thru' port 9090
http://community.igniterealtime.org/thread/40008
1) in your plugin, you need the following:
private static final String URL = "userservice/sign-in.jsp"; // replace with your plugin/your.jsp
In init() function I have to add:
AuthCheckFilter.addExclude(URL);And in destroy():
AuthCheckFilter.removeExclude(URL);
2) In the .jsp page, you need the following:
<code>
<meta content="none" name="decorator" />
</code>If you don't have this meta tag in your jsp, you will get the following error:
Exception:
java.lang.NullPointerException
'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 |