com.sun.faces.renderkit.html_basic.HtmlResponseWriter Maven / Gradle / Ivy
Show all versions of jakarta.faces Show documentation
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package com.sun.faces.renderkit.html_basic;
import java.io.IOException;
import java.io.Writer;
import java.util.LinkedList;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.sun.faces.RIConstants;
import com.sun.faces.config.WebConfiguration;
import com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter;
import com.sun.faces.io.FastStringWriter;
import com.sun.faces.util.HtmlUtils;
import com.sun.faces.util.MessageUtils;
import jakarta.el.ValueExpression;
import jakarta.faces.FacesException;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.ExternalContext;
import jakarta.faces.context.FacesContext;
import jakarta.faces.context.ResponseWriter;
import jakarta.faces.render.Renderer;
/**
*
* HtmlResponseWriter is an Html specific implementation of the ResponseWriter
abstract
* class. Kudos to Adam Winer (Oracle) for much of this code.
*/
public class HtmlResponseWriter extends ResponseWriter {
// Content Type for this Writer.
//
private String contentType = "text/html";
// Character encoding of that Writer - this may be null
// if the encoding isn't known.
//
private String encoding;
// Writer to use for output;
//
private Writer writer;
// True when we need to close a start tag
//
private boolean closeStart;
// Configuration flag regarding disableUnicodeEscaping
//
private WebConfiguration.DisableUnicodeEscaping disableUnicodeEscaping;
// Flag to escape Unicode
//
private boolean escapeUnicode;
// Flag to escape ISO-8859-1 codes
//
private boolean escapeIso;
// True when we shouldn't be escaping output (basically,
// inside of