Details
-
Suggestion
-
Resolution: Answered
-
None
-
None
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
- relates to
-
CONFCLOUD-29502 API: Please provide a method to initialize the ServletContextThreadLocal from a trigger plug-in
- Closed