Strange error with Fonts & Dandelion. O.o

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Strange error with Fonts & Dandelion. O.o

Nushio
I'm about as confused as it can get, but I'll try to explain the situation as best as I can.

I've been using Datatables & FontAwesome without issues until the 0.10.0 build.

After I added the filter / servlet into my web.xml, Firefox will refuse to load the fonts on my server (unless I use the FontAwesome CDN).
Chrome and other browsers handle it perfectly.

Removing dandelion / datatables jars & text from web.xml returns FontAwesome functionality on Firefox, so it's definitely a dandelion issue, probably the filter.

How can I help debug this?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Thibault Duchateau
Administrator
Hi Nushio,

Strange indeed.

* Is there any error/warning in your browser console?
* Could you please turn on the TRACE log level for com.github.dandelion and post it?
* Can you post your bundle containing the FontAwesome-related assets as well?

Regards,
Thibault.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Nushio
Yes, Firefox spits out the following:

downloadable font: incorrect file size in WOFF header (font-family: "FontAwesome" style:normal weight:normal stretch:normal src index:1)
source: http://Path-to-FortAwesome/fonts/fontawesome-webfont.woff?v=4.0.1 font-awesome.css
downloadable font: rejected by sanitizer (font-family: "FontAwesome" style:normal weight:normal stretch:normal src index:1)
source: http://Path-to-FortAwesome/fonts/fontawesome-webfont.woff?v=4.0.1 font-awesome.css
GET http://Path-to-FortAwesome/fonts/fontawesome-webfont.ttf [HTTP/1.1 200 OK 5ms]
reflow: 48.66ms
downloadable font: FFTM: misaligned table (font-family: "FontAwesome" style:normal weight:normal stretch:normal src index:2)
source: http://Path-to-FortAwesome/fonts/fontawesome-webfont.ttf?v=4.0.1 font-awesome.css
downloadable font: rejected by sanitizer (font-family: "FontAwesome" style:normal weight:normal stretch:normal src index:2)
source: http://Path-to-FortAwesome/fonts/fontawesome-webfont.ttf?v=4.0.1 font-awesome.css
downloadable font: no supported format found (font-family: "FontAwesome" style:normal weight:normal stretch:normal src index:4)
source: (end of source list)

I'm using the standard bundle downloaded from http://fortawesome.github.io/Font-Awesome/
I tried using 4.1.0 and 4.0.3.

I'm trying to get you a trace and will update this post as soon as I can. :P
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Thibault Duchateau
Administrator
Nushio wrote
I'm using the standard bundle downloaded from http://fortawesome.github.io/Font-Awesome/
I tried using 4.1.0 and 4.0.3.
Actually I meant asset bundle (JSON file).
Is so:
 * could you please for the corresponding JSON file(s)?
 * I'll move this topic in the Dandelion forum :-)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Nushio
Ah, go ahead and move the thread. I posted it here mostly because dandelion is a requirement for datatables, but you're right. It's not a datatables issue.

I'm not using Dandelion to load the FontAwesome assets, I'm actually loading them directly from the jsp and Dandelion is hi-jacking the fonts somehow :P

<link rel="stylesheet" href="${pageContext.request.contextPath}/css/FontAwesome/css/font-awesome.css" />
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Jimmie Fulton
I had a similar problem with SWF files.  The problem is that the DandelionFilter is using the Accept HTTP header to determine whether or not to write asset links into the response.  It checks for "text/html".  Unfortunately, the Accept header can be anything, and various browsers have different defaults.  For both Chrome and Safari, my SWF files were delivered fine.  For Firefox, I get a mangled file.  Firefox's default Accept header is "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8".

I ended up supplying the assets myself.  I'm using the JSP taglib, and those components rely on:
request.getAttribute(WebConstants.DANDELION_CONTEXT_ATTRIBUTE);
I ended up writing my own filter to get by this problem.


    private Context context;

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        context = new Context(filterConfig);
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
        request.setAttribute(WebConstants.DANDELION_CONTEXT_ATTRIBUTE, context);
        filterChain.doFilter(request, response);
    }

    @Override
    public void destroy() {

    }
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Thibault Duchateau
Administrator
Hi,

jimmiebfulton wrote
Unfortunately, the Accept header can be anything, and various browsers have different defaults.
Exactly.

It appears that basing such an important component as the DandelionFilter on the Accept header was a terrible mistake. :-(
Therefore this issue is becoming a priority for the 0.10.1.

jimmiebfulton wrote
I ended up writing my own filter to get by this problem.
I'm afraid you might encounter unexpected issue, unless you handle manually all assets.

Regards,
Thibault.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Nushio
This post was updated on .
Hi Jimmie, Thibault.

I modified Dandelion slightly to prevent it from mangling files by file type.

Should I add swf, fla and others to the list? What's the preferred way to handle a potentially large file list without much overhead?

https://github.com/Nushio/dandelion/commit/dfb8596a4eea3244a028b94c22ac64b432ccade8

Edit: I'd add .ico to the list, as dandelion is also corrupting favicons on Firefox. :(
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Jimmie Fulton
In reply to this post by Thibault Duchateau
Thibault Duchateau wrote
I'm afraid you might encounter unexpected issue, unless you handle manually all assets.
That's precisely what I'm doing.  In my mind, that was the safest option for the time being.  Ideally, the decision to rewrite would be based on the response type as indicated by the container. HttpServletResponse#getContentType();
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Jimmie Fulton
In reply to this post by Nushio
Hi Nushio,

Unfortunately, filtering by extension won't really work reliably, either.  HTTP doesn't really know about file extensions.  Only MIME types.  The fact that the requested resource has an extension is just coincidence.  

What results do the following produce?

http://localhost/files/815457fb-9cde-4457-84c6-c28741aa7af5
http://localhost/files/815457fb-9cde-4457-84c6-c28741aa7af5/thumb

html, xml, pdf, jpg?  You can't know.  Depends on how it was built.  The browser doesn't care that there is no extension.  It only cares about the Content-Type header being set to "application/pdf", "image/jpeg", etc.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Thibault Duchateau
Administrator
Hi Nushio, Jimmie,

Thanks you both for pointing this out.
Indeed, the most reliable information is the MIME type returned by the response content type.

@Nushio: since it implies some refactoring, I suggest that you wait before sending a PR and I shall let you know when I push the modifications to the wip/0.10.1 branch.

Note that I added a more general issue: https://github.com/dandelion/dandelion/issues/27.

Regards,
Thibault.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Thibault Duchateau
Administrator
Hi,

A new 0.10.1-SNAPSHOT is (about to be) available in Maven Central.
Could somebody please give a try?

Regards,
Thibault
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Nushio
Hi Thibault!

I just tried to build dandelion, but it failed.

Results :

Tests in error:
  UrlRewritingProcessorTest.should_not_process_anything:64 NoSuchMethod com.gith...
  UrlRewritingProcessorTest.should_process_one_relative_path_1_lvl:71 NoSuchMethod
  UrlRewritingProcessorTest.should_process_one_relative_path_2_lvl:78 NoSuchMethod
  UrlRewritingProcessorTest.should_process_multiple_relative_paths_2_lvl:85 NoSuchMethod

Tests run: 88, Failures: 0, Errors: 4, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.480s
[INFO] Finished at: Thu Jun 12 09:28:07 CDT 2014
[INFO] Final Memory: 10M/213M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.13:test (default-test) on project dandelion-core: There are test failures.
[ERROR]
[ERROR] Please refer to dandelion/dandelion-core/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.13:test (default-test) on project dandelion-core: There are test failures.

Please refer to dandelion/dandelion-core/target/surefire-reports for the individual test results.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

Please refer to dandelion/dandelion-core/target/surefire-reports for the individual test results.
        at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:82)
        at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:151)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:721)
        at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:620)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 19 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:



[Nushio@KnightRider dandelion-core]$ git status
On branch wip/0.10.1
Your branch is up-to-date with 'origin/wip/0.10.1'.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Thibault Duchateau
Administrator
Hi Nushio,

Actually you're not up to date with the upstream version. The UrlRewritingProcessorTest class has been removed and CssUrlRewritingProcessorTest added.
It may come from your Git installation. What version do you have?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Nushio
You're right. I just tested the file and it works fine. Fonts, Favicons and Flashes (All 3 F's!) work.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Thibault Duchateau
Administrator
Awesome! Thanks!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Nushio
Thanks for fixing this. I just tested on Chrome & Internet Explorer 9 and it works on all browsers :)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Thibault Duchateau
Administrator
Awesome^2!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

jay.cz
Just a question, I am encountering same problems as described in the beginning of this thread. I have checked Maven central repository for Dandelion 0.10.1-SNAPSHOT version but it is not there... :(

Where can I get it? Do you plan to put it to Maven repo again?

Thanks for your answer.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange error with Fonts & Dandelion. O.o

Thibault Duchateau
Administrator
Hi,

Weird. I've just relaunched a build/deploy to Central:
 * https://dandelion.ci.cloudbees.com/job/dandelion-core-build/223/console
 * https://dandelion.ci.cloudbees.com/job/dandelion-datatables-build/345/console

Moreover, did you enabled the snapshot repo in your POM? (http://dandelion.github.io/faq/#snapshot)

Please let me know if it helps.

Regards,
Thibault.
12
Loading...