本文整理汇总了Java中org.springframework.restdocs.operation.OperationRequest类的典型用法代码示例。如果您正苦于以下问题:Java OperationRequest类的具体用法?Java OperationRequest怎么用?Java OperationRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OperationRequest类属于org.springframework.restdocs.operation包,在下文中一共展示了OperationRequest类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateModel
import org.springframework.restdocs.operation.OperationRequest; //导入依赖的package包/类
public Map<String, Object> generateModel(Operation operation, RamlResourceSnippetParameters parameters) {
final OperationRequest request = operation.getRequest();
if (!StringUtils.isEmpty(request.getContentAsString())) {
Map<String, Object> model = new HashMap<>();
model.put("requestBodyFileName", getRequestFileName(operation.getName()));
model.put("requestBodyPresent", true);
model.put("contentTypeRequest", request.getHeaders().getContentType().getType() + "/" + request.getHeaders().getContentType().getSubtype());
if (!parameters.getRequestFields().isEmpty()) {
validateRequestFieldsAndInferTypeInformation(operation, parameters);
model.put("requestFieldsPresent", true);
if (shouldGenerateRequestSchemaFile(operation, parameters)) {
model.put("requestSchemaFileName", getRequestSchemaFileName(operation.getName()));
}
}
return model;
}
return emptyMap();
}
示例2: buildRequest
import org.springframework.restdocs.operation.OperationRequest; //导入依赖的package包/类
private OperationRequest buildRequest() {
List<OperationRequestPart> parts = new ArrayList<>();
for (OperationRequestPartBuilder builder : this.partBuilders) {
parts.add(builder.buildPart());
}
return new OperationRequestFactory().create(this.requestUri, this.method,
this.content, this.headers, this.parameters, parts);
}
示例3: preprocess
import org.springframework.restdocs.operation.OperationRequest; //导入依赖的package包/类
@Override
public OperationRequest preprocess(OperationRequest request) {
return new OperationRequestAdapter(request) {
@Override
public URI getUri() {
URI uri = delegate.getUri();
try {
return new URI(scheme, uri.getUserInfo(), host, port, uri.getPath(), uri.getQuery(), uri.getFragment());
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
};
}
示例4: OperationRequestAdapter
import org.springframework.restdocs.operation.OperationRequest; //导入依赖的package包/类
public OperationRequestAdapter(OperationRequest delegate) {
this.delegate = delegate;
}