Hello guys, I need some help.
I'm developing a confluence server plugin and I need to get the confluence server id when the servlet url is hit. I haven't figured out yet how to do it. Is there any way to do that?
Thanks in advance,
Luís
Hi there,
You could try it with the ConfluenceInfo bean.
Thanks for your help.
I tried with no luck.
I tried this:
I18NBean a = null;
ConfluenceInfo ci = new ConfluenceInfo(a);
String serverID = ci.getServerId();
// serverID is null
However, all ci methods are returning null.
Any idea?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @luis,
I had the chance to unsuccessfully try this myself. But I figured out a way that works for me:
private ConfluenceSidManager sidManager;
sidManager.getSid()
Hope that works for you as well.
Kind Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Thor, I've tried it but with no luck :\
How do you inject the ConfluenceSidManager into your class constructor? Or how do you call the class constructor then?
If could share a code snippet of what you described working, that would be really amazing.
Thanks again.
Kind regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @luis,
Here is a good article about dependcy injection in plugins.
To inject it into your constructor (preferred way for v2 plugins) do this:
private ConfluenceSidManager sidManager;
...
...
public MyClass(ConfluenceSidManager sidManager) {
this.sidManager = sidManager;
}
To inject the manager via a setter (the default way to do this for v1 plugins) do this:
private ConfluenceSidManager sidManager;
...
...
public void setSidManager(ConfluenceSidManager sidManager) {
this.sidManager = sidManager;
}
...
Then you have to call the setter (e.g. if you are writing a macro inside the execute method):
setSidManager(ComponentLocator.getComponent(ConfluenceSidManager.class));
From now on you should be able to use the manager.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.