// Although the JSF API's ViewHandler.initView(FacesContext) method will call this method during the portlet
// RENDER_PHASE, the RenderRequest does not implement the ClientDataRequest interface, which means it does not
// have a setCharacterEncoding(String) method, therefore this should only be done in the case of a
// ClientDataRequest.
if (portletRequest instanceof ClientDataRequest) {
ClientDataRequest clientDataRequest = (ClientDataRequest) portletRequest;
try {
clientDataRequest.setCharacterEncoding(encoding);
}
catch (IllegalStateException e) {
// TestPage141: setRequestCharacterEncodingActionTest -- exception is to be ignored
}
}