Class StringResource
java.lang.Object
org.apache.juneau.http.classic.resource.BasicResource<StringResource>
org.apache.juneau.http.classic.resource.StringResource
- All Implemented Interfaces:
HttpEntity,HttpResource
- Direct Known Subclasses:
StringResource.Unmodifiable
A self contained, repeatable resource that obtains its content from a
String.
See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructor.StringResource(ContentType contentType, String contents) Constructor.protectedStringResource(StringResource copyFrom) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a builder for this class initialized with the contents of this bean.Returns an unmodifiable snapshot of this bean.Methods inherited from class org.apache.juneau.http.classic.resource.BasicResource
addHeader, addHeaders, asBytes, assertBytes, assertString, asString, consumeContent, copyFrom, freeze, getContent, getContentEncoding, getContentLength, getContentType, getEntity, getHeaders, isChunked, isRepeatable, isStreaming, isUnmodifiable, modify, self, setCached, setChunked, setChunked, setContent, setContent, setContentEncoding, setContentEncoding, setContentLength, setContentType, setContentType, setHeader, setHeaders, setHeaders, writeTo
-
Constructor Details
-
StringResource
public StringResource()Constructor. -
StringResource
Constructor.- Parameters:
contentType- The entity content type. Can benull to omit an explicitContent-Type header.contents- The entity contents. Can benull (treated as an empty string).
-
StringResource
Copy constructor.- Parameters:
copyFrom- The bean being copied. Must not benull .
-
-
Method Details
-
copy
Description copied from class:BasicResourceCreates a builder for this class initialized with the contents of this bean.Allows you to create a modifiable copy of this bean.
- Specified by:
copyin classBasicResource<StringResource>- Returns:
- A new builder bean.
-
unmodifiable
Description copied from class:BasicResourceReturns an unmodifiable snapshot of this bean.Idempotency: if this bean is already an unmodifiable snapshot, it is returned as-is.
- Specified by:
unmodifiablein classBasicResource<StringResource>- Returns:
- An unmodifiable snapshot of this bean, or this bean if it is already unmodifiable.
-