You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Robert Hannebauer <ro...@hannebauer.org> on 2016/12/20 20:42:31 UTC

jquery-ui.css and CSSURLRewriter

Hello,

i'm playing with webjars (https://github.com/eddyson-de/tapestry-webjars) and jquery-ui. Everything work fine, except when i try to use the jquery-ui.css.

It took me some time to understand the following error message, while trying to load the css file:

Caused by: java.lang.RuntimeException: Unable to locate asset 'webjars:META-INF/resources/webjars/jquery-ui/1.12.1/%22images%2Fui-icons_555555_256x240.png%22'
(the file does not exist).
    at org.apache.tapestry5.internal.services.AssetSourceImpl.getLocalizedAssetFromResource(AssetSourceImpl.java:390)
    at org.apache.tapestry5.internal.services.AssetSourceImpl.getAssetInLocale(AssetSourceImpl.java:305)
    at org.apache.tapestry5.internal.services.AssetSourceImpl.getAsset(AssetSourceImpl.java:131)
    at $AssetSource_25dc8e7415b4a.getAsset(Unknown Source)
    at org.apache.tapestry5.internal.services.assets.CSSURLRewriter.replaceURLs(CSSURLRewriter.java:177)
    at org.apache.tapestry5.internal.services.assets.CSSURLRewriter.access$100(CSSURLRewriter.java:46)
    at org.apache.tapestry5.internal.services.assets.CSSURLRewriter$1.perform(CSSURLRewriter.java:109)
    at org.apache.tapestry5.internal.services.assets.CSSURLRewriter$1.perform(CSSURLRewriter.java:104)
    at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.perform(OperationTrackerImpl.java:110)

The file %22images%2Fui-icons_555555_256x240.png%22  does really not exists.

Playing with SymbolConstants.STRICT_CSS_URL_REWRITING does not really help, because the CSSURLRewriter fails too early.

The root cause is the *comment* header of  jquery-ui.css. Within this header exists the string "url(%22images%2Fui-icons_555555_256x240.png%22)".
I assume, it would be a good idea to either ignore comments or to be more tolerant or catch the exception and then evaluate STRICT_CSS_URL_REWRITING.
What do you think?

Regards,
Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: jquery-ui.css and CSSURLRewriter

Posted by Bob Harner <bo...@gmail.com>.
As you probably figured out, Tapestry's parsing of CSS files is just
using a regular expression rather than a true parser, and coming up
with a regex that skipped urls within comments was judged too hard at
the time (https://issues.apache.org/jira/browse/TAP5-2368). However,
it looks like you're right, AssetSourceImpl.getAsset is throwing a
RuntimeException when the asset is not found, but Tapestry is
erroneously checking for a null instead of catching an exception in
that case (CSSURLRewriter.java:179), breaking effective use of the
STRICT_CSS_URL_REWRITING symbol.

Care to file a bug? (A patch would be nice too!)

https://github.com/apache/tapestry-5/blob/master/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/CSSURLRewriter.java

On Tue, Dec 20, 2016 at 3:42 PM, Robert Hannebauer
<ro...@hannebauer.org> wrote:
> Hello,
>
> i'm playing with webjars (https://github.com/eddyson-de/tapestry-webjars) and jquery-ui. Everything work fine, except when i try to use the jquery-ui.css.
>
> It took me some time to understand the following error message, while trying to load the css file:
>
> Caused by: java.lang.RuntimeException: Unable to locate asset 'webjars:META-INF/resources/webjars/jquery-ui/1.12.1/%22images%2Fui-icons_555555_256x240.png%22'
> (the file does not exist).
>     at org.apache.tapestry5.internal.services.AssetSourceImpl.getLocalizedAssetFromResource(AssetSourceImpl.java:390)
>     at org.apache.tapestry5.internal.services.AssetSourceImpl.getAssetInLocale(AssetSourceImpl.java:305)
>     at org.apache.tapestry5.internal.services.AssetSourceImpl.getAsset(AssetSourceImpl.java:131)
>     at $AssetSource_25dc8e7415b4a.getAsset(Unknown Source)
>     at org.apache.tapestry5.internal.services.assets.CSSURLRewriter.replaceURLs(CSSURLRewriter.java:177)
>     at org.apache.tapestry5.internal.services.assets.CSSURLRewriter.access$100(CSSURLRewriter.java:46)
>     at org.apache.tapestry5.internal.services.assets.CSSURLRewriter$1.perform(CSSURLRewriter.java:109)
>     at org.apache.tapestry5.internal.services.assets.CSSURLRewriter$1.perform(CSSURLRewriter.java:104)
>     at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.perform(OperationTrackerImpl.java:110)
>
> The file %22images%2Fui-icons_555555_256x240.png%22  does really not exists.
>
> Playing with SymbolConstants.STRICT_CSS_URL_REWRITING does not really help, because the CSSURLRewriter fails too early.
>
> The root cause is the *comment* header of  jquery-ui.css. Within this header exists the string "url(%22images%2Fui-icons_555555_256x240.png%22)".
> I assume, it would be a good idea to either ignore comments or to be more tolerant or catch the exception and then evaluate STRICT_CSS_URL_REWRITING.
> What do you think?
>
> Regards,
> Robert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org