Class CharsetHolder

java.lang.Object
org.apache.tomcat.util.buf.CharsetHolder

public class CharsetHolder extends Object
Represents a character encoding to be used for a request or response.

Historically the Servlet API has used Strings for this information with lazy conversion to Charset. Sometimes the API required that an invalid name triggered an exception. Sometimes the invalid name was treated as if it had never been set. This resulted in classes storing both the String and, if the name was valid, the Charset with validation and conversion logic spread throughout those classes.

This class is an attempt to encapsulate that behaviour.