XWiki Platform
  1. XWiki Platform
  2. XWIKI-7189

URLs created by mailsender plugin called from a scheduler script can have a wrong context path


    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.2, 3.3-milestone-2
    • Fix Version/s: 3.3-rc-1, 3.2.1
    • Component/s: Mail, Scheduler
    • Labels:
    • Difficulty:
    • Similar issues:
      XWIKI-13435Incorrect domain name in external URL generated from a scheduler job
      XWIKI-8872MessageTool can read from the wrong context in scheduler jobs or threads
      XWIKI-6460External URLs generated from scheduler jobs can be wrong
      XWIKI-12464REST script service should provide URL path instead of external URL by default
      XWIKI-14339Broken (relative) links generated by the new mailsender
      XWIKI-13920When in path based mode URLs to main wiki might be wrong
      XWIKI-8926WatchList should use the same Velocity Context as the one used by other Scheduler jobs
      XWIKI-7676The Annotations REST resources do not set the context to the wiki and page where the REST call was made
      XWIKI-12866The new URL normalizer uses the wrong context path when used by background jobs
      XWIKI-4610Wrong context usage in the Query plugin


      This happens when having XWiki as the ROOT webapp.

      The scenario is the following :

      • Scheduler job calls mailsender.sendMailFromTemplate
      • mail sender creates a new ExternalServletURLFactory, initialized with the calling context, which has a XWikiServletRequestStub as request
      • URL factory initialization calls XWiki#getWebAppPath to get the context path
      • #getWebAppPath calls contextPath = context.getRequest().getContextPath(); which generates a NPE
      • ... NPE is caught and a wrong context path is computed from the context URL, base on context.getURL().getPath();

      For example, <host>/bin/bin/Sandbox/Test, when the servlet path is the standard one.



          • Assignee:
            Jerome Velociter
            Jerome Velociter
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created:
              Date of First Response: