use of org.apache.tapestry5.internal.structure.Page in project tapestry-5 by apache.
the class PageRenderRequestHandlerImpl method handle.
public void handle(PageRenderRequestParameters parameters) throws IOException {
Page page = cache.get(parameters.getLogicalPageName());
if (request.getAttribute(InternalConstants.BYPASS_ACTIVATION) == null) {
if (pageActivator.activatePage(page.getRootElement().getComponentResources(), parameters.getActivationContext(), resultProcessor)) {
return;
}
if (!parameters.isLoopback()) {
page.pageReset();
}
}
pageResponseRenderer.renderPageResponse(page);
}
use of org.apache.tapestry5.internal.structure.Page in project tapestry-5 by apache.
the class RequestPageCacheImpl method get.
public Page get(String pageName) {
String canonical = resolver.canonicalizePageName(pageName);
Page page = cache.get(canonical);
if (page == null) {
page = pageSource.getPage(canonical);
try {
page.attached();
} catch (Throwable t) {
throw new RuntimeException(String.format("Unable to attach page %s: %s", canonical, ExceptionUtils.toMessage(t)), t);
}
cache.put(canonical, page);
}
// A bit of a hack but whatever.
if (canonical.equals(requestGlobals.getActivePageName())) {
requestGlobals.getRequest().setAttribute(InternalConstants.ACTIVE_PAGE_LOADED, true);
}
return page;
}
use of org.apache.tapestry5.internal.structure.Page in project tapestry-5 by apache.
the class RequestSecurityManagerImpl method checkForInsecurePageRenderRequest.
public boolean checkForInsecurePageRenderRequest(PageRenderRequestParameters parameters) throws IOException {
if (!needsRedirect(parameters.getLogicalPageName()))
return false;
// Page is secure but request is not, so redirect.
Link link = componentEventLinkEncoder.createPageRenderLink(parameters);
response.sendRedirect(link);
return true;
}
use of org.apache.tapestry5.internal.structure.Page in project tapestry-5 by apache.
the class RenderCommandComponentEventResultProcessor method renderMarkup.
/**
* As a filter, this class does three things:
* <ul>
* <li>It creates an outer element to capture the partial page content that will be rendered</li>
* <li>It does setup and cleanup with the {@link AjaxFormUpdateController}</li>
* <li>It extracts the child markup and stuffs it into the reply's "content" property.</li>
* </ul>
*/
public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer) {
// The partial will quite often contain multiple elements (or just a block of plain text),
// so those must be enclosed in a root element.
Element root = writer.element("ajax-partial");
ajaxFormUpdateController.setupBeforePartialZoneRender(writer);
renderer.renderMarkup(writer, reply);
ajaxFormUpdateController.cleanupAfterPartialZoneRender();
writer.end();
String content = root.getChildMarkup().trim();
reply.put("content", content);
}
use of org.apache.tapestry5.internal.structure.Page in project tapestry-5 by apache.
the class BeanBlockSourceImplTest method found_edit_block.
@Test
public void found_edit_block() {
Block block = mockBlock();
RequestPageCache cache = mockRequestPageCache();
Page page = mockPage();
BeanBlockContribution contribution = new EditBlockContribution("mydata", "MyPage", "mydisplay");
Collection<BeanBlockContribution> configuration = newList(contribution);
train_get(cache, "MyPage", page);
train_getBlock(page, "mydisplay", block);
replay();
BeanBlockSource source = new BeanBlockSourceImpl(cache, createBeanBlockOverrideSource(cache), configuration);
// Check case insensitivity while we are at it.
Block actual = source.getEditBlock("MyData");
assertSame(actual, block);
verify();
}
Aggregations