A plugin with httpServlet support

Hi all,

my plugin needs to get some http request from client to do sth (on openfire data). From openfire docs, “web directory is only for plugins that extend admin console”; but my plugin does not need the admin console, nor the openfire session (for this task of course).

any suggestions on how to implement this thing?

e.g.

http://example.com/blah?username=blah&action=mlah

I checked the openfire code,

admin console is also a plugin that uses Jetty. So creates a Jetty server instance.

I dont wanna create another, but there does not seem to be a way to get the server instance that adminPanel created, witout hacking the openfire code (which I dont want to do, to be able to keep up with updates).

Any suggestions after this update?

Hi Yigit,

Take a look at the source to either (or both) the Presence Service and User Service plugins to see how you can process HTTP requests.

Hope that helps,

Ryan

Everything you need to do is to mark you Servlet as accessible from outside AdminConsole. You can do that using AuthCheckFilter:

when creating your servlet:

AuthCheckFilter.addExclude(“pluginname/servlet”);

when unloading your plugin:

AuthCheckFilter.removeExclude(“pluginname/servlet”);

See PresenceService-Plugin for an example.

thanks guys,

I solved the problem as doing the same thing that presence plugin does.

btw, I just clicked on the wrong post the correct answer, sorry for that. both was very helpful…

Apologies for the stupid question but how can you tell the name of your plugin? i.e. in the presence plugin has this code:

AuthCheckFilter.addExclude(“presence/status”);

and the servlet is /status

So the name ‘presence’ is retrieved from somehere (but where?!)

Thanks

Got it, it’s the name of the jar of your plugin, lowercased.