Font Awesome resources not found with *.xhtml URL pattern

UI Components for JSF
Post Reply
jmanko
Posts: 16
Joined: 19 Nov 2013, 20:24

01 Oct 2014, 08:20

Although this is more of a Majorra issue, I'm hoping that PF has a solution.

I dropped in a copy of Font Awesome in my project, and included it in my pages:

Code: Select all

        <h:outputStylesheet name="./css/font-awesome/css/font-awesome.min.css"/>
Using the JSF filter as /faces/* works fine, and that CSS and related files load just fine:

Code: Select all

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>

Code: Select all

server/muck/javax.faces.resource/css/font-awesome/fonts/fontawesome-webfont.woff?v=4.2.0
200 - OK
server/muck/javax.faces.resource/css/font-awesome/fonts/fontawesome-webfont.ttf?v=4.2.0
200 - OK
Changing to *.xhtml

Code: Select all

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>
results in two Font Awesome resources not loading:

Code: Select all

server/muck/javax.faces.resource/css/font-awesome/fonts/fontawesome-webfont.woff?v=4.2.0
404 NOT FOUND

server/muck/javax.faces.resource/css/font-awesome/fonts/fontawesome-webfont.ttf?v=4.2.0
404 NOT FOUND
So, from what I can find the resources are not registered, therefore the framework can't load them. Is there a workaround to this? Maybe something that PF provides.

Mathieu-Castets
Posts: 45
Joined: 03 Jul 2014, 19:04
Location: Biarritz, France

01 Oct 2014, 11:37

Why don't you just use the html link tag?

I'm also using Font Awesome, in my <head></head>:

Code: Select all

<link rel="stylesheet" href="#{request.contextPath}/resources/css/vendor/font-awesome.min.css"/>
PrimeFaces 5.3 - PF Extensions 4.0.0 - OmniFaces 2.2 - Mojara 2.2.12 - GlassFish 4.1.1 - Java 7 - Netbeans 8.1

jmanko
Posts: 16
Joined: 19 Nov 2013, 20:24

01 Oct 2014, 19:30

Now why would I want to make it easy on myself. ;)

It's works.

User avatar
andyba
Expert Member
Posts: 2473
Joined: 31 Mar 2011, 16:27
Location: Steinfeld, near Bremen/Osnabrück, DE
Contact:

01 Oct 2014, 23:46

Put them under resources folder, perhaps in a css folder in there, and use the library and name attributes properly.
Find a JSF tutorial if you are not sure how to do this.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

20 Oct 2014, 11:33

Font Awesome is not built-in;

http://blog.primefaces.org/?p=3318

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

20 Oct 2014, 16:26

There also is a jsf-ready version of the font-awesome jar. No need to wait for pf 5.2 or elite version

rikup
Posts: 459
Joined: 29 Jan 2013, 14:27

21 Oct 2014, 12:28

Why not use CDN?
PrimeNG 2.0.0
Angular 2.4.5

Mathieu-Castets
Posts: 45
Joined: 03 Jul 2014, 19:04
Location: Biarritz, France

21 Oct 2014, 17:08

rikup wrote:Why not use CDN?
Can't work on the project without internet access, you could get in trouble from time to time with CDN changes and sometimes HTTPS is not always available.
PrimeFaces 5.3 - PF Extensions 4.0.0 - OmniFaces 2.2 - Mojara 2.2.12 - GlassFish 4.1.1 - Java 7 - Netbeans 8.1

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

21 Oct 2014, 17:22

As mentioned Use the font-awsome.min-jsf-css from http://mvnrepository.com/artifact/org.w ... some/4.2.0

It fixes all relative path issues, resource things etc...

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 48 guests