org.apache.commons.httpclient.methods
Class StringRequestEntity
java.lang.Object
|
+--org.apache.commons.httpclient.methods.StringRequestEntity
- All Implemented Interfaces:
- RequestEntity
- public class StringRequestEntity
- extends Object
- implements RequestEntity
A RequestEntity that contains a String.
- Since:
- 3.0
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StringRequestEntity
public StringRequestEntity(String content)
- Creates a new entity with the given content
- Parameters:
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.
- Parameters:
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.
getContentType
public String getContentType()
- Description copied from interface:
RequestEntity
- Gets the entity's content type. This content type will be used as the value for the
"Content-Type" header.
- Specified by:
getContentType
in interface RequestEntity
- Following copied from interface:
org.apache.commons.httpclient.methods.RequestEntity
- Returns:
- the entity's content type
- See Also:
HttpMethod.setRequestHeader(String, String)
isRepeatable
public boolean isRepeatable()
- Description copied from interface:
RequestEntity
- Tests if
RequestEntity.writeRequest(OutputStream)
can be called more than once.
- Specified by:
isRepeatable
in interface RequestEntity
- Returns:
true
writeRequest
public void writeRequest(OutputStream out)
throws IOException
- Description copied from interface:
RequestEntity
- Writes the request entity to the given stream.
- Specified by:
writeRequest
in interface RequestEntity
- Following copied from interface:
org.apache.commons.httpclient.methods.RequestEntity
- Parameters:
out
- - Throws:
IOException
-
getContentLength
public long getContentLength()
- Description copied from interface:
RequestEntity
- Gets the request entity's length.
- Specified by:
getContentLength
in interface RequestEntity
- Returns:
- The length of the content.
getContent
public String getContent()
- Returns:
- Returns the content.
getCharset
public String getCharset()
- Returns:
- Returns the charset used to convert the content to bytes.
null
if
no charset as been specified.
Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.