public class RequestPartBodySnippet extends AbstractBodySnippet
Snippet
that documents the body of a request part.Constructor and Description |
---|
RequestPartBodySnippet(java.lang.String partName)
Creates a new
RequestPartBodySnippet that will document the body of the
request part with the given partName . |
RequestPartBodySnippet(java.lang.String partName,
java.util.Map<java.lang.String,java.lang.Object> attributes)
Creates a new
RequestPartBodySnippet that will document the body of the
request part with the given partName . |
RequestPartBodySnippet(java.lang.String partName,
PayloadSubsectionExtractor<?> subsectionExtractor)
Creates a new
RequestPartBodySnippet that will document the subsection of
the body of the request part with the given partName extracted by the given
subsectionExtractor . |
RequestPartBodySnippet(java.lang.String partName,
PayloadSubsectionExtractor<?> subsectionExtractor,
java.util.Map<java.lang.String,java.lang.Object> attributes)
Creates a new
RequestPartBodySnippet that will document the body of the
request part with the given partName . |
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 RequestPartBodySnippet(java.lang.String partName)
RequestPartBodySnippet
that will document the body of the
request part with the given partName
.partName
- the name of the request partpublic RequestPartBodySnippet(java.lang.String partName, PayloadSubsectionExtractor<?> subsectionExtractor)
RequestPartBodySnippet
that will document the subsection of
the body of the request part with the given partName
extracted by the given
subsectionExtractor
.partName
- the name of the request partsubsectionExtractor
- the subsection extractorpublic RequestPartBodySnippet(java.lang.String partName, java.util.Map<java.lang.String,java.lang.Object> attributes)
RequestPartBodySnippet
that will document the body of the
request part with the given partName
. The given additional
attributes
will be included in the model during template rendering.partName
- the name of the request partattributes
- the additional attributespublic RequestPartBodySnippet(java.lang.String partName, PayloadSubsectionExtractor<?> subsectionExtractor, java.util.Map<java.lang.String,java.lang.Object> attributes)
RequestPartBodySnippet
that will document the body of the
request part with the given partName
. The subsection of the body extracted
by the given subsectionExtractor
will be documented and the given
additional attributes
that will be included in the model during template
rendering.partName
- the name of the request partsubsectionExtractor
- the subsection extractorattributes
- the additional attributesprotected byte[] getContent(Operation operation) throws java.io.IOException
AbstractBodySnippet
operation
.getContent
in class AbstractBodySnippet
operation
- the operationjava.io.IOException
- if the content cannot be extractedprotected org.springframework.http.MediaType getContentType(Operation operation)
AbstractBodySnippet
operation
.getContentType
in class AbstractBodySnippet
operation
- the operation