Warning | ||
---|---|---|
| ||
CAS documentation has moved over to jasig.github.io/cas, starting with CAS version 4.x. The wiki will no longer be maintained. For the most recent version of the documentation, please refer to the aforementioned link. |
Excerpt |
---|
There are a number of considerations for deploying CAS in a locale other than en-US, some of which are discussed here. |
Localization
The Localization page describes how to switch from the default en-US locale to any of a number of supported locales, as well as instructions for adding support for a locale not provided out of the box.
...
Supporting character sets other than ASCII will be a primary concern for many international deployments. The following steps are required to support end-to-end UTF-8 character set encoding in CAS.
Ensure pageEncoding of all JSP views is UTF-8. (This is the default for most if not all views packaged with CAS)
Code Block <%@ page pageEncoding="UTF-8" %>
Ensure the Content-Type header specifies UTF-8 encoding:
Code Block <%@ page contentType="text/html; charset=UTF-8" %> ... <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> ... </head> ...
- Set the character set encoding to UTF-8 for both the request and response as early in the processing stage as possible. The most convenient solution for this is defining a servlet filter that sets
HttpServletRequest#setCharacterEncoding()
andHttpServletResponse#setCharacterEncoding()
to UTF-8. The following example uses CharacterEncodingFilter, which is a convenient choice that is actively maintained and well-documented.
Set the scope of the character set filter according to your needs. The scope should be no larger than needed to avoid unintended side effects of character set encoding; however, it may be necessary to scope the entire application in many cases.Code Block <!-- This filter should be placed at the head of the filter chain, if possible, to ensure that all downstream filters have the proper encoding. --> <filter> <filter-name>CharacterEncodingFilter</filter-name> <filter-class>edu.vt.middleware.servlet.filter.CharacterEncodingFilter</filter-class> <!-- Sets the character encoding of the request to the given Java character set name. Name must be understood by java.nio.charset.Charset class, e.g., ISO-8859-1, UTF-8, UTF-16. --> <init-param> <param-name>requestCharsetName</param-name> <param-value>UTF-8</param-value> </init-param> <!-- Sets the character encoding of the response to the given Java character set name. Name must be understood by java.nio.charset.Charset class, e.g., ISO-8859-1, UTF-8, UTF-16. --> <init-param> <param-name>responseCharsetName</param-name> <param-value>UTF-8</param-value> </init-param> </filter>
Code Block xml xml <filter-mapping> <filter-name>CharacterEncodingFilter</filter-name> <url-pattern>/**</url-pattern> </filter-mapping> Recent versions of CAS provide this functionality by default usingCharacterEncodingFilter
.