Hi all, hi Thiago

a quick update from my side concerning the partial page rendering issue, just 
in case anyone facing the same problem.

Instead of modifying the DocumentLinker, I created a BlockRenderer service 
which is able to render injected Block objects as a stream response. The reason 
for this decision is, that the DocumentLinker keeps track of all necessary 
style-sheets and scripts (for example if the block contains additional 
scripts). Therefore modifying the DocumentLinker could lead to undesired side 
effects and could eventually break the zone feature.

Reference how to render a block:
http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/Howto-render-a-block-and-put-it-into-a-JSON-reply-tp5486823p5717877.html

The problem is, that this solution uses T5 internals and which are subject to 
change.

There is already an associated ticket in JIRA:
https://issues.apache.org/jira/browse/TAP5-1864

Thilo

________________________________________
From: Thilo Tanner
Sent: Friday, November 08, 2013 10:40
To: Tapestry users
Subject: RE: [5.4] Render Partial HTML Pages

Hi Thiago,

thanks a lot for your feedback. The application is based on Bootstrap 3 and 
therefore I enabled the core stack by default.

I will therefore create a patch and file a JIRA issue.

Best regards,

Thilo


________________________________________
From: Thiago H de Paula Figueiredo <thiag...@gmail.com>
Sent: Wednesday, November 06, 2013 12:46
To: Tapestry users
Subject: Re: [5.4] Render Partial HTML Pages

On Wed, 06 Nov 2013 07:48:10 -0200, Thilo Tanner <th...@dienststelle.ch>
wrote:

> Dear Tapestry Developers / Users,

Hi!

Does your page import stylesheets or JavaScript directly? Or through
components it uses? If the answers are "no", you can disable the addition
of the core stack. Since alpha 24, there's a symbol for that:
SymbolConstants.INCLUDE_CORE_STACK (tapestry.include-core-stack), which
defaults to true.

Otherwise, I think we can solve this in Tapestry itself by adding some way
to disable DocumentLinker from working in a given request. Please file a
JIRA about it.

>
> I have a question concerning partial HTML rendering without using zones
> using 5.4. Until alpha 24, the following code was working:
>
> @Inject private Block page;
>
> @Inject private Block modal;
>
> public Object getActiveBlock() {
>     return request.isXHR() ? modal : page;
> }
>
> The modal block consists of a <div> element. Using plain jQuery or
> http://pjax.heroku.com/ I was able to replace parts of the page with the
> HTML snippet rendered by T5. The good thing is, that the entire page is
> loaded in case of a normal request and the partial HTML is very easy to
> debug.
>
> The part of the code which prevents the rendering now is in
> DocumentLinkerImpl:
>
> // This only applies when the document is an HTML document. This may
> need to change in the
> // future, perhaps configurable, to allow for html and xhtml and perhaps
> others. Does SVG
> // use stylesheets?
>
> if (!rootElementName.equals("html")) {
>      throw new RuntimeException(String.format("The root element of the
> rendered document was <%s>, not <html>. A root element of <html> is
> needed when linking JavaScript and stylesheet resources.",
> rootElementName));
> }
>
> My question: is there a way to render partial HTML pages without using
> zones or decorate the DocumentLinker service?
>
> What about introducing a Symbol which allows partial HTML rendering? If
> you're interested I can submit a pull request.
>
> Thanks and best regards,
>
> Thilo
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to