public class RequestBodySnippet extends AbstractBodySnippet
Snippet
that documents the body of a request.Constructor and Description |
---|
RequestBodySnippet()
Creates a new
RequestBodySnippet . |
RequestBodySnippet(Map<String,Object> attributes)
Creates a new
RequestBodySnippet with the given additional
attributes that will be included in the model during template rendering. |
RequestBodySnippet(PayloadSubsectionExtractor<?> subsectionExtractor)
Creates a new
RequestBodySnippet that will document the subsection of the
request body extracted by the given subsectionExtractor . |
RequestBodySnippet(PayloadSubsectionExtractor<?> subsectionExtractor,
Map<String,Object> attributes)
Creates a new
RequestBodySnippet that will document the subsection of the
request 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 RequestBodySnippet()
RequestBodySnippet
.public RequestBodySnippet(PayloadSubsectionExtractor<?> subsectionExtractor)
RequestBodySnippet
that will document the subsection of the
request body extracted by the given subsectionExtractor
.subsectionExtractor
- the subsection extractorpublic RequestBodySnippet(Map<String,Object> attributes)
RequestBodySnippet
with the given additional
attributes
that will be included in the model during template rendering.attributes
- The additional attributespublic RequestBodySnippet(PayloadSubsectionExtractor<?> subsectionExtractor, Map<String,Object> attributes)
RequestBodySnippet
that will document the subsection of the
request 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