public class ResponseBodySnippet extends AbstractBodySnippet
Snippet
that documents the body of a response.Constructor and Description |
---|
ResponseBodySnippet()
Creates a new
ResponseBodySnippet . |
ResponseBodySnippet(Map<String,Object> attributes)
Creates a new
ResponseBodySnippet with the given additional
attributes that will be included in the model during template rendering. |
ResponseBodySnippet(PayloadSubsectionExtractor<?> subsectionExtractor)
Creates a new
ResponseBodySnippet that will document the subsection of the
response body extracted by the given subsectionExtractor . |
ResponseBodySnippet(PayloadSubsectionExtractor<?> subsectionExtractor,
Map<String,Object> attributes)
Creates a new
ResponseBodySnippet that will document the subsection of the
response body extracted by the given subsectionExtractor . |
Modifier and Type | Method and Description |
---|---|
protected byte[] |
getContent(Operation operation)
Returns the content of the request or response extracted from the given
operation . |
protected org.springframework.http.MediaType |
getContentType(Operation operation)
Returns the content type of the request or response extracted from the given
operation . |
createModel
document, getAttributes, getSnippetName
public ResponseBodySnippet()
ResponseBodySnippet
.public ResponseBodySnippet(PayloadSubsectionExtractor<?> subsectionExtractor)
ResponseBodySnippet
that will document the subsection of the
response body extracted by the given subsectionExtractor
.subsectionExtractor
- the subsection extractorpublic ResponseBodySnippet(Map<String,Object> attributes)
ResponseBodySnippet
with the given additional
attributes
that will be included in the model during template rendering.attributes
- The additional attributespublic ResponseBodySnippet(PayloadSubsectionExtractor<?> subsectionExtractor, Map<String,Object> attributes)
ResponseBodySnippet
that will document the subsection of the
response body extracted by the given subsectionExtractor
. The given
additional attributes
that will be included in the model during template
rendering.subsectionExtractor
- the subsection extractorattributes
- The additional attributesprotected byte[] getContent(Operation operation) throws IOException
AbstractBodySnippet
operation
.getContent
in class AbstractBodySnippet
operation
- The operationIOException
- if the content cannot be extractedprotected org.springframework.http.MediaType getContentType(Operation operation)
AbstractBodySnippet
operation
.getContentType
in class AbstractBodySnippet
operation
- The operation