Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1307

autolinked resources have locale appended

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.3.0-final, 1.3.1
    • 1.3.2
    • wicket
    • None

    Description

      For a resource that does not have a locale-specific file, it should be appended to the resource key. This works correctly for the first request to a page with the autolinked resource; you get a file name that matches the one in the sources. But on all following requests a locale (like _en_US) will be inserted into the name. While the resource can be served (because it's been added to the shared resource pool) this name has a significant downside. It can not be resolved in reverse. Therefore, if the server is restarted and a client already knows of that resource location including the _en_US and requests it before requesting the page that auto-link it, a 404 such as this is returned:

      Unable to find package resource [path = ts4/web/wicket/component/FeedbackPanel_en_US.css, style = null, locale = null]

      Futhermore, all future requests will fail, even after the page with the component has rendered, because the bad resource specifier has been added to the pool.

      The reason for this behavior is complicated, but it comes down to this static method:

      PackageResource.get(final Class scope, final String path, final Locale locale, final String style)

      Not only goes it "get" the resource, it adds it to the resource pool. The autolinker, in the course of finding the right resource (with a locale matching actual file names) inadvertently adds the wrong resource by trying to get it as a test. It discovers the right resource and serves it with that name on the first request, but following that it is able to find the resource in the pool with the wrong name and so serves it in that manner.

      Attachments

        1. resource.patch
          0.5 kB
          Nathan Hamblen

        Activity

          People

            Unassigned Unassigned
            n8han Nathan Hamblen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: