/** * This determines the charset for <code>PrintStream</code> objects * returned from the <code>getPrintStream</code> method. This will * return a valid charset regardless of whether the Content-Type * header has been set, set without a charset, or not set at all. * If unspecified, the charset returned is <code>ISO-8859-1</code>, * as suggested by RFC 2616, section 3.7.1. * * @return returns the charset used by this response object */ private String getCharset() { ContentType type = getContentType(); if(type == null) { return "ISO-8859-1"; } if(type.getCharset()==null){ return "ISO-8859-1"; } return type.getCharset(); }
/** * This determines the charset for <code>PrintStream</code> objects * returned from the <code>getPrintStream</code> method. This will * return a valid charset regardless of whether the Content-Type * header has been set, set without a charset, or not set at all. * If unspecified, the charset returned is <code>ISO-8859-1</code>, * as suggested by RFC 2616, section 3.7.1. * * @return returns the charset used by this response object */ private String getCharset() { ContentType type = getContentType(); if(type == null) { return "ISO-8859-1"; } if(type.getCharset()==null){ return "ISO-8859-1"; } return type.getCharset(); }
/** * This determines the charset for <code>PrintStream</code> objects * returned from the <code>getPrintStream</code> method. This will * return a valid charset regardless of whether the Content-Type * header has been set, set without a charset, or not set at all. * If unspecified, the charset returned is <code>ISO-8859-1</code>, * as suggested by RFC 2616, section 3.7.1. * * @return returns the charset used by this response object */ private String getCharset() { ContentType type = getContentType(); if(type == null) { return "ISO-8859-1"; } if(type.getCharset()==null){ return "ISO-8859-1"; } return type.getCharset(); }
/** * This is used to get the content body. This will essentially get * the content from the body and present it as a single string. * The encoding of the string is determined from the content type * charset value. If the charset is not supported this will throw * an exception. Typically only text values should be extracted * using this method if there is a need to parse that content. * * @param type this is the content type used with the request * * @return the input stream containing the message body */ public String getContent(ContentType type) throws IOException { String charset = type.getCharset(); if(charset == null) { charset = "ISO-8859-1"; } return body.getContent(charset); }
/** * This is used to get the content body. This will essentially get * the content from the body and present it as a single string. * The encoding of the string is determined from the content type * charset value. If the charset is not supported this will throw * an exception. Typically only text values should be extracted * using this method if there is a need to parse that content. * * @param type this is the content type used with the request * * @return the input stream containing the message body */ public String getContent(ContentType type) throws IOException { String charset = type.getCharset(); if(charset == null) { charset = "ISO-8859-1"; } return body.getContent(charset); }
/** * This is used to get the content body. This will essentially get * the content from the body and present it as a single string. * The encoding of the string is determined from the content type * charset value. If the charset is not supported this will throw * an exception. Typically only text values should be extracted * using this method if there is a need to parse that content. * * @param type this is the content type used with the request * * @return the input stream containing the message body */ public String getContent(ContentType type) throws IOException { String charset = type.getCharset(); if(charset == null) { charset = "ISO-8859-1"; } return body.getContent(charset); }