Class ContentResponse
- java.lang.Object
-
- org.gatein.pc.api.invocation.response.PortletInvocationResponse
-
- org.gatein.pc.api.invocation.response.ContentResponse
-
- Direct Known Subclasses:
FragmentResponse
public class ContentResponse extends PortletInvocationResponse
Data produced.- Version:
- $Revision: 5602 $
- Author:
- Julien Viet
-
-
Field Summary
Fields Modifier and Type Field Description static intTYPE_BYTES.static intTYPE_CHARS.static intTYPE_EMPTY.
-
Constructor Summary
Constructors Constructor Description ContentResponse(ContentResponse that, CacheControl cacheControl)ContentResponse(ResponseProperties properties, Map<String,Object> attributes, String contentType, String encoding, byte[] bytes, CacheControl cacheControl)ContentResponse(ResponseProperties properties, Map<String,Object> attributes, String contentType, String encoding, String chars, CacheControl cacheControl)ContentResponse(ResponseProperties properties, Map<String,Object> attributes, String contentType, CacheControl cacheControl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>getAttributes()byte[]getBytes()Return the bytes of the content held by the fragment.CacheControlgetCacheControl()StringgetChars()Return the chars of the content held by the fragment.StringgetContent()Return the content as a string, when the character encoding is set, it will be used for binary content, otherwise theUTF-8will be used.StringgetContent(Charset charset)Return the content as a string, the provided charset will be used for binary content.StringgetContentType()Return the content type of the generated fragment.StringgetEncoding()ResponsePropertiesgetProperties()intgetType()
-
-
-
Field Detail
-
TYPE_EMPTY
public static final int TYPE_EMPTY
.- See Also:
- Constant Field Values
-
TYPE_CHARS
public static final int TYPE_CHARS
.- See Also:
- Constant Field Values
-
TYPE_BYTES
public static final int TYPE_BYTES
.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ContentResponse
public ContentResponse(ResponseProperties properties, Map<String,Object> attributes, String contentType, String encoding, byte[] bytes, CacheControl cacheControl)
-
ContentResponse
public ContentResponse(ResponseProperties properties, Map<String,Object> attributes, String contentType, String encoding, String chars, CacheControl cacheControl)
-
ContentResponse
public ContentResponse(ResponseProperties properties, Map<String,Object> attributes, String contentType, CacheControl cacheControl)
-
ContentResponse
public ContentResponse(ContentResponse that, CacheControl cacheControl)
-
-
Method Detail
-
getEncoding
public String getEncoding()
-
getProperties
public ResponseProperties getProperties()
-
getCacheControl
public CacheControl getCacheControl()
-
getType
public int getType()
-
getContent
public String getContent() throws UnsupportedCharsetException
Return the content as a string, when the character encoding is set, it will be used for binary content, otherwise theUTF-8will be used.- Returns:
- the content
- Throws:
UnsupportedCharsetException- when the response encoding is not supported
-
getContent
public String getContent(Charset charset)
Return the content as a string, the provided charset will be used for binary content.- Returns:
- the content
-
getBytes
public byte[] getBytes() throws IllegalArgumentExceptionReturn the bytes of the content held by the fragment.- Returns:
- the bytes
- Throws:
IllegalArgumentException- if the type is not bytes
-
getChars
public String getChars() throws IllegalArgumentException
Return the chars of the content held by the fragment.- Returns:
- the chars
- Throws:
IllegalArgumentException- if the type is not chars
-
getContentType
public String getContentType()
Return the content type of the generated fragment.- Returns:
- the content type
-
-