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

Remove superfluous call to ResourceReference#getResource() in ResourceMapper when trying to map the resource URL

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.3, 6.0.0-beta1
    • Fix Version/s: 1.5.4, 6.0.0-beta1
    • Component/s: wicket
    • Labels:
      None

      Description

      The getResource() method is being called for a mounted ResourceReference even when the url does not match. So far it seems to only happen when some wicket Ajax is included in the page. To get around the problem, I've added a check on my ResourceReference that looks for the mounted name in the request url but it seems like the mounting should handle that.

      To reproduce the error:
      1. Call mountResource("uploadedfiles", MyResourceReference.class);
      2. Add an AjaxFallbackLink to a page
      3. In MyResourceReference getResource() method return null;
      4. Run the application and open the page with an AjaxFallbackLink and you will get
      java.lang.NullPointerException
      at org.apache.wicket.request.mapper.ResourceMapper.mapHandler(ResourceMapper.java:167)
      at org.apache.wicket.request.mapper.CompoundRequestMapper.mapHandler(CompoundRequestMapper.java:156)
      at org.apache.wicket.request.cycle.RequestCycle.mapUrlFor(RequestCycle.java:401)
      at org.apache.wicket.request.cycle.RequestCycle.urlFor(RequestCycle.java:485)
      at org.apache.wicket.markup.html.internal.HeaderResponse.renderJavaScriptReference(HeaderResponse.java:205)
      ...

      The class org.apache.wicket.request.mapper.ResourceMap calls the getResource() (line 167) method even though the url does not match the mounted name.

        Attachments

        1. resource_example.zip
          66 kB
          Philip McCullick

          Activity

            People

            • Assignee:
              pete Peter Ertl
              Reporter:
              pcmccull Philip McCullick
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: