google-code-export / wiquery

Automatically exported from code.google.com/p/wiquery
MIT License
1 stars 1 forks source link

Reading resources in WiQueryMergedStyleSheetResourceReference #196

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When looping over the ResourceReference in newResourceStream(), why don't you 
use the ResourceReference directly when looking for the IResourceStream ?

temp = Streams.readString(
                        getClass().getResourceAsStream(
                                "/" + Packages.absolutePath(
                                        ref.getScope(), "") 
                                        + "/" + ref.getName()));

replaced by

InputStream resourceStream = 
ref.getResource().getResourceStream().getInputStream();

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

Please provide any additional information below.
I saw that there's an enhancement in 1.2.4 which uses the 
ResourceStreamLocator, but it's not sufficient because it doesn't take the 
style/variation and Locale of the original resource.

Here is my solution:
(it uses the markupEncoding settings, not sure that's a good point, but not 
using an encoding can be problematic)

// we look for the stream, passing thru the Wicket locator process
                InputStream resourceStream = ref.getResource().getResourceStream().getInputStream();
                // hum, not good to uncompress, but how to achieve this since the CompressingResourceStream is protected ?
                if (ref.getResource() instanceof CompressedPackageResource) {
                    resourceStream = new GZIPInputStream(resourceStream);
                }
                temp = Streams.readString(resourceStream, Application.get().getMarkupSettings().getDefaultMarkupEncoding());

Original issue reported on code.google.com by guiom.mary@gmail.com on 27 Jun 2011 at 8:07

GoogleCodeExporter commented 9 years ago
Will apply to trunk (1.2.5).

in wiquery 1.5 merged resources are no longer possible with wiquery, this 
should be handled by/using wicket.

Original comment by hielke.hoeve on 16 Aug 2011 at 5:20

GoogleCodeExporter commented 9 years ago

Original comment by hielke.hoeve on 17 Aug 2011 at 8:03