Пример #1
0
 /**
  * Creates a StringEntityHC4 with the specified content and charset. The MIME type defaults to
  * "text/plain".
  *
  * @param string content to be used. Not {@code null}.
  * @param charset character set to be used. May be {@code null}, in which case the default is
  *     {@link HTTP#DEFAULT_CONTENT_CHARSET} is assumed
  * @throws IllegalArgumentException if the string parameter is null
  * @throws UnsupportedCharsetException Thrown when the named charset is not available in this
  *     instance of the Java virtual machine
  */
 public StringEntityHC4(final String string, final String charset)
     throws UnsupportedCharsetException {
   this(string, ContentType.create(ContentType.TEXT_PLAIN.getMimeType(), charset));
 }
Пример #2
0
 /**
  * Creates a StringEntityHC4 with the specified content and charset. The MIME type defaults to
  * "text/plain".
  *
  * @param string content to be used. Not {@code null}.
  * @param charset character set to be used. May be {@code null}, in which case the default is
  *     {@link HTTP#DEFAULT_CONTENT_CHARSET} is assumed
  * @throws IllegalArgumentException if the string parameter is null
  * @since 4.2
  */
 public StringEntityHC4(final String string, final Charset charset) {
   this(string, ContentType.create(ContentType.TEXT_PLAIN.getMimeType(), charset));
 }
 @Override
 public void setup(HttpServletResponse response) {
   response.setContentType(ContentType.TEXT_PLAIN.toString());
 }