jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Re: [jsr372-experts mirror] HTML served as a resource

From: Leonardo Uribe <leonardo.uribe_at_irian.at>
Date: Wed, 14 Sep 2016 12:27:37 -0500

Hi

There is a filter for css files that scans for expressions, but it is only
enabled if type is text/css (at least in MyFaces).

I guess it should be something related to that core. In MyFaces the filter
is located in Resource.getInputStream() implementation.

The javadoc of Resource.getInputStream() says this:

"... Any EL expressions present in the resource must be evaluated before
serving the bytes of the resource. Note that due to browser and server
caching, EL expressions in a resource file will generally only be evaluated
once, when the resource is first served up. Therefore, using EL expressions
that refer to per-request data is not advisable since this data can become
stale. ..."

If you need to override this code, a ResourceWrapper checking for
getContentType() can do the trick.

regards,

Leonardo Uribe


2016-09-14 10:39 GMT-05:00 Kito Mann <kito.mann_at_virtua.com>:

> Hello experts,
>
> I'm working on my Web Components and JSF
> <https://oracle.rainfocus.com/scripts/catalog/oow16.jsp?event=javaone&search=jsf%20web%20components%20&search.event=javaone>
> presentation for JavaOne next week. One of the things that would help for
> integrating JSF with libraries like Polymer
> <http://www.polymer-project.org> (which uses HTML Imports
> <http://w3c.github.io/webcomponents/spec/imports/>), is the ability to
> serve an HTML file as a resource (complete with parsing of expressions),
> just like a CSS or a JavaScript file.
>
> This is somewhat possible now:
>
> <link rel="import" href="#{resource['jsf-polymer:take1.html']}"/>
>
> However, it looks like all JSF expressions, etc., are being stripped. So,
> I have two questions: (a) does anyone know why the expressions are being
> stripped, and how to change that behavior, and (b) has anyone given thought
> to serving stateless view "fragments" as resources?
> ___
>
> Kito D. Mann | @kito99 | Author, JSF in Action
> Web Components, Polymer, JSF, PrimeFaces, Java EE, and Liferay training
> and consulting
> Virtua, Inc. | virtua.tech
> JSFCentral.com | @jsfcentral | knowesis.io
> <http://knowesis.io/web/webcomponents> - fresh Web Components info
> +1 203-998-0403
>
> * Listen to the Enterprise Java Newscast: *http://
> <http://blogs.jsfcentral.com/JSFNewscast/>enterprisejavanews.com
> <http://ww.enterprisejavanews.com>*
>
>