[ 
https://issues.apache.org/jira/browse/DELTASPIKE-914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14572234#comment-14572234
 ] 

Nuno G. de M commented on DELTASPIKE-914:
-----------------------------------------

Hi Thomas,

This apporach is not good.
This apporach means you have to have your own resource handler that activates 
the window contentext using APIs that you as an end-user should typically not 
be using out of delta-spike, as your subject to being borken once you upgrade 
the library if that API for whatever reason changes.
And on top of that, you still want the resource handler of Primefaces to go on 
and and do the resource handling logic it was supposed to have done in the 
first place.

You would have to create you resource-handler that extends the primefaces 
resouce handler, to activate a window context to then delegate the resounce 
handling to the base resource handler.

That fundamentally means, you are not dependent on being broken on upgrade from 
one library, you have two points of potential problem on upgrade in the future.

The Rubus Avanced graphic render approach has the advantage of at only being 
bound to the primefaces library in order to work and extends the p:graphicImage 
use cases without being dependent on other underlying libraries like delta 
psike.

For this specific situtation, for no work-arounds, delta spike would really 
need to, out of the box, open the context if that were possible.

> Rendering a dynamic p:graphicImage whose StreamConent is in a Deltaspike 
> ViewScoped bean seems not to work
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: DELTASPIKE-914
>                 URL: https://issues.apache.org/jira/browse/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
>            Assignee: Thomas Andraschko
>              Labels: graphicImage, primefaces, viewaccesscoped
>
> 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="#{resource[viewScopeadBean.imageResource]}"  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="#{viewScopeadBean.streamedContent}"  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
> https://github.com/99sono/delta-spike-dynamic-content_issue/blob/master/src/main/resources/BugOverview.docx
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to