[
https://issues.apache.org/jira/browse/MYFACES-4536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17649473#comment-17649473
]
Melloware commented on MYFACES-4536:
------------------------------------
In PrimeFaces the current PartialResponseWriter wraps and delegates with a
local variable.
{code:java}
public class PartialResponseWriterWrapper extends PartialResponseWriter {
private PartialResponseWriter wrapped; public
PartialResponseWriterWrapper(PartialResponseWriter wrapped) {
super(wrapped);
this.wrapped = wrapped;
} @Override
public void delete(String targetId) throws IOException {
wrapped.delete(targetId);
} @Override
public void endDocument() throws IOException {
wrapped.endDocument();
} @Override
public void endError() throws IOException {
wrapped.endError();
} @Override
public void endEval() throws IOException {
wrapped.endEval();
} @Override
public void endExtension() throws IOException {
wrapped.endExtension();
} @Override
public void endInsert() throws IOException {
wrapped.endInsert();
} @Override
public void endUpdate() throws IOException {
wrapped.endUpdate();
} @Override
public void redirect(String url) throws IOException {
wrapped.redirect(url);
} @Override
public void startDocument() throws IOException {
wrapped.startDocument();
} @Override
public void startError(String errorName) throws IOException {
wrapped.startError(errorName);
} @Override
public void startEval() throws IOException {
wrapped.startEval();
} @Override
public void startExtension(Map<String, String> attributes) throws
IOException {
wrapped.startExtension(attributes);
} @Override
public void startInsertAfter(String targetId) throws IOException {
wrapped.startInsertAfter(targetId);
} @Override
public void startInsertBefore(String targetId) throws IOException {
wrapped.startInsertBefore(targetId);
} @Override
public void startUpdate(String targetId) throws IOException {
wrapped.startUpdate(targetId);
} @Override
public void updateAttributes(String targetId, Map<String, String>
attributes) throws IOException {
wrapped.updateAttributes(targetId, attributes);
}
} {code}
However if the code is changed to use the non wrapped class and delegate to
MyFaces directly the Integration Tests fail but Mojarra still passes.
{code:java}
public class PartialResponseWriterWrapper extends PartialResponseWriter {
public PartialResponseWriterWrapper(PartialResponseWriter wrapped) {
super(wrapped);
}} {code}
> PartialResponseWriter: Do no wrap the writer
> --------------------------------------------
>
> Key: MYFACES-4536
> URL: https://issues.apache.org/jira/browse/MYFACES-4536
> Project: MyFaces Core
> Issue Type: Improvement
> Components: General
> Affects Versions: 2.2.14, 2.3.10, 2.3-next-M7, 4.0.0-RC2
> Reporter: Melloware
> Priority: Major
>
> Per BalusC:
> Since JSF 2.3 the default constructor of {{FacesWrapper}} subclasses has been
> deprecated in order to force implementors to instead use the constructor
> taking the wrapped instance (and to raise their awareness), so that logically
> the inherited {{getWrapped()}} method will be used throughout the
> implementation instead of the local {{wrapped}} variable. This will ensure
> that the correct implementation is returned and correct behavior is performed
> might the {{FacesWrapper}} implementation itself being wrapped by yet another
> {{FacesWrapper}} implementation further down the chain. Because, when the
> {{FacesWrapper}} implementation incorrectly/accidentally uses the local
> {{wrapped}} variable instead of the {{getWrapped()}} method, then that other
> {{FacesWrapper}} implementation will basically be completely ignored, hereby
> breaking the decorator pattern.
>
> PrimeFaces ticket: https://github.com/primefaces/primefaces/issues/9518
--
This message was sent by Atlassian Jira
(v8.20.10#820010)