Attempts to parse the character set from the request header. If not set defaults to UTF-8 @return A Charset object @throws UnsupportedCharsetException if the parsed character set is invalid
()
| 322 | * @throws UnsupportedCharsetException if the parsed character set is invalid |
| 323 | */ |
| 324 | public Charset getCharset() { |
| 325 | // RFC2616 3.7 |
| 326 | for (String type : this.request.headers().getAll("Content-Type")) { |
| 327 | int idx = type.toUpperCase().indexOf("CHARSET="); |
| 328 | if (idx > 1) { |
| 329 | String charset = type.substring(idx+8); |
| 330 | return Charset.forName(charset); |
| 331 | } |
| 332 | } |
| 333 | return Charset.forName("UTF-8"); |
| 334 | } |
| 335 | |
| 336 | /** @return True if the request has content, false if not. */ |
| 337 | public boolean hasContent() { |
no outgoing calls