powered by Jive Software

Having problem with plugin context path

Hi everyone,

I’m developing an Openfire’s plugin which provides a Web UI for user and is independent of Openfire Administration Console. Now I have some problems:

  1. Each time I access to my plugin page via URL: “http://myserver:9090/plugins/myplugin/”, an “un-managed” jsp/servlet (it is one of my jsp pages, consistent in every request) jumps out and handles the request which I’ve never configured this kind of stuff at any place! Could anyone explain this?

  2. In order to solve the above problem, my work-around is adding my own welcome files, therefore, I created a “WEB-INF/web-custom.xml” which contains:

<?xml version=‘1.0’ encoding=‘ISO-8859-1’?>

<!DOCTYPE web-app PUBLIC “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN” “http://java.sun.com/dtd/web-app_2_3.dtd”>

<web-app>

<welcome-file-list>

<welcome-file>welcome.jsp</welcome-file>

</welcome-file-list>

</web-app>

And you’ve known, it still doesn’t work!

  1. And in order to solve the above problem !http://www.igniterealtime.org/community/images/emoticons/silly.gif!, I tried another work-around in my plugin source:

public void initializePlugin(PluginManager manager, File pluginDirectory) {

AuthCheckFilter.addExclude(SMS_CONTEXT_PATH_URL);

PluginManager pluginManager = XMPPServer.getInstance().getPluginManager();

ContextHandlerCollection contexts = ((AdminConsolePlugin)pluginManager.getPlugin(“admin”)).getContexts();

//Context context = new WebAppContext(contexts, pluginDirectory.getParentFile().getAbsoluteFile() + File.separator + “webapp”, “/”);

Context context = new WebAppContext(pluginDirectory.getAbsolutePath(), “/”);

contexts.addHandler(context);

context.setWelcomeFiles(new String[]{“welcome.jsp”});

}

… And the Openfire server throws the following exception during the plugin’s initialization:

Error loading plugin: D:\Temp\OpenFire\plugins\sms

java.lang.IllegalArgumentException: Illegal context spec:null

at org.mortbay.jetty.handler.ContextHandlerCollection.mapContexts(ContextHandlerCo llection.java:82)

at org.mortbay.jetty.handler.ContextHandlerCollection.setHandlers(ContextHandlerCo llection.java:149)

at org.mortbay.jetty.handler.HandlerCollection.addHandler(HandlerCollection.java:1 97)

at org.mortbay.jetty.servlet.Context.<init>(Context.java:124)

at org.mortbay.jetty.servlet.Context.<init>(Context.java:73)

at org.mortbay.jetty.webapp.WebAppContext.<init>(WebAppContext.java:287)

at vn.semaphore.sms.Plugin.initializePlugin(Plugin.java:99)

And now I get stuck on it!

My developing environment is:

  • Openfire server 3.4.4, 01/17/2008.

  • JDK: Java version “1.6.0_03”, Java™ SE Runtime Environment (build 1.6.0_03-b05), Java HotSpot™ Client VM (build 1.6.0_03-b05, mixed mode)

  • OS: Windows Vista.

Ahhhhhhhhhhhhhh… I’ve found the problem!!

As I’ve checked the AuthCheckFilter, in doFilter, it contains the following:

HttpServletRequest request = (HttpServletRequest)req;

HttpServletResponse response = (HttpServletResponse)res;

// Reset the defaultLoginPage variable

String loginPage = defaultLoginPage;

if (loginPage == null) {

loginPage = request.getContextPath() + “/login.jsp”;

}

Hix, the “un-managed” jsp/servlet in my case is the “login.jsp”… It means everytime clients request the “http://…/plugins/sms/”, the Authentication filter redirects to /login.jsp?

Now I’m trying to find another work-around :(… Add my own filter?..

Anyone gives me a better solution?