Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
1.4.0
-
None
-
All containers - tested on Weblogic 12.1.2 but the issue is cross cuting
Description
Hi,
This issue has to do with incompatibility between primefaces p:graphicImage and deltaSpike ViewAccessScoped beans.
The prime faces graphic image apperently has two core modes of rendering an html <img> component. On one mode it will generate a resource to a statically available image.
Under this scenario we have no problems even when workign with a ViewAccessScoped bean to provide the img resource path.
Such as:
<h:panelGroup layout="block">
<h:outputText value="As resource determined from viewSopecedBean: " />
<br/>
<br/>
<p:graphicImage id="previewImageB" value="#
" width="250px" height="250px" rendered="true" />
</h:panelGroup>
However, when rendering dynamic content, ViewAccess scoped beans are not compatible, as the primefaces dynamic content handler tries to evaluate a ValueExpression and the ViewScopedBean context appears not to be active.
<h:panelGroup layout="block">
<h:outputText value="As dynamicRsource determined fromViewScopedBean: " />
<br/>
<br/>
<p:graphicImage id="previewImageC" value="#
" width="250px" height="250px" rendered="true" />
<br/>
<p> Ok and here we have our bug.
The problem we have here seems to be that PrimeResourceHandler and the GraphicImageRenderer work together without problems with deltaspike when dealing with static content.
However, when we are dealing with dynaminc content set on page bean
the Renderer will tune the session context with the expression language of the .xhtml page so when the browser asks for the img src,
PrimeResourceHandler will be able to discover what EL was associated to that img resource
and resolve on the fly the dynamic content asked by the user.
However, the view access scoped seems not be available for PrimeFaces so he comes out empty handed.
</p>
</h:panelGroup>
I have written a small sample application that renders the image of a labrador using both flavors (static resource and dynamic resource).
https://github.com/99sono/delta-spike-dynamic-content_issue
I am not sure if a bug should not be opened as well to primefaces, since it looks to me that addressing this issue will most likely require coordination on both teams.
The only work-around for this seems to be to re-factor code to use request scoped beans or session scoped beans.
Or if geting view scoped beans to work together with this component is really a must, which in our case it is....
We will have to come-up with a temporary hack to the
p:graphicImage renderer and to the PrimeResourceHandler to be able to somehow bypass the fact that ViewAccess scope is not available.
I really do not wish to go down this path - more than temporarily.
Thank you for your support,
Kindest regards,
Nuno.