Search in sources :

Example 1 with CharsetMapper

use of org.apache.catalina.util.CharsetMapper in project tomcat by apache.

the class StandardContext method setCharsetMapper.

/**
     * Set the Locale to character set mapper for this Context.
     *
     * @param mapper The new mapper
     */
public void setCharsetMapper(CharsetMapper mapper) {
    CharsetMapper oldCharsetMapper = this.charsetMapper;
    this.charsetMapper = mapper;
    if (mapper != null)
        this.charsetMapperClass = mapper.getClass().getName();
    support.firePropertyChange("charsetMapper", oldCharsetMapper, this.charsetMapper);
}
Also used : CharsetMapper(org.apache.catalina.util.CharsetMapper)

Example 2 with CharsetMapper

use of org.apache.catalina.util.CharsetMapper in project spring-boot by spring-projects.

the class TomcatServletWebServerFactoryTests method getCharset.

@Override
protected Charset getCharset(Locale locale) {
    Context context = (Context) ((TomcatWebServer) this.webServer).getTomcat().getHost().findChildren()[0];
    CharsetMapper mapper = ((TomcatEmbeddedContext) context).getCharsetMapper();
    String charsetName = mapper.getCharset(locale);
    return (charsetName != null) ? Charset.forName(charsetName) : null;
}
Also used : InitialContext(javax.naming.InitialContext) Context(org.apache.catalina.Context) CharsetMapper(org.apache.catalina.util.CharsetMapper)

Aggregations

CharsetMapper (org.apache.catalina.util.CharsetMapper)2 InitialContext (javax.naming.InitialContext)1 Context (org.apache.catalina.Context)1