deltaspike-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nuno G. de M (JIRA)" <>
Subject [jira] [Created] (DELTASPIKE-914) Rendering a dynamic p:graphicImage whose StreamConent is in a Deltaspike ViewScoped bean seems not to work
Date Fri, 29 May 2015 16:00:25 GMT
Nuno G. de M created DELTASPIKE-914:

             Summary: Rendering a dynamic p:graphicImage whose StreamConent is in a Deltaspike
ViewScoped bean seems not to work
                 Key: DELTASPIKE-914
             Project: DeltaSpike
          Issue Type: Bug
          Components: JSF-Module
    Affects Versions: 1.4.0
         Environment: All containers - tested on Weblogic 12.1.2 but the issue is cross cuting
            Reporter: Nuno G. de M


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: "
                    <p:graphicImage id="previewImageB"  value="#{resource[viewScopeadBean.imageResource]}"
 width="250px" height="250px" rendered="true" />

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:
" />                                        
                    <p:graphicImage id="previewImageC"  value="#{viewScopeadBean.streamedContent}"
 width="250px" height="250px" rendered="true" />
                    <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.

I have written a small sample application that renders the image of a labrador using both
flavors (static resource and dynamic resource).

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,

This message was sent by Atlassian JIRA

View raw message