Tapestry
  1. Tapestry
  2. TAPESTRY-1396

Specless components in libraries don't get their assets properly resolved

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.1
    • Fix Version/s: 4.1.2
    • Component/s: Framework
    • Labels:
      None

      Description

      We are trying to move a little library of ours to Java-5 with full usage of annotations, without jwc-files. While a component itself is recognised this way. Asset-resolution relative to the (non-existing) specification doesn't work.

        Issue Links

          Activity

          Hide
          Jesse Kuhnert added a comment -

          Should work more intuitively now.

          Show
          Jesse Kuhnert added a comment - Should work more intuitively now.
          Hide
          Marcus Schulte added a comment -

          Thanks for the quick fix! However I'm not yet entirely happy with it.
          Currently the template is resolved relative to the library's spec. If you specify sub-packages for your components or pages this is a bit counter-intuitive.
          As far as I can see org.apache.tapestry.resolver.ComponentSpecificationResolverImpl.searchForComponentClass() should set the virtual ".jwc" relative to the component-class not relative to the namespaceResource.

          Show
          Marcus Schulte added a comment - Thanks for the quick fix! However I'm not yet entirely happy with it. Currently the template is resolved relative to the library's spec. If you specify sub-packages for your components or pages this is a bit counter-intuitive. As far as I can see org.apache.tapestry.resolver.ComponentSpecificationResolverImpl.searchForComponentClass() should set the virtual ".jwc" relative to the component-class not relative to the namespaceResource.
          Hide
          Jesse Kuhnert added a comment -

          That makes sense to me. Let's see how it works for you.

          Show
          Jesse Kuhnert added a comment - That makes sense to me. Let's see how it works for you.
          Hide
          Marcus Schulte added a comment -

          Not very well, I'm afraid. Now it doesn't find specless component's templates in WEB-INF anymore. I can track this down more thoroughly tomorrow if that would help ...

          Show
          Marcus Schulte added a comment - Not very well, I'm afraid. Now it doesn't find specless component's templates in WEB-INF anymore. I can track this down more thoroughly tomorrow if that would help ...
          Hide
          Jesse Kuhnert added a comment -

          Duh sorry.....I'm "getting" it more clearly now. Just so I know "for sure" this next time around, can you give me a very precise example of one component/page so I can try to re-produce? Ie component is in sub-package x.yoo and I'd like it to resolve the template under WEB-INF/x/yoo/<component name>.html. .

          Show
          Jesse Kuhnert added a comment - Duh sorry.....I'm "getting" it more clearly now. Just so I know "for sure" this next time around, can you give me a very precise example of one component/page so I can try to re-produce? Ie component is in sub-package x.yoo and I'd like it to resolve the template under WEB-INF/x/yoo/<component name>.html. .
          Hide
          Jesse Kuhnert added a comment -

          I'm not going to even try, just see if it works.

          Show
          Jesse Kuhnert added a comment - I'm not going to even try, just see if it works.
          Hide
          Marcus Schulte added a comment -

          I'm feeling slightly bad re-opening this one again. But anyway: It works mostly great, except for one minor glitch:
          When TemplateSourceImpl.findSpeclessTemplate looks in the context (not WEB-INF), the URL lacks the leading slash resulting in some ugly stack-traces being written to the log.

          I think in line 297 of TemplateResourceImpl.java, we want

          if (_contextAssetFactory.assetExists("/"+component.getSpecification(), context, templateName, locale)) {

          instead of

          if (_contextAssetFactory.assetExists(component.getSpecification(), context, templateName, locale)) {

          The constant "WEB_INF" already contains the leading slash, so no problem there.

          Show
          Marcus Schulte added a comment - I'm feeling slightly bad re-opening this one again. But anyway: It works mostly great, except for one minor glitch: When TemplateSourceImpl.findSpeclessTemplate looks in the context (not WEB-INF), the URL lacks the leading slash resulting in some ugly stack-traces being written to the log. I think in line 297 of TemplateResourceImpl.java, we want if (_contextAssetFactory.assetExists("/"+component.getSpecification(), context, templateName, locale)) { instead of if (_contextAssetFactory.assetExists(component.getSpecification(), context, templateName, locale)) { The constant "WEB_INF" already contains the leading slash, so no problem there.
          Hide
          Jesse Kuhnert added a comment -

          Feel free to re-open as often as needed. I'll get this bitch one of these times.

          Show
          Jesse Kuhnert added a comment - Feel free to re-open as often as needed. I'll get this bitch one of these times.
          Hide
          Marcus Schulte added a comment -

          That one did it, thanks a lot!

          Show
          Marcus Schulte added a comment - That one did it, thanks a lot!

            People

            • Assignee:
              Jesse Kuhnert
              Reporter:
              Marcus Schulte
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development