use of org.apache.tapestry5.services.ResponseRenderer in project tapestry-5 by apache.
the class ResponseRendererImplTest method content_type_from_component.
@Test
public void content_type_from_component() {
RequestPageCache cache = mockRequestPageCache();
PageContentTypeAnalyzer analyzer = mockPageContentTypeAnalyzer();
Component component = mockComponent();
String pageName = "foo/bar";
Page page = mockPage();
ContentType contentType = new ContentType("zig/zag");
ComponentResources resources = mockComponentResources();
train_getComponentResources(component, resources);
train_getPageName(resources, pageName);
train_get(cache, pageName, page);
train_findContentType(analyzer, page, contentType);
replay();
ResponseRenderer renderer = new ResponseRendererImpl(cache, analyzer, null);
assertSame(renderer.findContentType(component), contentType);
verify();
}
use of org.apache.tapestry5.services.ResponseRenderer in project tapestry-5 by apache.
the class ResponseRendererImplTest method render_page_markup.
@Test
public void render_page_markup() throws Exception {
RequestPageCache cache = mockRequestPageCache();
PageContentTypeAnalyzer analyzer = mockPageContentTypeAnalyzer();
String pageName = "foo/bar";
Page page = mockPage();
PageResponseRenderer pageResponseRenderer = mockPageResponseRenderer();
Response response = mockResponse();
train_get(cache, pageName, page);
pageResponseRenderer.renderPageResponse(page);
replay();
ResponseRenderer renderer = new ResponseRendererImpl(cache, analyzer, pageResponseRenderer);
renderer.renderPageMarkupResponse(pageName);
verify();
}
use of org.apache.tapestry5.services.ResponseRenderer in project tapestry-5 by apache.
the class DeferredResponseRenderer method invokeQueuedRenderer.
private void invokeQueuedRenderer() throws IOException {
while (true) {
IOOperation responseRenderer = (IOOperation) request.getAttribute(TapestryConstants.RESPONSE_RENDERER);
if (responseRenderer == null) {
break;
}
// There's a particular case where an operation puts a different operation into the attribute;
// we'll handle that on the next pass.
request.setAttribute(TapestryConstants.RESPONSE_RENDERER, null);
tracker.perform("Executing deferred response renderer.", responseRenderer);
}
}
Aggregations