Orange-OpenSource / wro4j-taglib

This taglib makes it easier to work with wro4j and JSP
13 stars 5 forks source link

CDN support #9

Open simoami opened 11 years ago

simoami commented 11 years ago

Hello, Is it possible to have an option to specify external domain prefixes so to enable CDN support?

For instance, resources are typically served from http://domain-a.com/javascript/file1.js

It would be good to pass a domain "prefix" attribute per group to override the current domain. The same file would be downloaded as: http://domain-b.com/javascript/file1.js

I think this can be easily achieved with regular expressions.

tatablack commented 11 years ago

Just to make sure I understand: you are saying that the com.orange.wro.resource.domain property is not enough, because you need to load different groups from different CDNs?

simoami commented 11 years ago

Thanks for bringing it to my attention. For some reason I forgot that it is being supported.

However, I run into an error while attempting to use an external domain. The error is:

minimized file for group type 'CSS' for group 'login' was not found.
Caused by:

com.orange.wro.taglib.config.ConfigurationException: minimized file for group type 'CSS' for group 'login' was not found.
    at com.orange.wro.taglib.tag.IncludeTag.include(IncludeTag.java:141)
    at com.orange.wro.taglib.tag.IncludeTag.writeTag(IncludeTag.java:75)
    at com.orange.wro.taglib.tag.IncludeTag.doTag(IncludeTag.java:49)
    at org.apache.jsp.WEB_002dINF.jsp.login_jsp._jspx_meth_wro_style_0(login_jsp.java from :728)
    at org.apache.jsp.WEB_002dINF.jsp.login_jsp._jspService(login_jsp.java from :179)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109)

I still need to debug the issue, but was anyone successful in getting static urls to work? Should wro4j attempt to locate the minimized files in non-debug mode and when using static domains?

simoami commented 11 years ago

It seems to be hitting this exception:

    private void include(StringBuilder builder, FilesGroup group)
            throws ConfigurationException {
        String fileName = group.getMinimizedFile(getGroupType());
        if (fileName == null) {
            throw new ConfigurationException("minimized file for group type '"
                    + getGroupType() + "' for group '" + group.getName()
                    + "' was not found.");
        }
        writeLink(builder, fileName);
    }