当前位置: 首页>>代码示例>>Java>>正文


Java RestDocumentationContextPlaceholderResolverFactory类代码示例

本文整理汇总了Java中org.springframework.restdocs.snippet.RestDocumentationContextPlaceholderResolverFactory的典型用法代码示例。如果您正苦于以下问题:Java RestDocumentationContextPlaceholderResolverFactory类的具体用法?Java RestDocumentationContextPlaceholderResolverFactory怎么用?Java RestDocumentationContextPlaceholderResolverFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RestDocumentationContextPlaceholderResolverFactory类属于org.springframework.restdocs.snippet包,在下文中一共展示了RestDocumentationContextPlaceholderResolverFactory类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: build

import org.springframework.restdocs.snippet.RestDocumentationContextPlaceholderResolverFactory; //导入依赖的package包/类
public Operation build() {
	if (this.attributes.get(TemplateEngine.class.getName()) == null) {
		Map<String, Object> templateContext = new HashMap<>();
		templateContext.put("tableCellContent",
				new AsciidoctorTableCellContentLambda());
		this.attributes.put(TemplateEngine.class.getName(),
				new MustacheTemplateEngine(
						new StandardTemplateResourceResolver(this.templateFormat),
						Mustache.compiler().escapeHTML(false), templateContext));
	}
	RestDocumentationContext context = createContext();
	this.attributes.put(RestDocumentationContext.class.getName(), context);
	this.attributes.put(WriterResolver.class.getName(),
			new StandardWriterResolver(
					new RestDocumentationContextPlaceholderResolverFactory(), "UTF-8",
					this.templateFormat));
	return new StandardOperation(this.name,
			(this.requestBuilder == null
					? new OperationRequestBuilder("http://localhost/").buildRequest()
					: this.requestBuilder.buildRequest()),
			this.responseBuilder == null
					? new OperationResponseBuilder().buildResponse()
					: this.responseBuilder.buildResponse(),
			this.attributes);
}
 
开发者ID:ePages-de,项目名称:restdocs-raml,代码行数:26,代码来源:OperationBuilder.java

示例2: build

import org.springframework.restdocs.snippet.RestDocumentationContextPlaceholderResolverFactory; //导入依赖的package包/类
public Operation build() {
	if (this.attributes.get(TemplateEngine.class.getName()) == null) {
		Map<String, Object> templateContext = new HashMap<>();
		templateContext.put("tableCellContent",
				new AsciidoctorTableCellContentLambda());
		this.attributes.put(TemplateEngine.class.getName(),
				new MustacheTemplateEngine(
						new StandardTemplateResourceResolver(this.templateFormat),
						Mustache.compiler().escapeHTML(false), templateContext));
	}
	RestDocumentationContext context = createContext();
	this.attributes.put(RestDocumentationContext.class.getName(), context);
	this.attributes.put(WriterResolver.class.getName(),
			new StandardWriterResolver(
					new RestDocumentationContextPlaceholderResolverFactory(), "UTF-8",
					this.templateFormat));
	return new StandardOperation(this.name,
			(this.requestBuilder == null
					? new OperationRequestBuilder("http://localhost/").buildRequest()
					: this.requestBuilder.buildRequest()),
			this.responseBuilder.buildResponse(), this.attributes);
}
 
开发者ID:ePages-de,项目名称:restdocs-wiremock,代码行数:23,代码来源:OperationBuilder.java

示例3: documentSnippet

import org.springframework.restdocs.snippet.RestDocumentationContextPlaceholderResolverFactory; //导入依赖的package包/类
private void documentSnippet(Operation operation) throws IOException {

        WriterResolver writerResolver = new StandardWriterResolver(new RestDocumentationContextPlaceholderResolverFactory(), DEFAULT_SNIPPET_ENCODING, new RamlTemplateFormat());
        try (Writer writer = writerResolver.resolve(operation.getName(), SNIPPET_NAME,
                (RestDocumentationContext) operation.getAttributes().get(RestDocumentationContext.class.getName()))) {
            Map<String, Object> model = createModel(operation);
            TemplateEngine templateEngine = new MustacheTemplateEngine(new StandardTemplateResourceResolver(new RamlTemplateFormat()));
            writer.append(templateEngine.compileTemplate(SNIPPET_NAME).render(model));
        }
    }
 
开发者ID:ePages-de,项目名称:restdocs-raml,代码行数:11,代码来源:RamlResourceSnippet.java

示例4: document

import org.springframework.restdocs.snippet.RestDocumentationContextPlaceholderResolverFactory; //导入依赖的package包/类
@Override
public void document(Operation operation) throws IOException {
	RestDocumentationContext context = (RestDocumentationContext) operation.getAttributes()
			.get(RestDocumentationContext.class.getName());
	WriterResolver writerResolver = new StandardWriterResolver(
			new RestDocumentationContextPlaceholderResolverFactory(), "UTF-8", TEMPLATE_FORMAT);
	try (Writer writer = writerResolver.resolve(operation.getName(), SNIPPET_NAME, context)) {
		writer.append(toJsonString(operation));
	}
}
 
开发者ID:ePages-de,项目名称:restdocs-wiremock,代码行数:11,代码来源:WireMockJsonSnippet.java


注:本文中的org.springframework.restdocs.snippet.RestDocumentationContextPlaceholderResolverFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。