(Locale locale)
| 742 | |
| 743 | |
| 744 | @Override |
| 745 | public void setLocale(Locale locale) { |
| 746 | |
| 747 | if (isCommitted()) { |
| 748 | return; |
| 749 | } |
| 750 | |
| 751 | // Ignore any call from an included servlet |
| 752 | if (included) { |
| 753 | return; |
| 754 | } |
| 755 | |
| 756 | getCoyoteResponse().setLocale(locale); |
| 757 | |
| 758 | // Ignore any call made after the getWriter has been invoked. |
| 759 | // The default should be used |
| 760 | if (usingWriter) { |
| 761 | return; |
| 762 | } |
| 763 | |
| 764 | if (isCharacterEncodingSet) { |
| 765 | return; |
| 766 | } |
| 767 | |
| 768 | if (locale == null) { |
| 769 | getCoyoteResponse().setCharsetHolder(CharsetHolder.EMPTY); |
| 770 | } else { |
| 771 | // In some error handling scenarios, the context is unknown |
| 772 | // (e.g. a 404 when a ROOT context is not present) |
| 773 | Context context = getContext(); |
| 774 | if (context != null) { |
| 775 | String charset = context.getCharset(locale); |
| 776 | if (charset != null) { |
| 777 | getCoyoteResponse().setCharsetHolder(CharsetHolder.getInstance(charset)); |
| 778 | try { |
| 779 | getCoyoteResponse().getCharsetHolder().validate(); |
| 780 | } catch (UnsupportedEncodingException e) { |
| 781 | log.warn(sm.getString("coyoteResponse.encoding.invalid", charset), e); |
| 782 | } |
| 783 | } |
| 784 | } |
| 785 | } |
| 786 | } |
| 787 | |
| 788 | |
| 789 | // --------------------------------------------------- HttpResponse Methods |
nothing calls this directly
no test coverage detected