org.apache.commons.httpclient.methods
Class StringRequestEntity
java.lang.Object
org.apache.commons.httpclient.methods.StringRequestEntity
- RequestEntity
public class StringRequestEntity
extends java.lang.Object
A RequestEntity that contains a String.
StringRequestEntity(String content) - Creates a new entity with the given content.
|
StringRequestEntity(String content, String contentType, String charset) - Creates a new entity with the given content, content type, and charset.
|
StringRequestEntity
public StringRequestEntity(String content)
Creates a new entity with the given content. This constructor
will use the default platform charset to convert the content string
and will provide no content type.
This constructor may be deprecated or changed to use the
default HTTP content charset (ISO-8859-1) in the release 3.1
It is strongly recommended to use
StringRequestEntity(String,String,String)
constructor
instead.
content
- The content to set.
StringRequestEntity
public StringRequestEntity(String content,
String contentType,
String charset)
throws UnsupportedEncodingException
Creates a new entity with the given content, content type, and charset.
content
- The content to set.contentType
- The type of the content, or null
. The value retured
by getContentType()
. If this content type contains a charset and the charset
parameter is null, the content's type charset will be used.charset
- The charset of the content, or null
. Used to convert the
content to bytes. If the content type does not contain a charset and charset is not null,
then the charset will be appended to the content type.
getCharset
public String getCharset()
- Returns the charset used to convert the content to bytes.
null
if
no charset as been specified.
getContent
public String getContent()
getContentType
public String getContentType()
Gets the entity's content type. This content type will be used as the value for the
"Content-Type" header.
- getContentType in interface RequestEntity
- the entity's content type
writeRequest
public void writeRequest(OutputStream out)
throws IOException
Writes the request entity to the given stream.
- writeRequest in interface RequestEntity
Copyright (c) 1999-2005 - Apache Software Foundation