Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-29502

API: Please provide a method to initialize the ServletContextThreadLocal from a trigger plug-in

    XMLWordPrintable

Details

    • We collect Confluence feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

    Description

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

      I am currently writing a plug-in which shares pages by parsing incoming e-mail (https://github.com/schakko/Confluence-Mail-to-News-Plugin). The plug-in is realized as a trigger so there is no HttpServletContext available.

      For the plug-in I use the SharePageImpl.sharePage() method but the call results in a NullPointerException: createWebResourceDataSource() access the ServletContextThreadLocal which is not available.
      To solve this issue I have to use the deprecated API method ServletContextThreadLocal.setRequest(new MockHttpServletRequest()) with a mocked/stubbed instance of HttpServletRequest (https://github.com/schakko/Confluence-Mail-to-News-Plugin/blob/master/src/main/java/com/midori/confluence/plugin/mail2news/MailToBlogPostPublisher.java#L109).

      Please provide a method which initializes the ServletContextThreadLocal if a non-servlet plug-in runs or remove the @deprecated tag from ServletContextThreadLocal.setRequest().

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              3511ea2f06a2 Christopher Klein
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: