public class RestDocumentationResultHandler extends Object implements ResultHandler
ResultHandler for documenting RESTful APIs.RestDocumentation.document(String)| Modifier and Type | Method and Description |
|---|---|
void |
handle(MvcResult result) |
RestDocumentationResultHandler |
withLinks(LinkDescriptor... descriptors)
Document the links in the response using the given
descriptors. |
RestDocumentationResultHandler |
withLinks(LinkExtractor linkExtractor,
LinkDescriptor... descriptors)
Document the links in the response using the given
descriptors. |
RestDocumentationResultHandler |
withQueryParameters(ParameterDescriptor... descriptors)
Documents the parameters in the request's query string using the given
descriptors. |
RestDocumentationResultHandler |
withRequestFields(FieldDescriptor... descriptors)
Document the fields in the request using the given
descriptors. |
RestDocumentationResultHandler |
withResponseFields(FieldDescriptor... descriptors)
Document the fields in the response using the given
descriptors. |
public RestDocumentationResultHandler withLinks(LinkDescriptor... descriptors)
descriptors. The links
are extracted from the response based on its content type.
If a link is present in the response but is not described by one of the descriptors a failure will occur when this handler is invoked. Similarly, if a link is described but is not present in the response a failure will also occur when this handler is invoked.
descriptors - the link descriptorsthisHypermediaDocumentation.linkWithRel(String),
LinkExtractors.extractorForContentType(String)public RestDocumentationResultHandler withLinks(LinkExtractor linkExtractor, LinkDescriptor... descriptors)
descriptors. The links
are extracted from the response using the given linkExtractor.
If a link is present in the response but is not described by one of the descriptors a failure will occur when this handler is invoked. Similarly, if a link is described but is not present in the response a failure will also occur when this handler is invoked.
linkExtractor - used to extract the links from the responsedescriptors - the link descriptorsthisHypermediaDocumentation.linkWithRel(String)public RestDocumentationResultHandler withRequestFields(FieldDescriptor... descriptors)
descriptors.
If a field is present in the request but is not described by one of the descriptors a failure will occur when this handler is invoked. Similarly, if a field is described but is not present in the request a failure will also occur when this handler is invoked.
descriptors - the link descriptorsthisPayloadDocumentation.fieldWithPath(String)public RestDocumentationResultHandler withResponseFields(FieldDescriptor... descriptors)
descriptors.
If a field is present in the response but is not described by one of the descriptors a failure will occur when this handler is invoked. Similarly, if a field is described but is not present in the response a failure will also occur when this handler is invoked.
descriptors - the link descriptorsthisPayloadDocumentation.fieldWithPath(String)public RestDocumentationResultHandler withQueryParameters(ParameterDescriptor... descriptors)
descriptors.
If a parameter is present in the query string but is not described by one of the descriptors a failure will occur when this handler is invoked. Similarly, if a parameter is described but is not present in the request a failure will also occur when this handler is invoked.
descriptors - the parameter descriptorsthisRequestDocumentation.parameterWithName(String)public void handle(MvcResult result) throws Exception
handle in interface ResultHandlerException