jahaziel17 / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

cannot use resource wildcards for the same classpath in multiple JARs #593

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create 2 JARs with resources at the same path - i.e. assets/css/
2. Create an application with wro4j that includes the JARs, and configure a 
group with a wildcard for the identical path - i.e. 
<css>classpath:assets/css/**.css</css>
3. Retrieve the group's generated CSS

What is the expected output? What do you see instead?

Expect to see the CSS from both JARs in the output, instead only see the CSS 
from the first JAR matched.

What version of the product are you using? On what operating system?

v1.5.0
OSX

Please provide any additional information below.

https://groups.google.com/forum/?fromgroups=#!topic/wro4j/MPCpyAnUbz4

Original issue reported on code.google.com by chad.san...@unboundid.com on 22 Oct 2012 at 10:50

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 23 Oct 2012 at 1:57

GoogleCodeExporter commented 8 years ago
Is there anybody willing to contribute with a fix for this issue? 

Original comment by alex.obj...@gmail.com on 30 Nov 2012 at 8:24

GoogleCodeExporter commented 8 years ago
Here is a quick workaround for issue. Its very hacky, but works.
I hope you will find a way to properly implement it in core.

The root problem to implement it properly is the fact that api always work with 
single file/jar.
In our case the problem is here:
WildcardStreamLocator#InputStream locateStream(final String uri, final File 
folder)

Also, group resource may be expanded only once, and cant work in "apend" way.

MultiJarClasspathUriLocator is almost a copy of ClasspathUriLocator, but it use
getClass().getClassLoader().getResources(fullPath); 
to resolve all affected jars. 
It supplies MultiFile instead of simple File into stream locator, which simply 
holds few files instead of one.
Also, default JarWildcardStreamLocator is substituted with 
MultiJarWildcardStreamLocator, which can work with multiply jars (knows about 
MultiFile).

This code may be used without library modification, just compile and add to 
classpath. New locator will be registered under classpath2 alias. To make it 
work just set it in priority with property:
uriLocators=servletContext,uri,classpath2

Original comment by vya...@gmail.com on 20 Mar 2013 at 5:06

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you very much. I'll take a look to your implementation and hopefully will 
add it to the core for next release.

Original comment by alex.obj...@gmail.com on 20 Mar 2013 at 5:13

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 28 May 2013 at 8:11

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 28 May 2013 at 9:04

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 8 Jun 2013 at 9:41

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 13 Sep 2013 at 3:53

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 5 Nov 2013 at 1:54

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 8 Jan 2014 at 3:12

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 21 Mar 2014 at 9:20

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 8 Apr 2014 at 9:56

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 18 Jun 2014 at 11:06