org.apache.commons.httpclient.methods

Class StringRequestEntity

public class StringRequestEntity extends Object implements RequestEntity

A RequestEntity that contains a String.

Since: 3.0

Constructor Summary
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.
Method Summary
StringgetCharset()
StringgetContent()
longgetContentLength()
StringgetContentType()
booleanisRepeatable()
voidwriteRequest(OutputStream out)

Constructor Detail

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 {@link #StringRequestEntity(String, String, String)} constructor instead.

Parameters: content The content to set.

See Also:

StringRequestEntity

public StringRequestEntity(String content, String contentType, String charset)
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 {@link #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.

Method Detail

getCharset

public String getCharset()

Returns: Returns the charset used to convert the content to bytes. null if no charset as been specified.

getContent

public String getContent()

Returns: Returns the content.

getContentLength

public long getContentLength()

Returns: The length of the content.

getContentType

public String getContentType()

isRepeatable

public boolean isRepeatable()

Returns: true

writeRequest

public void writeRequest(OutputStream out)
Copyright (c) 1999-2005 - Apache Software Foundation