This server will be upgraded at 3pm Sydney time on December 3rd (December 2nd, 8pm PST) and will be down for up to 30 minutes.
This documentation relates to the latest version of Confluence.
If you are using an earlier version, please go to the documentation home page and select the relevant version.

Confluence Developer FAQ

All Versions
Click for all versions
Confluence 2.10 Documentation

Index

This is a constantly updated FAQ listing questions and answers asked by people developing Confluence plugins and working with the Confluence code base in general. For general questions, check Confluence Main FAQ.

If you have a question, please ask it as a comment and someone from Atlassian will reply. Comment threads will gradually be merged back into this FAQ as needed. Please try to be as specific as possible with your questions.

Questions

How Do I find enabled and disabled plugins in the Database?
Encrypting error messages in Sybase
How do I get hold of the HttpServletRequest?
What class should my XWork action plugin extend?
What class should my macro extend?
What is the best way to load a class or resource from a plugin?
Disable "Remember my login on this computer"
How do I prevent my rendered wiki text from being surrounded by paragraph tags?
How do I get the base URL and ContextPath of a Confluence installation?
How do I convert wiki text to HTML?
How do I autowire a component?
How do I associate my own properties with a ContentEntityObject?
How do I display the Confluence System Classpath?
How do I disable RSS Feeds?
How do I load a resource from a plugin?
How does RENDERMODE work?
How do I get my macro output exported to HTML and PDF?
How do I get a reference to a component?
I am trying to compile a plugin, but get an error about the target release
Within a Confluence macro, how do I retrieve the current ContentEntityObject?
How do I... find unused spaces
How do I configure Confluence to use GMail as the mail server
What is Bandana? One form of Confluence Persistence
How do I find information about lost attachments?
How do I find the logged in user?
How do I use HTTPS for login only?
Enabling Developer Mode
How do I change the default polling time for email in Confluence?
What's the easiest way to render a velocity template from Java code?
How do I get the location of the confluence.home directory?
How do I get the information about Confluence such as version number, build number, build date?
Disable Velocity Caching
How do I tell if a user has permission to...?
HTTP Response Code Definitions
How do I make my attachments open in a new window or a tab?

Labels

plugin plugin Delete
macro macro Delete
spring spring Delete
faq faq Delete
development development Delete
plugins plugins Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Disable "Remember my login on this computer"
Disable Velocity Caching
Enabling Developer Mode
Encrypting error messages in Sybase
How does RENDERMODE work?
How do I... find unused spaces
How do I associate my own properties with a ContentEntityObject?
How do I autowire a component?
How do I change the default polling time for email in Confluence?
How do I configure Confluence to use GMail as the mail server
How do I convert wiki text to HTML?
How do I disable RSS Feeds?
How do I display the Confluence System Classpath?
How Do I find enabled and disabled plugins in the Database?
How do I find information about lost attachments?
How do I find the logged in user?
How do I get a reference to a component?
How do I get hold of the HttpServletRequest?
How do I get my macro output exported to HTML and PDF?
How do I get the base URL and ContextPath of a Confluence installation?
How do I get the information about Confluence such as version number, build number, build date?
How do I get the location of the confluence.home directory?
How do I load a resource from a plugin?
How do I make my attachments open in a new window or a tab?
How do I prevent my rendered wiki text from being surrounded by paragraph tags?
How do I tell if a user has permission to...?
How do I use HTTPS for login only?
HTTP Response Code Definitions
I am trying to compile a plugin, but get an error about the target release
What's the easiest way to render a velocity template from Java code?
What class should my macro extend?
What class should my XWork action plugin extend?
What is Bandana? One form of Confluence Persistence
What is the best way to load a class or resource from a plugin?
Within a Confluence macro, how do I retrieve the current ContentEntityObject?
  1. Sep 29, 2005

    Dan Hardiker says:

    h3 QUESTION: How to access the renderContext of a decorator In the main.vmd, I ...

    h3 QUESTION: How to access the renderContext of a decorator

    In the main.vmd, I have a section that I would like to render as wiki text, in order to do this I need access to a renderContext to pass in to a helper.

    Charles has said that it is possible, but heavily discouraged it. With that in mind, I would still like to know how to do it (or an alternative method to achieve what I want). See mail 133426.

    1. Oct 03, 2005

      Charles Miller says:

      I'm not sure this qualifies as an FAQ. You can get the renderContext out of an...

      I'm not sure this qualifies as an FAQ.

      You can get the renderContext out of any ContentEntityObject using toRenderContext() (new PageContext(obj) does the same thing). There's no set way in a decorator, however, to say "Get the renderContext of the currently-being-displayed CEO".

      1. Oct 04, 2005

        Dan Hardiker says:

        I think a more accurate question is, from any given velocity decorator file (glo...

        I think a more accurate question is, from any given velocity decorator file (global.vmd, space.vmd, page.vmd ...) - how do I get the currently-being-displayed CEO?

        $page gives me the page in side of page.vmd (so I can use $page.toRenderContext() or similar), but of course that doesn't work in space.vmd.

        If my question is fundamentally wrong I apologise - what I want to do is 2 fold:

        1. Get hold of the Velocity Context variables so I can parse a custom string, as if it was injected directly into the vmd itself (equivelant of #parse "string-content-instead-of-filename")
        2. Get hold of the Render Context so that the result from the Velocity parsing above can be rendered as wiki markup > html output.

        I hope that makes more sense!

        1. Oct 09, 2005

          Charles Miller says:

          As I said in the previous comment, there's no set way to get the currently-being...

          As I said in the previous comment, there's no set way to get the currently-being-displayed CEO in a decorator. It would make sense to have such a method on the theme helper object somewhere. For now, you could try a process of elimination: try in order

          1. $helper.page (which actually returns an AbstractPage which could either be a Page or BlogPost object)
          2. $helper.action.mail
          3. $helper.action.personalInformationEntity
          4. $helper.space.description (This may be not necessarily be what is being viewed, so you might want to skip this as a fallback)

          If all these return null, you're looking at a global page with no space or entity to look at.

          In main.vmd, however, you're out of luck. By the time SiteMesh hits main.vmd, most of the context has been lost, except for what has been passed up from the other decorators or templates inside <content> blocks.

  2. Oct 11, 2005

    Laura Kolker says:

    is 'myObject' supposed to be the class I want to contain autowire objects, or t...

    is 'myObject' supposed to be the class I want to contain autowire objects, or the object I want to be autowired?

    The latter - I've updated the document.

    Hmm.. I must be missing something. I've tried both:

    • UserAccessor userAccessor = (UserAccessor) ContainerManager.getComponent("userAccessor");
    • bucket.container.ContainerManager.autowireComponent(userAccessor);

    and I get NullPointerExceptions.

    Could you give a more in depth example?

    Thanks.

  3. Nov 10, 2005

    Dan Hardiker says:

    QUESTION: How do I persist a "Request" level object? I am currently using Servl...

    QUESTION: How do I persist a "Request" level object?

    I am currently using ServletActionContext.getRequest().setAttribute() (and the appropriate getter), however there are cases where the request will not exist (eg: when the macro is rendered from a decorator (like in the LeftNav theme), or when exporting to PDF).

    What should I use? Perhaps the RenderContext (or one of its ancestors) should contain the ability to set/get attributes?

    If this is the case then I'll file a JIRA support issue.

    1. Nov 14, 2005

      Jens Schumacher says:

      Dan, perhaps you can tell us what you are trying to achieve and we can think ab...

      Dan,

      perhaps you can tell us what you are trying to achieve and we can think about a solution for you problem. However, we probably shouldn't discuss it in this comment thread, so drop us an email.

      Cheers,
      Jens

  4. Nov 23, 2005

    Bob Swift says:

    I have a related question. There seems to be an incompatibility between 1.4 and...

    I have a related question. There seems to be an incompatibility between 1.4 and 2.0 in that ServletActionContext.getRequest() returns null in 2.0 in cases that worked in 1.4. For instance if the preview tab is selected, it is null. Interestingly, in a comment where you are allowed to press the preview button, the button works but the preview tab does not (ie. returns null). Why is it incompatible and what recommendations are there for macro writers? Thanks.

    1. Nov 24, 2005

      Charles Miller says:

      The general rule is: assume that ServletActionContext.getAnything() will return ...

      The general rule is: assume that ServletActionContext.getAnything() will return null. There are several situations in which macros will be rendered without the ServletActionContext being populated, whether it be because the request hasn't come in via Webwork, as is the case with AJAX requests that are routed through the DWR servlet, or because the request is being rendered for something like an email which doesn't have a web context to begin with.

      The ServletActionContext should always be considered a bonus - if it's populated, you can do something useful with it, but you shouldn't count on its existence.

      1. Dec 03, 2005

        Bob Swift says:

        Charles, thanks. Seems like ConfluenceMockServletRequest() serves similar purpo...

        Charles, thanks. Seems like ConfluenceMockServletRequest() serves similar purpose for getting things like context path - getContextPath().

  5. Dec 08, 2005

    Bob Swift says:

    How do you add a new section to the notation guide? If I don't used an existing...

    How do you add a new section to the notation guide? If I don't used an existing section (like Advanced) then the macro help doesn't show up anywhere.

    1. Dec 08, 2005

      David Peterson [CustomWare] says:

      As far as I know, it's currently not possible without source hacking. I've wante...

      As far as I know, it's currently not possible without source hacking. I've wanted the same thing on several occasions (eg. Scaffolding). Vote here.

  6. Jan 15, 2006

    Othman Alaoui says:

    The following comments I posted at http://confluence.atlassian.com/display/CONFE...

    The following comments I posted at http://confluence.atlassian.com/display/CONFEXT/Vote+Macro?focusedCommentId=152965#comment-152965 might be of relevance here:

    Ok it looks to me like the behavior of AbstractHtmlGeneratingMacro has changed from what it was in 1.3: basically the body that's provided to the macro (through MacroParameter) seems to be raw HTML instead of raw wiki text as in the past. Not sure if this was intended by the Atlassian crew and/or why it was done.
    As a result, it seems the only way out is for this macro to be rewritten for 2.x, by extending BaseMacro and use RenderMode.NO_RENDER (ie. no rendering of wiki into HTML).

    Am I right about this? If so, it might be worth documenting on this page. I know it wouldn't matter for new macros but it might be useful to know for legacy macros (to determine whether they might have to be rewritten).

  7. Jan 30, 2006

    Ersin Er says:

    Is there an available BNF/EBNF/or any else grammar for Confluence wiki format ?

    Is there an available BNF/EBNF/or any else grammar for Confluence wiki format ?

    1. Jan 31, 2006

      Tom Davies says:

      No, Confluence wiki format is converted to HTML via regular expressions, not via...

      No, Confluence wiki format is converted to HTML via regular expressions, not via parsing. This allows any markup to produce sensible HTML without the problems that a parser would have trying to recover from errors.

  8. Feb 23, 2006

    Brian Sensale says:

    Is it possible to access classes from one plugin jar in another?  I'm tryin...

    Is it possible to access classes from one plugin jar in another?  I'm trying to write an extension of another plugin by extending a Base class, but when I try to upload my JAR, I'm getting a ClassNotFoundException.  Short of combining the two plugins together, is there any way to access classes written for one plugin in another?

    1. Feb 23, 2006

      David Peterson [CustomWare] says:

      The only way to do this that I'm aware of is for at least one of the plugins to ...

      The only way to do this that I'm aware of is for at least one of the plugins to have been installed by putting it into WEB-INF/lib instead of uploading it. So, if plugin-a.jar depends on classes in plugin-b.jar, plugin-b.jar needs to be installed into WEB-INF/lib. If plugin-b.jar also depends on classes in plugin-a.jar, then both plugins will have to be installed into WEB-INF/lib.

      This is due to the way the class loader for uploaded plugins works. There are some ideas bouncing around to improve the situation, but the scenario you described is unlikely to be resolved any time soon, unfortunately.

      1. Feb 23, 2006

        Brian Sensale says:

        Thanks...dropping it in web-inf/lib did the trick.

        Thanks...dropping it in web-inf/lib did the trick.

  9. Apr 04, 2006

    Evan Light says:

    How do I programatically remove and add attachments to a page in Confluence? &n...

    How do I programatically remove and add attachments to a page in Confluence?

     Say I use a page as an informal document (i.e., word, excel, powerpoint, etc.) repository.  I also have a proper document repository outside of Confluence.  How would I update the page in Confluence programatically, containing these documents as attachments, with a new set of attachments?

    1. Oct 12

      Guy Fraser says:

      There are a number of options: WebDAV plugin: Confluence WebDAV Plugin Perl XM...

      There are a number of options:

      WebDAV plugin: Confluence WebDAV Plugin

      Perl XML-RPC Client: Perl XML-RPC client

      Multiple Attachments Uploader: Multiple Attachments Upload Client

      Confluence file uploaded: Confluence File Uploader

      1. Mar 27, 2008

        Bob Swift says:

        Or Confluence Command Line Interface