Make ExcerptHelper injectable into add-ons code (again?)

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Won't Do
    • None
    • Component/s: None

      NOTE: This suggestion is for Confluence Server. Using Confluence Cloud? See the corresponding suggestion.

      I have previously used com.atlassian.confluence.util.ExcerptHelper class in Confluence to create page exceprts based on "excerpt" macro.

      For some time now this stopped being possible via IoC injection.

      There are still Answers and developer-to-developer discussions around for older code base that it should be possible to use the class, but it seems to not be possible to have this class injected anymore.

      Atlassian's own code seems to be able to have it injected, but not plugins.

      During upgrade of one of our plugins to support 5.7 I was forced to replicate the code of ExcerptHelper in our own project, with changes since not all classes that relies on are available to plugins either.

      I do see in another Answer a piece of "normal" IoC setter code commented out in favor of lazy initialization via direct call to ContainerManager.getComponent("excerptHelper"). Not sure if it works in 5.7 as the date on the post is 2013.

      Does it have to be this hard? Can ExcerptHelper be marked as available for plugins in rederingContext.xml or something similar to CONF-22371 magic be done?

      I also note that often when a consumer of API like us wants an excerpt from a page developers will have to repeat the same pattern - use ExcerptHelper to extract "excerpt" macro content and if there is none, use something like com.atlassian.confluence.content.render.xhtml.view.excerpt.Excerpter (perfectly injectable) to fall back to another method - so perhaps it would be nice to supply an injectable helper class with aggregated functionality?

            Assignee:
            Unassigned
            Reporter:
            Ed Letifov [TechTime - New Zealand]
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: