Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't attempt to reconfigure PartialResponseWriter when it's already committed #5240

Merged
merged 1 commit into from
Jun 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static com.sun.faces.renderkit.RenderKitUtils.PredefinedPostbackParameter.PARTIAL_RENDER_PARAM;
import static com.sun.faces.renderkit.RenderKitUtils.PredefinedPostbackParameter.PARTIAL_RESET_VALUES_PARAM;
import static java.util.logging.Level.FINE;
import static java.util.logging.Level.WARNING;
import static javax.faces.FactoryFinder.VISIT_CONTEXT_FACTORY;

import java.io.IOException;
Expand Down Expand Up @@ -672,9 +673,15 @@ public DelayedInitPartialResponseWriter(PartialViewContextImpl ctx) {
super(null);
this.ctx = ctx;
ExternalContext extCtx = ctx.ctx.getExternalContext();
extCtx.setResponseContentType(RIConstants.TEXT_XML_CONTENT_TYPE);
extCtx.setResponseCharacterEncoding(extCtx.getRequestCharacterEncoding());
extCtx.setResponseBufferSize(ctx.ctx.getExternalContext().getResponseBufferSize());

if (extCtx.isResponseCommitted()) {
LOGGER.log(WARNING, "Response is already committed - cannot reconfigure it anymore");
}
else {
extCtx.setResponseContentType(RIConstants.TEXT_XML_CONTENT_TYPE);
extCtx.setResponseCharacterEncoding(extCtx.getRequestCharacterEncoding());
extCtx.setResponseBufferSize(extCtx.getResponseBufferSize());
}
}


Expand Down