You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Hendy Irawan (JIRA)" <ji...@apache.org> on 2014/07/09 21:35:04 UTC

[jira] [Created] (WICKET-5635) Provide a way to modify ResourceReferenceRegistry.DefaultResourceReferenceFactory externally to be used by wicket-bootstrap-less

Hendy Irawan created WICKET-5635:
------------------------------------

             Summary: Provide a way to modify ResourceReferenceRegistry.DefaultResourceReferenceFactory externally to be used by wicket-bootstrap-less
                 Key: WICKET-5635
                 URL: https://issues.apache.org/jira/browse/WICKET-5635
             Project: Wicket
          Issue Type: Improvement
          Components: wicket
    Affects Versions: 6.16.0
            Reporter: Hendy Irawan


As described in https://github.com/l0rdn1kk0n/wicket-bootstrap/issues/409#issuecomment-48505042 :

Add

{code}
    @Override
    protected ResourceReferenceRegistry newResourceReferenceRegistry() {
        return new LessAwareRR(super.newResourceReferenceRegistry());
    }

    private static class LessAwareRR extends ResourceReferenceRegistry {
        private final ResourceReferenceRegistry delegate;

        private LessAwareRR(ResourceReferenceRegistry delegate) {
            this.delegate = delegate;
        }

        @Override
        protected ResourceReference createDefaultResourceReference(ResourceReference.Key key) {
            if (key.getName().endsWith(".less")) {
                return new LessResourceReference(key);
            }
            return super.createDefaultResourceReference(key);
        }
    }
{code}

to WicketApplication.java and it starts to work as desired.

Another way to do the same is:

{code}
@Override
    protected ResourceReferenceRegistry newResourceReferenceRegistry() {
        return new ResourceReferenceRegistry(new LessRRFactory());
    }

    private static class LessRRFactory extends ResourceReferenceRegistry.DefaultResourceReferenceFactory {

        @Override
        public ResourceReference create(ResourceReference.Key key) {
            if (key.getName().endsWith(".less")) {
                return new LessResourceReference(key);
            } else {
                return super.create(key);
            }
        }
    }
{code}

Unfortunately at the moment there is no way to do this automatically with {{de.agilecoders.wicket.less.BootstrapLess#install(Appllication)}}.



--
This message was sent by Atlassian JIRA
(v6.2#6252)