Mercurial Hosting > luan
comparison src/org/eclipse/jetty/server/Response.java @ 991:688c39c50ee3
simplify ContextHandler
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 18 Oct 2016 00:22:46 -0600 |
parents | 23ec25435b8c |
children | 74b9daf2826c |
comparison
equal
deleted
inserted
replaced
990:83cc6e05a58f | 991:688c39c50ee3 |
---|---|
1019 if (locale == null || isCommitted()) | 1019 if (locale == null || isCommitted()) |
1020 return; | 1020 return; |
1021 | 1021 |
1022 _locale = locale; | 1022 _locale = locale; |
1023 _connection._responseFields.put(HttpHeaders.CONTENT_LANGUAGE_BUFFER,locale.toString().replace('_','-')); | 1023 _connection._responseFields.put(HttpHeaders.CONTENT_LANGUAGE_BUFFER,locale.toString().replace('_','-')); |
1024 | |
1025 if (_explicitEncoding || _outputState!=0 ) | |
1026 return; | |
1027 | |
1028 if (_connection.getRequest().getContext()==null) | |
1029 return; | |
1030 | |
1031 String charset = _connection.getRequest().getContext().getContextHandler().getLocaleEncoding(locale); | |
1032 | |
1033 if (charset!=null && charset.length()>0) | |
1034 { | |
1035 _characterEncoding=charset; | |
1036 | |
1037 /* get current MIME type from Content-Type header */ | |
1038 String type=getContentType(); | |
1039 if (type!=null) | |
1040 { | |
1041 _characterEncoding=charset; | |
1042 int semi=type.indexOf(';'); | |
1043 if (semi<0) | |
1044 { | |
1045 _mimeType=type; | |
1046 _contentType= type += ";charset="+charset; | |
1047 } | |
1048 else | |
1049 { | |
1050 _mimeType=type.substring(0,semi); | |
1051 _contentType= _mimeType += ";charset="+charset; | |
1052 } | |
1053 | |
1054 _cachedMimeType=MimeTypes.CACHE.get(_mimeType); | |
1055 _connection._responseFields.put(HttpHeaders.CONTENT_TYPE_BUFFER,_contentType); | |
1056 } | |
1057 } | |
1058 } | 1024 } |
1059 | 1025 |
1060 /* ------------------------------------------------------------ */ | 1026 /* ------------------------------------------------------------ */ |
1061 /* | 1027 /* |
1062 * @see javax.servlet.ServletResponse#getLocale() | 1028 * @see javax.servlet.ServletResponse#getLocale() |