primefaces-extensions / primefaces-extensions.github.com

Organization repo, only for homepage, wiki and issue tracker
https://primefaces-extensions.github.io/
68 stars 22 forks source link

DocumentViewer: can't specify a StreamedContent through a method call #795

Closed mauromol closed 4 years ago

mauromol commented 4 years ago

If I try to specify the value of a pe:documentViewer as a method call like this (note: that method returns a StreamedContent):

<pe:documentViewer value="#{bean.getStreamedForm(bean.selectedProduct)}" />

I get an exception:

[...]
Caused by: javax.el.PropertyNotFoundException: /myFacelet.xhtml @696,133 value="#{bean.getStreamedForm(bean.selectedProduct)}": Property 'getStreamedForm' not found on type com.example.Bean
    at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:100)
    at org.primefaces.el.ValueExpressionAnalyzer.intercept(ValueExpressionAnalyzer.java:101)
    at org.primefaces.el.ValueExpressionAnalyzer.toValueReference(ValueExpressionAnalyzer.java:114)
    at org.primefaces.el.ValueExpressionAnalyzer.getExpression(ValueExpressionAnalyzer.java:62)
    at org.primefaces.util.DynamicContentSrcBuilder.build(DynamicContentSrcBuilder.java:68)
    at org.primefaces.extensions.component.documentviewer.DocumentViewerRenderer.getDocumentSource(DocumentViewerRenderer.java:144)
    at org.primefaces.extensions.component.documentviewer.DocumentViewerRenderer.generateSrc(DocumentViewerRenderer.java:72)
    ... 92 more
Caused by: javax.el.PropertyNotFoundException: Property 'getStreamedCnsRequestForm' not found on type com.example.Bean
    at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:268)
    at javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:221)
    at javax.el.BeanELResolver.property(BeanELResolver.java:355)
    at javax.el.BeanELResolver.getType(BeanELResolver.java:82)
    at com.sun.faces.el.DemuxCompositeELResolver._getType(DemuxCompositeELResolver.java:215)
    at com.sun.faces.el.DemuxCompositeELResolver.getType(DemuxCompositeELResolver.java:242)
    at org.primefaces.el.InterceptingResolver.getType(InterceptingResolver.java:59)
    at org.apache.el.parser.AstValue.getType(AstValue.java:60)
    at org.apache.el.ValueExpressionImpl.getType(ValueExpressionImpl.java:168)
    at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:98)

Why this limitation? The same value works fine with p:fileDownload.

melloware commented 4 years ago

My guess is it is something wrong with how value is being decoded. I will investigate.

melloware commented 4 years ago

I think the problem lies here: org.primefaces.util.DynamicContentSrcBuilder.build

https://github.com/primefaces/primefaces/issues/5902

melloware commented 4 years ago

Marking as WontFix for the reason given the upstream PrimeFaces answer in primefaces/primefaces#5902