For my webapp i'm trying to introduce the richface skinning.
I'm getting an error that leaves me clueless.
Old situation (works) :
messages.css
#inhoud #infoblock {
min-height:36px;
width:100%;
background:#B1D1FA url(#{resource['image/helpmelding.gif']});
padding:2px 0;
background-position: 3px center;
}
New situation (Doesn't work correctly)
messages.ecss
#inhoud #infoblock {
background-color:'#{richSkin.infoBlockBackground}';
padding:2px 0;
background-image:url(#{resource['image/helpmelding.gif']});
background-position: 3px center;
background-repeat:no-repeat;
min-height:36px;
width:100%;
}
result:
*#inhoud *#infoblock {
background-color: #B1D1FA;
padding:2px 0;
}
Stopped css parsing when hitting
#{resource['image/helpmelding.gif']}
Logger:
WARNING: Problem parsing 'messages.ecss' resource: Error in expression.
Invalid token "#". Was expecting one of: <S>, "+", "-", <HASH>, <STRING>, <URI>, "inherit", <EMS>, <EXS>, <LENGTH_PX>, <LENGTH_CM>, <LENGTH_MM>, <LENGTH_IN>,
<LENGTH_PT>, <LENGTH_PC>, <ANGLE_DEG>, <ANGLE_RAD>, <ANGLE_GRAD>, <TIME_MS>, <TIME_S>, <FREQ_HZ>, <FREQ_KHZ>, <DIMEN>,
<PERCENTAGE>, <NUMBER>, "rgb(", <FUNCTION>, <IDENT>, <UNICODERANGE>.
mei 06, 2014 2:25:42 PM org.richfaces.resource.CompiledCSSResource$ErrorHandlerImpl logException
Settings
web.xml
<!-- Resource Servlet van Richfaces-->
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/org.richfaces.resources/*</url-pattern>
</servlet-mapping>
pom.xml
<plugin>
<groupId>org.richfaces.cdk</groupId>
<artifactId>maven-richfaces-resources-plugin</artifactId>
<version>${org.richfaces.bom.version}</version>
<configuration>
<skins>
<!-- the name of your skin -->
<skin>LUID</skin>
</skins>
<excludedFiles>
<exclude>^\Qorg.richfaces.renderkit.html.images.\E.*</exclude>
<exclude>^\Qorg.richfaces.renderkit.html.iconimages.\E.*</exclude>
<exclude>^\Qorg.richfaces.renderkit.html.iconimages.\E.*</exclude>
</excludedFiles>
<includedContentTypes>
<include>application/javascript</include>
<include>text/css</include>
<include>image/.+</include>
</includedContentTypes>
<fileNameMappings>
<property>
<name>^.*showcase.*/([^/]+\.css)$</name>
<value>org.richfaces.luid.css/$1</value>
</property>
<property>
<name>^.+/([^/]+\.(png|gif|jpg))$</name>
<value>org.richfaces.images/$1</value>
</property>
<property>
<name>^.+/([^/]+\.css)$</name>
<value>org.richfaces.css/$1</value>
</property>
</fileNameMappings>
</configuration>
....
</plugin>
As the error tells you, the url cannot start with a '#'. You need to wrap it in quotes:
background-image: url("#{resource['image/helpmelding.gif']}");
Related
Be forgiving, I am new to css let alone fontawesome :-)
I wanted to have a nice set of rating stars 0-5 and I managed it sort of using 4.7
https://jsfiddle.net/BoxRec/p3zgeLbt/36
content: "\f005\f006\f006\f006\f006";
However I needed half stars to complete the look and this required going to fontawesome 5
https://jsfiddle.net/BoxRec/p3zgeLbt/38
content: "\f005\f089\f006\f006\f006";
So I used the 5 library and now I now have the half star \f5c0 but the full star \f005 renders the same as the empty star \f006
https://jsfiddle.net/BoxRec/p3zgeLbt/46/
content: "\f005\f5c0\f006\f006\f006";
If you go to the cheatsheet, you can see that \f006 is gone in FontAwesome 5. I would (not a css guy) just use before and after tags to make the same effect. Regular vs solid is just changing the font weight.
note that I changed the font-family to 'Font Awesome\ 5 Free'
i.star {
font-family: 'Font Awesome\ 5 Free';
font-size: 16px;
color: #ffaa00;
font-style: normal;
}
i.s1::before {
content: "\f005";
font-weight: 900;
}
i.s1::after {
content: "\f005\f005\f005\f005";
font-weight: 200;
}
i.s1-5::before {
content: "\f005\f5c0";
font-weight: 900;
}
i.s1-5::after {
content: "\f005\f005\f005";
font-weight: 200;
}
Had to add this to the HTML:
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/all.css">
I am trying to a attach handler to spark UI using this code:
private def getSparkUI(sparkContext: SparkContext): SparkUI = {
sparkContext.ui.getOrElse {
throw new SparkException("Parent SparkUI to attach this tab to not found!")
}
}
import org.apache.spark.ui.JettyUtils.createServletHandler
val ui = getSparkUI(sparkContext)
val graphHttpServlet = new GraphHttpServlet("/graph/", sessionUtils)
val handler = createServletHandler("/graph/", graphHttpServlet, "")
ui.attachHandler(handler)
this code fails to compile with error:
Error:(20, 19) Symbol 'type org.eclipse.jetty.servlet.ServletContextHandler' is missing from the classpath.
This symbol is required by 'method org.apache.spark.ui.JettyUtils.createServletHandler'.
Make sure that type ServletContextHandler is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
A full rebuild may help if 'JettyUtils.class' was compiled against an incompatible version of org.eclipse.jetty.servlet.
val handler = createServletHandler("/graph/", graphHttpServlet, "")
I know that spark shades jetty dependencies into a new package: org.spark_project.jetty.servlet.ServletContextHandler
I also decompile the jar and check that the jar has the shaded dependencies.
But why the compiler failed to see that? How I can attach the handler?
Also, faced similar issue and figured out after few experiments. Adding shade rule for org.eclipse.jetty libraries solves this issue.
This solves below exceptions:
java.lang.NoSuchMethodError: 'void org.apache.spark.ui.WebUI.attachHandler(org.eclipse.jetty.servlet.ServletContextHandler)'
java.lang.ClassCastException: class org.sparkproject.jetty.servlet.ServletContextHandler cannot be cast to class org.eclipse.jetty.servlet.ServletContextHandler (org.sparkproject.jetty.servlet.ServletContextHandler and org.eclipse.jetty.servlet.ServletContextHandler are in unnamed module of loader 'app')
sbt rule
assemblyShadeRules in assembly := Seq(
ShadeRule
.rename("org.eclipse.jetty.**" -> "org.sparkproject.jetty.#1")
.inAll
)
Maven rule
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<shadedArtifactAttached>false</shadedArtifactAttached>
<artifactSet>
<includes>
<include>org.eclipse.jetty:jetty-io</include>
<include>org.eclipse.jetty:jetty-http</include>
<include>org.eclipse.jetty:jetty-proxy</include>
<include>org.eclipse.jetty:jetty-client</include>
<include>org.eclipse.jetty:jetty-continuation</include>
<include>org.eclipse.jetty:jetty-servlet</include>
<include>org.eclipse.jetty:jetty-servlets</include>
<include>org.eclipse.jetty:jetty-plus</include>
<include>org.eclipse.jetty:jetty-security</include>
<include>org.eclipse.jetty:jetty-util</include>
<include>org.eclipse.jetty:jetty-server</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>org.eclipse.jetty</pattern>
<shadedPattern>org.sparkproject.jetty</shadedPattern>
<includes>
<include>org.eclipse.jetty.**</include>
</includes>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
For some reason my locally stored font is not being decoded correctly in my jsf application. I've tried everything, and at this point I'm at a loss.
This is the css reference (located in project/resources/text - same as font files)
#font-face {
font-family: 'BunkenTechSansStd-Med';
src: url("#{resource['text/30B733_0_0.eot']}");
src: url("#{resource['text/30B733_0_0.woff2']}") format('woff2'),
url("#{resource['text/30B733_0_0.woff']}") format('woff'),
url("#{resource['text/30B733_0_0.ttf']}") format('truetype');
}
The sheet is referenced in the template as:
<h:outputStylesheet library="text" name="MyFontsWebfontsKit.css"></h:outputStylesheet>
<h:outputStylesheet library="css" name="style.css"></h:outputStylesheet>
The error I'm receiving in chrome is stated as follows (for all three files):
"failed to decode downloaded font: http://localhost:1717/javax.faces.resource/text/30B733_0_0.woff2.jsf"
Here's is the folder structure:
Furthermore the mapping is as follows:
<mime-mapping>
<extension>eot</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
<mime-mapping>
<extension>otf</extension>
<mime-type>font/opentype</mime-type>
</mime-mapping>
<mime-mapping>
<extension>svg</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/x-font-ttf</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff</extension>
<mime-type>application/x-font-woff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>woff2</extension>
<mime-type>application/x-font-woff2</mime-type>
</mime-mapping>
And lastly a pic of the error in dev tools:
JSF apparently requires folder nav as ":" instead of backslashes.
#font-face {font-family: 'BunkenTechSansStd-Med'; src: url("#{resource['text:30B733_0_0.eot']}");
src: url("#{resource['text:30B733_0_0.woff2']}") format('woff2'),
url("#{resource['text:30B733_0_0.woff']}") format('woff'),
url("#{resource['text:30B733_0_0.ttf']}") format('truetype');}
I'm trying to use in my JSF 2.1.29_01 project the RichFaces 4.5.2.Final, but it's not exasctly working. I added the following skin parameters to my web.xml:
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>emeraldTown</param-value>
</context-param>
<!-- JSF mapping -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Map these files with JSF -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<!-- Making the RichFaces skin spread to standard HTML controls -->
<context-param>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>true</param-value>
</context-param>
And it doesn't work. What exactly doesn't work is the RichFaces resources couldn't be found. They were plugged in the final HTML output as follow:
<link type="text/css" rel="stylesheet" href="/JavaServerFaces
/org.richfaces.resources/javax.faces.resource/org.richfaces
/skinning.ecss?db=eAFL29S2EQAFbwJQ">
but in fact, they were not applied and when I try to reach the resources (type
localhost:8080/JavaServerFaces
/org.richfaces.resources/javax.faces.resource/org.richfaces
/skinning.ecss?db=eAFL29S2EQAFbwJQtype
via a browser I get 404. After that I tried to add ResourceServlet into my web.xml as follows:
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/org.richfaces.resources/*</url-pattern>
</servlet-mapping>
Now when I try to reach the resource I get the following exception:
javax.el.ELException: Error Parsing: "#{a4jSkin.imageUrl('buttonBackgroundImage.png')}"
com.sun.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:124)
com.sun.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:141)
com.sun.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:185)
com.sun.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:65)
com.sun.faces.application.ApplicationImpl.evaluateExpressionGet(ApplicationImpl.java:426)
org.richfaces.resource.css.CSSVisitorImpl.visitStyleDeclaration(CSSVisitorImpl.java:219)
org.richfaces.resource.css.AbstractCSSVisitor.visitStyleRule(AbstractCSSVisitor.java:98)
org.richfaces.resource.css.AbstractCSSVisitor.visitRule(AbstractCSSVisitor.java:61)
org.richfaces.resource.css.AbstractCSSVisitor.visitStyleSheet(AbstractCSSVisitor.java:48)
org.richfaces.resource.CompiledCSSResource.getInputStream(CompiledCSSResource.java:124)
com.sun.faces.application.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:260)
org.richfaces.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:219)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:591)
org.richfaces.webapp.ResourceServlet.httpService(ResourceServlet.java:129)
org.richfaces.webapp.ResourceServlet.service(ResourceServlet.java:123)
root cause
com.sun.el.parser.ParseException: Encountered "(" at line 1, column 20.
Was expecting one of:
"}" ...
"." ...
"[" ...
">" ...
"gt" ...
"<" ...
"lt" ...
">=" ...
"ge" ...
"<=" ...
"le" ...
"==" ...
"eq" ...
"!=" ...
"ne" ...
"&&" ...
"and" ...
"||" ...
"or" ...
"*" ...
"+" ...
"-" ...
"?" ...
"/" ...
"div" ...
"%" ...
"mod" ...
com.sun.el.parser.ELParser.generateParseException(ELParser.java:1630)
com.sun.el.parser.ELParser.jj_consume_token(ELParser.java:1510)
com.sun.el.parser.ELParser.DeferredExpression(ELParser.java:113)
com.sun.el.parser.ELParser.CompositeExpression(ELParser.java:40)
com.sun.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:92)
com.sun.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:141)
com.sun.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:185)
com.sun.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:65)
com.sun.faces.application.ApplicationImpl.evaluateExpressionGet(ApplicationImpl.java:426)
org.richfaces.resource.css.CSSVisitorImpl.visitStyleDeclaration(CSSVisitorImpl.java:219)
org.richfaces.resource.css.AbstractCSSVisitor.visitStyleRule(AbstractCSSVisitor.java:98)
org.richfaces.resource.css.AbstractCSSVisitor.visitRule(AbstractCSSVisitor.java:61)
org.richfaces.resource.css.AbstractCSSVisitor.visitStyleSheet(AbstractCSSVisitor.java:48)
org.richfaces.resource.CompiledCSSResource.getInputStream(CompiledCSSResource.java:124)
com.sun.faces.application.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:260)
org.richfaces.resource.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:219)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:591)
org.richfaces.webapp.ResourceServlet.httpService(ResourceServlet.java:129)
org.richfaces.webapp.ResourceServlet.service(ResourceServlet.java:123)
How can I fix that?
#{a4jSkin.imageUrl('buttonBackgroundImage.png')}
This EL syntax whereby a bean method is invoked with an argument wasn't supported before EL 2.2. This in turn suggestes that you're deploying to a Servlet 2.5 / EL 2.1 container or older.
Based on your previous questions, I gather that upgrading to at least Servlet 3.0 is not possible. In that case, you'd better supply a custom EL 2.1 implementation along the webapp which supports the given EL 2.2 syntax, such as JBoss EL.
See also:
Running JSF 2.0 on Servlet 2.4 container
Invoke direct methods or methods with arguments / variables / parameters in EL
I have a very simple Mule (3.x) flow:
<spring:bean name="messageHandler" class="mypackage.MessageHandler"/>
<flow name="main">
<vm:inbound-endpoint path="in" exchange-pattern="request-response"/>
<component>
<spring-object bean="messageHandler"/>
</component>
<vm:outbound-endpoint path="out"/>
</flow>
where messageHandler is a simple Groovy class:
class MessageHandler {
String handleMessage(String xml) {
return xml + " Received";
}
}
When I execute the test I get:
org.mule.model.resolvers.EntryPointNotFoundException: Failed to find entry point for component, the following resolvers tried but failed:[ ... ReflectionEntryPointResolver: Could not find entry point on: "mypackage.MessageHandler" with arguments: "{class java.lang.String}" ... ]
but when I use Java class it works!! (Also works with Callable interface on groovy class).
I'm using gmaven plugin for groovy compling:
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<extensions>true</extensions>
<inherited>true</inherited>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
What could be the problem here?
Try adding the logger element in the flow before the component to see what's coming into the component.