Uploaded image for project: 'Velocity Tools'
  1. Velocity Tools
  2. VELTOOLS-105

MessageTool doesn't support MessageResources the same way Struts does in terms of scoping

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4, 2.0
    • 2.0, 2.x, 3.0
    • VelocityStruts
    • None

    Description

      We have an application that, for various reasons, inserts it's own MessageResources object into the Request in the RequestProcessor.

      We do not have message-resource defined in the struts config.

      This works fine in Struts, because Struts (at least 1.2.9) defaults 'bundle' to Globals.MESSAGES_KEY if it's null and checks the page, request, and application scopes in that order (see TagUtils)

      StrutsUtils has similar behavior. Unfortunately, MessageResourcesTool prevents it from working because getResources() returns an error if 'bundle' is null and there was not a MessageResources in the ServletContext.

      I fixed this by simply changing MessageResourcesTool to return the locally cached 'resources' object if 'bundle' is null and resources is not, but otherwise to call StrutsUtils and let it find the MessageResources. To be completely compatible with Struts, it seems like StrutsUtils also needs to be modified to check the page scope before the request scope.

      2.0 is different, but looks like it would still suffer from this problem in our application.

      Attachments

        1. MessageResourcesTool.patch1
          0.5 kB
          Cott Lang

        Activity

          People

            Unassigned Unassigned
            cott@internetstaff.com Cott Lang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: