Dynamic Content Streaming: Evaluate possibility to reduce method call to 1 with getExpectedType
See original GitHub issueCurrently our DynamicContentSrcBuilder receives the “value” to check the type of the “value” ValueExpression return value (String/StreamedContent).
In theory we could also use ValueExpresison#getExpectedType()
, so we can reduce the first call when rendering the view.
Also see https://primefaces.github.io/primefaces/10_0_0/#/core/dynamiccontent
This should work in most cases, we should check some cases with composites, f:param to a ui:include and some JSF/EL impls. We can still do a fallback if the expectedType doesnt return StreamdContent/String/byte[].
This would allow us to use a direct binding to a byte[] without having 2 calls to the “create image stream logic”, which is currently prevented by DefaultStreamedContentBuilder#stream(lamba), as the lambda is only invoked once. But we also have to add a contentType attr to the components like graphicImage/avatar.
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (15 by maintainers)
Top GitHub Comments
please create a new issue if you would like to see it, thats a different topic
We could even think about a more radical change. The first call is only required because of non-dynamic images (value=/mydir/mydir.jpg). If we make
p:graphicImage
only support dynamic images, we can get rid of the this check asp:graphicImage
doesnt have any benefits overh:graphicImage
for non-dynamic images. Or create a newp:dynamicImage
and deprecatep:graphicImage
.