Package org.apache.tapestry5.services
Interface PartialTemplateRenderer
-
- All Known Implementing Classes:
PartialTemplateRendererImpl
public interface PartialTemplateRenderer
Service that provides methods that renderBlocks (<t:block>in the template), component instances andRenderCommands to aStringororg.apache.tapestry5.dom.Documentin a programatic way. This service was created for situations in which a page or component needs to generate some markup that wouldn't be rendered normally, but for external use, such as e-mails, returning HTML for AJAX requests or passing HTML instead of plain string for anAlert. The name of this interface comes from TAP5-938: Expose ability to render a portion of a page (a Block, Component, etc.) without using internal services.- Since:
- 5.4
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Stringrender(java.lang.Object object)Renders an object, probably aBlockor component instance, to a string.DocumentrenderAsDocument(java.lang.Object object)Renders an object to aDocumentfollowing the same rules asrender(Object)This method supposes any kind of initialization needed was already done.
-
-
-
Method Detail
-
render
java.lang.String render(java.lang.Object object)
Renders an object, probably aBlockor component instance, to a string. This method supposes any kind of initialization needed was already done. CSS and JavaScript inclusions or importings are ignored. The object must implementRenderCommandor being able to be coerced to it byTypeCoercer.- Parameters:
object- an object, probably aBlockor component instance orRenderCommand.- Throws:
java.lang.IllegalArgumentException- if the object isn't aRenderCommandand cannot be coerced to it byTypeCoercer.
-
renderAsDocument
Document renderAsDocument(java.lang.Object object)
Renders an object to aDocumentfollowing the same rules asrender(Object)This method supposes any kind of initialization needed was already done. CSS and JavaScript inclusions or importings are ignored.- Parameters:
object- to render, aRenderCommand, or coercible to one- Returns:
- a
Document.
-
-