You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Dude.Checkitout" <du...@gmail.com> on 2009/01/29 17:19:42 UTC

How to override Tapestry's DocumentLinker ?

We have a requirement of tml file being delivered without <html> as the root
context. As I read the tapestry source, this validation is done in the
DocumentLinker.

In contributeMarkupRenderer method:
        MarkupRendererFilter documentLinker = new MarkupRendererFilter()
        {
            public void renderMarkup(MarkupWriter writer, MarkupRenderer
renderer)
            {
                DocumentLinkerImpl linker = new
DocumentLinkerImpl(productionMode, scriptsAtTop);

                environment.push(DocumentLinker.class, linker);

                renderer.renderMarkup(writer);

                environment.pop(DocumentLinker.class);

                linker.updateDocument(writer.getDocument());
            }
        };


Is there anyway I can override my own DocumentLinker with Tapestry's
DocumentLinker?

In the Post,  "http://n2.nabble.com/-T5--A-root-element-of-<html
-is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762">http://n2.nabble.com/-T5--A-root-element-of-<html>-is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762   
Howard said we can override the internal DocumentLinker.  

Can anybody suggest me on how to do?





-- 
View this message in context: http://n2.nabble.com/How-to-override-Tapestry%27s-DocumentLinker---tp2239793p2239793.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


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


Re: How to override Tapestry's DocumentLinker ?

Posted by "Dude.Checkitout" <du...@gmail.com>.

Fernando fix did the trick.   

configuration.add( "CustomDocumentLinker", mydoclinker,
"after:DocumentLinker,before:RenderSupport" );

Thanks a lot!  I am missing the "override" option in 5.0.18!



Fernando Padilla wrote:
> 
> To be honest, I can't remember exactly when the override came into play 
> ( so it might be worth double checking with eclipse, though I'm pretty 
> sure it's 5.1.0.0 ).
> 
> The other option is to place your DocumentLinker in between the default 
> DocumentLinker and RenderSupport.  Maybe try this:
> 
> configuration.add( "CustomDocumentLinker", mydoclinker, 
> "after:DocumentLinker,before:RenderSupport" );
> 
> 
> 
> 
> Dude.Checkitout wrote:
>> 
>> I am using 5.0.18 version and not ready to move to 5.1 yet. Is there any
>> way
>> to override the DocumentLinker in the 5.0.18 version?
>> 
>> 
>> Fernando Padilla wrote:
>>> Ok cool.
>>>
>>> with the latest version of tapestry (5.1.0.0-SNAPSHOT), they did add a 
>>> proper way to override contributions.  Below is the code we're using for 
>>> us to override our DocumentLinker.  Please be aware that the override 
>>> works, but it seems to trash all of the previous relative directives ( 
>>> before, after, declared by overridden service, or any other service 
>>> relative to it), that's why we declared "before:RenderSupport", to make 
>>> sure the MarkupRenderer order is still correct.
>>>
>>> public void contributeMarkupRenderer( 
>>> OrderedConfiguration<MarkupRendererFilter> configuration ) {
>>> configuration.override( "DocumentLinker", new CustomDocumentLinker(), 
>>> "before:RenderSupport" );
>>> }
>>>
>>>
>>>
>>> Dude.Checkitout wrote:
>>>> Thank you for the quick reply. We are using tapestry to generate a
>>>> section of
>>>> a html page.  We can enforce the requirement of having an root node.
>>>>
>>>> Basically, the requirement will be to accept the root node to be
>>>> anything.
>>>> (not only html)
>>>> I created my own CustomDocumentLinker extending from the tapestry
>>>> DocumentLinker and modified the code to fit our needs. But I have no
>>>> idea
>>>> how to make Tapestry to use CustomerDocumentLinker instead of its own
>>>> DocumentLinker.
>>>>
>>>> Any help in this will be appreciated.
>>>>
>>>>
>>>>
>>>> Fernando Padilla wrote:
>>>>> I have lots of experience playing with that :)  (since we publish to 
>>>>> html, fbml).  Here are some questions:
>>>>>
>>>>> 1) do your documents have a root node?  what is it?
>>>>>
>>>>> 2) do you want to change the behavior of how it includes javascript
>>>>> and 
>>>>> css?  Or just have it work with non-html root nodes?
>>>>>
>>>>>
>>>>>
>>>>> Dude.Checkitout wrote:
>>>>>> We have a requirement of tml file being delivered without <html> as
>>>>>> the
>>>>>> root
>>>>>> context. As I read the tapestry source, this validation is done in
>>>>>> the
>>>>>> DocumentLinker.
>>>>>>
>>>>>> In contributeMarkupRenderer method:
>>>>>>         MarkupRendererFilter documentLinker = new
>>>>>> MarkupRendererFilter()
>>>>>>         {
>>>>>>             public void renderMarkup(MarkupWriter writer,
>>>>>> MarkupRenderer
>>>>>> renderer)
>>>>>>             {
>>>>>>                 DocumentLinkerImpl linker = new
>>>>>> DocumentLinkerImpl(productionMode, scriptsAtTop);
>>>>>>
>>>>>>                 environment.push(DocumentLinker.class, linker);
>>>>>>
>>>>>>                 renderer.renderMarkup(writer);
>>>>>>
>>>>>>                 environment.pop(DocumentLinker.class);
>>>>>>
>>>>>>                 linker.updateDocument(writer.getDocument());
>>>>>>             }
>>>>>>         };
>>>>>>
>>>>>>
>>>>>> Is there anyway I can override my own DocumentLinker with Tapestry's
>>>>>> DocumentLinker?
>>>>>>
>>>>>> In the Post,  "http://n2.nabble.com/-T5--A-root-element-of-<html
>>>>>> -is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762">http://n2.nabble.com/-T5--A-root-element-of-<html>-is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762   
>>>>>> Howard said we can override the internal DocumentLinker.  
>>>>>>
>>>>>> Can anybody suggest me on how to do?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/How-to-override-Tapestry%27s-DocumentLinker---tp2239793p2240529.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


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


Re: How to override Tapestry's DocumentLinker ?

Posted by Fernando Padilla <fe...@alum.mit.edu>.
To be honest, I can't remember exactly when the override came into play 
( so it might be worth double checking with eclipse, though I'm pretty 
sure it's 5.1.0.0 ).

The other option is to place your DocumentLinker in between the default 
DocumentLinker and RenderSupport.  Maybe try this:

configuration.add( "CustomDocumentLinker", mydoclinker, 
"after:DocumentLinker,before:RenderSupport" );




Dude.Checkitout wrote:
> 
> I am using 5.0.18 version and not ready to move to 5.1 yet. Is there any way
> to override the DocumentLinker in the 5.0.18 version?
> 
> 
> Fernando Padilla wrote:
>> Ok cool.
>>
>> with the latest version of tapestry (5.1.0.0-SNAPSHOT), they did add a 
>> proper way to override contributions.  Below is the code we're using for 
>> us to override our DocumentLinker.  Please be aware that the override 
>> works, but it seems to trash all of the previous relative directives ( 
>> before, after, declared by overridden service, or any other service 
>> relative to it), that's why we declared "before:RenderSupport", to make 
>> sure the MarkupRenderer order is still correct.
>>
>> public void contributeMarkupRenderer( 
>> OrderedConfiguration<MarkupRendererFilter> configuration ) {
>> configuration.override( "DocumentLinker", new CustomDocumentLinker(), 
>> "before:RenderSupport" );
>> }
>>
>>
>>
>> Dude.Checkitout wrote:
>>> Thank you for the quick reply. We are using tapestry to generate a
>>> section of
>>> a html page.  We can enforce the requirement of having an root node.
>>>
>>> Basically, the requirement will be to accept the root node to be
>>> anything.
>>> (not only html)
>>> I created my own CustomDocumentLinker extending from the tapestry
>>> DocumentLinker and modified the code to fit our needs. But I have no idea
>>> how to make Tapestry to use CustomerDocumentLinker instead of its own
>>> DocumentLinker.
>>>
>>> Any help in this will be appreciated.
>>>
>>>
>>>
>>> Fernando Padilla wrote:
>>>> I have lots of experience playing with that :)  (since we publish to 
>>>> html, fbml).  Here are some questions:
>>>>
>>>> 1) do your documents have a root node?  what is it?
>>>>
>>>> 2) do you want to change the behavior of how it includes javascript and 
>>>> css?  Or just have it work with non-html root nodes?
>>>>
>>>>
>>>>
>>>> Dude.Checkitout wrote:
>>>>> We have a requirement of tml file being delivered without <html> as the
>>>>> root
>>>>> context. As I read the tapestry source, this validation is done in the
>>>>> DocumentLinker.
>>>>>
>>>>> In contributeMarkupRenderer method:
>>>>>         MarkupRendererFilter documentLinker = new
>>>>> MarkupRendererFilter()
>>>>>         {
>>>>>             public void renderMarkup(MarkupWriter writer,
>>>>> MarkupRenderer
>>>>> renderer)
>>>>>             {
>>>>>                 DocumentLinkerImpl linker = new
>>>>> DocumentLinkerImpl(productionMode, scriptsAtTop);
>>>>>
>>>>>                 environment.push(DocumentLinker.class, linker);
>>>>>
>>>>>                 renderer.renderMarkup(writer);
>>>>>
>>>>>                 environment.pop(DocumentLinker.class);
>>>>>
>>>>>                 linker.updateDocument(writer.getDocument());
>>>>>             }
>>>>>         };
>>>>>
>>>>>
>>>>> Is there anyway I can override my own DocumentLinker with Tapestry's
>>>>> DocumentLinker?
>>>>>
>>>>> In the Post,  "http://n2.nabble.com/-T5--A-root-element-of-<html
>>>>> -is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762">http://n2.nabble.com/-T5--A-root-element-of-<html>-is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762   
>>>>> Howard said we can override the internal DocumentLinker.  
>>>>>
>>>>> Can anybody suggest me on how to do?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
> 

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


Re: How to override Tapestry's DocumentLinker ?

Posted by "Dude.Checkitout" <du...@gmail.com>.

I am using 5.0.18 version and not ready to move to 5.1 yet. Is there any way
to override the DocumentLinker in the 5.0.18 version?


Fernando Padilla wrote:
> 
> Ok cool.
> 
> with the latest version of tapestry (5.1.0.0-SNAPSHOT), they did add a 
> proper way to override contributions.  Below is the code we're using for 
> us to override our DocumentLinker.  Please be aware that the override 
> works, but it seems to trash all of the previous relative directives ( 
> before, after, declared by overridden service, or any other service 
> relative to it), that's why we declared "before:RenderSupport", to make 
> sure the MarkupRenderer order is still correct.
> 
> public void contributeMarkupRenderer( 
> OrderedConfiguration<MarkupRendererFilter> configuration ) {
> configuration.override( "DocumentLinker", new CustomDocumentLinker(), 
> "before:RenderSupport" );
> }
> 
> 
> 
> Dude.Checkitout wrote:
>> Thank you for the quick reply. We are using tapestry to generate a
>> section of
>> a html page.  We can enforce the requirement of having an root node.
>> 
>> Basically, the requirement will be to accept the root node to be
>> anything.
>> (not only html)
>> I created my own CustomDocumentLinker extending from the tapestry
>> DocumentLinker and modified the code to fit our needs. But I have no idea
>> how to make Tapestry to use CustomerDocumentLinker instead of its own
>> DocumentLinker.
>> 
>> Any help in this will be appreciated.
>> 
>> 
>> 
>> Fernando Padilla wrote:
>>> I have lots of experience playing with that :)  (since we publish to 
>>> html, fbml).  Here are some questions:
>>>
>>> 1) do your documents have a root node?  what is it?
>>>
>>> 2) do you want to change the behavior of how it includes javascript and 
>>> css?  Or just have it work with non-html root nodes?
>>>
>>>
>>>
>>> Dude.Checkitout wrote:
>>>> We have a requirement of tml file being delivered without <html> as the
>>>> root
>>>> context. As I read the tapestry source, this validation is done in the
>>>> DocumentLinker.
>>>>
>>>> In contributeMarkupRenderer method:
>>>>         MarkupRendererFilter documentLinker = new
>>>> MarkupRendererFilter()
>>>>         {
>>>>             public void renderMarkup(MarkupWriter writer,
>>>> MarkupRenderer
>>>> renderer)
>>>>             {
>>>>                 DocumentLinkerImpl linker = new
>>>> DocumentLinkerImpl(productionMode, scriptsAtTop);
>>>>
>>>>                 environment.push(DocumentLinker.class, linker);
>>>>
>>>>                 renderer.renderMarkup(writer);
>>>>
>>>>                 environment.pop(DocumentLinker.class);
>>>>
>>>>                 linker.updateDocument(writer.getDocument());
>>>>             }
>>>>         };
>>>>
>>>>
>>>> Is there anyway I can override my own DocumentLinker with Tapestry's
>>>> DocumentLinker?
>>>>
>>>> In the Post,  "http://n2.nabble.com/-T5--A-root-element-of-<html
>>>> -is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762">http://n2.nabble.com/-T5--A-root-element-of-<html>-is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762   
>>>> Howard said we can override the internal DocumentLinker.  
>>>>
>>>> Can anybody suggest me on how to do?
>>>>
>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/How-to-override-Tapestry%27s-DocumentLinker---tp2239793p2240439.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


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


Re: How to override Tapestry's DocumentLinker ?

Posted by Fernando Padilla <fe...@alum.mit.edu>.
Ok cool.

with the latest version of tapestry (5.1.0.0-SNAPSHOT), they did add a 
proper way to override contributions.  Below is the code we're using for 
us to override our DocumentLinker.  Please be aware that the override 
works, but it seems to trash all of the previous relative directives ( 
before, after, declared by overridden service, or any other service 
relative to it), that's why we declared "before:RenderSupport", to make 
sure the MarkupRenderer order is still correct.

public void contributeMarkupRenderer( 
OrderedConfiguration<MarkupRendererFilter> configuration ) {
configuration.override( "DocumentLinker", new CustomDocumentLinker(), 
"before:RenderSupport" );
}



Dude.Checkitout wrote:
> Thank you for the quick reply. We are using tapestry to generate a section of
> a html page.  We can enforce the requirement of having an root node.
> 
> Basically, the requirement will be to accept the root node to be anything.
> (not only html)
> I created my own CustomDocumentLinker extending from the tapestry
> DocumentLinker and modified the code to fit our needs. But I have no idea
> how to make Tapestry to use CustomerDocumentLinker instead of its own
> DocumentLinker.
> 
> Any help in this will be appreciated.
> 
> 
> 
> Fernando Padilla wrote:
>> I have lots of experience playing with that :)  (since we publish to 
>> html, fbml).  Here are some questions:
>>
>> 1) do your documents have a root node?  what is it?
>>
>> 2) do you want to change the behavior of how it includes javascript and 
>> css?  Or just have it work with non-html root nodes?
>>
>>
>>
>> Dude.Checkitout wrote:
>>> We have a requirement of tml file being delivered without <html> as the
>>> root
>>> context. As I read the tapestry source, this validation is done in the
>>> DocumentLinker.
>>>
>>> In contributeMarkupRenderer method:
>>>         MarkupRendererFilter documentLinker = new MarkupRendererFilter()
>>>         {
>>>             public void renderMarkup(MarkupWriter writer, MarkupRenderer
>>> renderer)
>>>             {
>>>                 DocumentLinkerImpl linker = new
>>> DocumentLinkerImpl(productionMode, scriptsAtTop);
>>>
>>>                 environment.push(DocumentLinker.class, linker);
>>>
>>>                 renderer.renderMarkup(writer);
>>>
>>>                 environment.pop(DocumentLinker.class);
>>>
>>>                 linker.updateDocument(writer.getDocument());
>>>             }
>>>         };
>>>
>>>
>>> Is there anyway I can override my own DocumentLinker with Tapestry's
>>> DocumentLinker?
>>>
>>> In the Post,  "http://n2.nabble.com/-T5--A-root-element-of-<html
>>> -is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762">http://n2.nabble.com/-T5--A-root-element-of-<html>-is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762   
>>> Howard said we can override the internal DocumentLinker.  
>>>
>>> Can anybody suggest me on how to do?
>>>
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
> 

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


Re: How to override Tapestry's DocumentLinker ?

Posted by "Dude.Checkitout" <du...@gmail.com>.

Can anybody throw some light on this issue? I am stuck and not moving
forward...



Dude.Checkitout wrote:
> 
> Fernando, need your expertise help!  I thought the following trick
> configuration.add( "CustomDocumentLinker", mydoclinker,
> "after:DocumentLinker,before:RenderSupport" ); 
> worked.  
> 
> Looks like it is not working in all conditions. It runs fine for a while,
> then out of nowhere I start getting the same root <html> required error. 
> 
> The strange (may be for me) thing I observed is, it fails only on pages
> which has Tapestry forms.
> (we have read only/display version of pages - which seems to work fine in
> all cases).
> 
> Once it starts giving this root <html> error, the whole application
> reports the same error. (all pages which has tapestry form in it).   FYI,
> I have more than one tapestry application running on the same JBoss
> server. Just curious, if it messes up things.
> 
> I am stuck and any help would be greatly appreciated!
> 
> 
> Fernando Padilla wrote:
>> 
>> yah, this is little confusing, since it will place the CustomLinker 
>> first in the list of filters.. :)  But they "execute" as they come out 
>> of the list.. :)
>> 
>> CustomLinker -> DocumentLinker -> RenderSupport -> PAGERENDER
>> 
>> So as the page render unfurls, it gives control to RenderSupport to 
>> modify the DOM, then DocumentLinker, then CustomLinker.  And the 
>> document linkers really don't do anything by themselves, and require a 
>> RenderSupport to feed them the script/css links.  So the RenderSupport 
>> filter would call environment.peekRequired(DocumentLinker.class), which 
>> would return the deepest DocumentLinker at the moment (the default, not 
>> the Custom one)..
>> 
>> So yeah a little confusing.. :) :)
>> 
>> 
>> Thiago H. de Paula Figueiredo wrote:
>>> Em Thu, 29 Jan 2009 15:14:40 -0300, Fernando Padilla <fe...@alum.mit.edu> 
>>> escreveu:
>>> 
>>>> No.  DocumentLinker would be run first ( deeper in the markup filter 
>>>> chain ), it would be the only one that RenderSupport would bind to ( 
>>>> RenderSupport does a environment.peekRequired ).  So only that 
>>>> DocumentLinker would do it's stuff.
>>> 
>>> Even when the custom document linker is explicitly added to the 
>>> OrderedConfiguration *before* the normal DocumentLinker? If yes, well, 
>>> the contribution overriding mechanism in T5.1 will be extra handy . . .
>>> :)
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/How-to-override-Tapestry%27s-DocumentLinker---tp2239793p2259379.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


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


Re: How to override Tapestry's DocumentLinker ?

Posted by "Dude.Checkitout" <du...@gmail.com>.

 /app/page:anyEvent  => will fire an event named "anyEvent" on the Page.
This method returns void.

At the end of this event, tapestry issues redirect, and rendering should
happen in that request.

And you are correct that I don't see this URL and I see the final redirected
page URL.

In the above scenario, i would just need to patch up the markupRenderer
configuration.. and where else?

More confusing is why should it behave inconsistently? It works few times
and then it fails.. once fails, it fails forever...  
And in the log file, i can see clearly it is going thru DocumentLinkerImpl
and not my custom documentlinker.

java.lang.RuntimeException: The root element of the rendered document was
<div>, not <html>. A root element of <html> is needed when linking
JavaScript and stylesheet resources.
	at
org.apache.tapestry5.internal.services.DocumentLinkerImpl.addScriptElements(DocumentLinkerImpl.java:99)
	at
org.apache.tapestry5.internal.services.DocumentLinkerImpl.updateDocument(DocumentLinkerImpl.java:85)
	at
org.apache.tapestry5.services.TapestryModule$25.renderMarkup(TapestryModule.java:1499)


Thanks for spending your time on figuring out this issue. 


Fernando Padilla wrote:
> 
> See that's the weird part..
> 
> 1) render page form:
> /myapp/page1
> 2) submit form:
> /myapp/page1.form:action
> 3) form handles submit(fail or success),
>     then returns redirect to render page:
> redirect:/myapp/page1
> 4) page 1 is rendered once more.
> 
> 
> So I'm a little confused.. since you mention another event?
> 
> What does your "editMe" event handler method return?  null?  A block? a 
> page name?  It should also cause a full redirect to render the full page 
> ( so you should never see that url in the browser ).
> 
> 
> 
> Dude.Checkitout wrote:
>> Thanks for the reply!
>> 
>> I see there only two render pipelines in the TapestryModule.java.  One is
>> contributeMarkupRenderer and another one is
>> contributePartialMarkupRenderer.
>> 
>> PartialMarkupRenderer uses "PartialMarkupDocumentLinker" as the Document
>> Linker. And PartialMarkupDocumentLinker generates output as JSON. Does
>> not
>> validate against any root html nodes.
>> 
>> So my assumption was I shouldn't be needing to touch that part of
>> rendering.
>> Correct me if I am wrong.
>> 
>> We do use redirect after post modal.  The page which gives errors is
>> invoking a specific event on the page in the URL to load the page which
>> has
>> form.  
>> 
>> Example URL: /myapp/page1:editMe/somekeyvalue  
>> 
>> Is this request a action request or render request?  Which renderes will
>> it
>> use? My assumption is that this is an action event request and it will
>> just
>> invoked that event in the page and issue a redirect.
>> 
>> Am I missing any renderer? or which is the "other" renderer that I need
>> to
>> patch up?
>> 
>> 
>> 
>> 
>> Fernando Padilla wrote:
>>> Sorry for the wait.  I don't have the final answer for you, but I do 
>>> have information to share.. :)
>>>
>>> I think it'll be the same technique of overriding tapestry's document 
>>> linker, but there are two render pipelines, so you have to find the 
>>> correct place to contribute..
>>>
>>>
>>> Don't forget that Tapestry has two request handling pipelines.  One for 
>>> normal page request.  And another for component events (like form 
>>> submits) or ajax call backs (like zones).  Most likely the code that we 
>>> worked out before only covered normal page renders.  But somehow you're 
>>> hitting the component event handling oversight..
>>>
>>> The reason that i would normally not be an issue, is that component 
>>> events normally do not do any rendering, they simply send back a 
>>> redirect asking the client to request the full page, and then causing a 
>>> clean page render.. (do yo understand this point?)
>>>
>>> That is how I have it working, and probably why I did not have to deal 
>>> with it before and give you a warning.  You probably have tapestry setup 
>>> to render the page on the same request as the form submits ( instead of 
>>> returning a redirect ).
>>>
>>>
>>> Is this enough info to get you started hunting?
>>>
>>>
>>>
>>> Dude.Checkitout wrote:
>>>> Fernando, need your expertise help!  I thought the following trick
>>>> configuration.add( "CustomDocumentLinker", mydoclinker,
>>>> "after:DocumentLinker,before:RenderSupport" ); 
>>>> worked.  
>>>>
>>>> Looks like it is not working in all conditions. It runs fine for a
>>>> while,
>>>> then out of nowhere I start getting the same root <html> required
>>>> error. 
>>>>
>>>> The strange (may be for me) thing I observed is, it fails only on pages
>>>> which has Tapestry forms.
>>>> (we have read only/display version of pages - which seems to work fine
>>>> in
>>>> all cases).
>>>>
>>>> Once it starts giving this root <html> error, the whole application
>>>> reports
>>>> the same error. (all pages which has tapestry form in it).   FYI, I
>>>> have
>>>> more than one tapestry application running on the same JBoss server.
>>>> Just
>>>> curious, if it messes up things.
>>>>
>>>> I am stuck and any help would be greatly appreciated!
>>>>
>>>>
>>>> Fernando Padilla wrote:
>>>>> yah, this is little confusing, since it will place the CustomLinker 
>>>>> first in the list of filters.. :)  But they "execute" as they come out 
>>>>> of the list.. :)
>>>>>
>>>>> CustomLinker -> DocumentLinker -> RenderSupport -> PAGERENDER
>>>>>
>>>>> So as the page render unfurls, it gives control to RenderSupport to 
>>>>> modify the DOM, then DocumentLinker, then CustomLinker.  And the 
>>>>> document linkers really don't do anything by themselves, and require a 
>>>>> RenderSupport to feed them the script/css links.  So the RenderSupport 
>>>>> filter would call environment.peekRequired(DocumentLinker.class),
>>>>> which 
>>>>> would return the deepest DocumentLinker at the moment (the default,
>>>>> not 
>>>>> the Custom one)..
>>>>>
>>>>> So yeah a little confusing.. :) :)
>>>>>
>>>>>
>>>>> Thiago H. de Paula Figueiredo wrote:
>>>>>> Em Thu, 29 Jan 2009 15:14:40 -0300, Fernando Padilla
>>>>>> <fe...@alum.mit.edu> 
>>>>>> escreveu:
>>>>>>
>>>>>>> No.  DocumentLinker would be run first ( deeper in the markup filter 
>>>>>>> chain ), it would be the only one that RenderSupport would bind to ( 
>>>>>>> RenderSupport does a environment.peekRequired ).  So only that 
>>>>>>> DocumentLinker would do it's stuff.
>>>>>> Even when the custom document linker is explicitly added to the 
>>>>>> OrderedConfiguration *before* the normal DocumentLinker? If yes,
>>>>>> well, 
>>>>>> the contribution overriding mechanism in T5.1 will be extra handy . .
>>>>>> .
>>>>>> :)
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>>
>>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/How-to-override-Tapestry%27s-DocumentLinker---tp2239793p2259957.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


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


Re: How to override Tapestry's DocumentLinker ?

Posted by Fernando Padilla <fe...@alum.mit.edu>.
See that's the weird part..

1) render page form:
/myapp/page1
2) submit form:
/myapp/page1.form:action
3) form handles submit(fail or success),
    then returns redirect to render page:
redirect:/myapp/page1
4) page 1 is rendered once more.


So I'm a little confused.. since you mention another event?

What does your "editMe" event handler method return?  null?  A block? a 
page name?  It should also cause a full redirect to render the full page 
( so you should never see that url in the browser ).



Dude.Checkitout wrote:
> Thanks for the reply!
> 
> I see there only two render pipelines in the TapestryModule.java.  One is
> contributeMarkupRenderer and another one is contributePartialMarkupRenderer.
> 
> PartialMarkupRenderer uses "PartialMarkupDocumentLinker" as the Document
> Linker. And PartialMarkupDocumentLinker generates output as JSON. Does not
> validate against any root html nodes.
> 
> So my assumption was I shouldn't be needing to touch that part of rendering.
> Correct me if I am wrong.
> 
> We do use redirect after post modal.  The page which gives errors is
> invoking a specific event on the page in the URL to load the page which has
> form.  
> 
> Example URL: /myapp/page1:editMe/somekeyvalue  
> 
> Is this request a action request or render request?  Which renderes will it
> use? My assumption is that this is an action event request and it will just
> invoked that event in the page and issue a redirect.
> 
> Am I missing any renderer? or which is the "other" renderer that I need to
> patch up?
> 
> 
> 
> 
> Fernando Padilla wrote:
>> Sorry for the wait.  I don't have the final answer for you, but I do 
>> have information to share.. :)
>>
>> I think it'll be the same technique of overriding tapestry's document 
>> linker, but there are two render pipelines, so you have to find the 
>> correct place to contribute..
>>
>>
>> Don't forget that Tapestry has two request handling pipelines.  One for 
>> normal page request.  And another for component events (like form 
>> submits) or ajax call backs (like zones).  Most likely the code that we 
>> worked out before only covered normal page renders.  But somehow you're 
>> hitting the component event handling oversight..
>>
>> The reason that i would normally not be an issue, is that component 
>> events normally do not do any rendering, they simply send back a 
>> redirect asking the client to request the full page, and then causing a 
>> clean page render.. (do yo understand this point?)
>>
>> That is how I have it working, and probably why I did not have to deal 
>> with it before and give you a warning.  You probably have tapestry setup 
>> to render the page on the same request as the form submits ( instead of 
>> returning a redirect ).
>>
>>
>> Is this enough info to get you started hunting?
>>
>>
>>
>> Dude.Checkitout wrote:
>>> Fernando, need your expertise help!  I thought the following trick
>>> configuration.add( "CustomDocumentLinker", mydoclinker,
>>> "after:DocumentLinker,before:RenderSupport" ); 
>>> worked.  
>>>
>>> Looks like it is not working in all conditions. It runs fine for a while,
>>> then out of nowhere I start getting the same root <html> required error. 
>>>
>>> The strange (may be for me) thing I observed is, it fails only on pages
>>> which has Tapestry forms.
>>> (we have read only/display version of pages - which seems to work fine in
>>> all cases).
>>>
>>> Once it starts giving this root <html> error, the whole application
>>> reports
>>> the same error. (all pages which has tapestry form in it).   FYI, I have
>>> more than one tapestry application running on the same JBoss server. Just
>>> curious, if it messes up things.
>>>
>>> I am stuck and any help would be greatly appreciated!
>>>
>>>
>>> Fernando Padilla wrote:
>>>> yah, this is little confusing, since it will place the CustomLinker 
>>>> first in the list of filters.. :)  But they "execute" as they come out 
>>>> of the list.. :)
>>>>
>>>> CustomLinker -> DocumentLinker -> RenderSupport -> PAGERENDER
>>>>
>>>> So as the page render unfurls, it gives control to RenderSupport to 
>>>> modify the DOM, then DocumentLinker, then CustomLinker.  And the 
>>>> document linkers really don't do anything by themselves, and require a 
>>>> RenderSupport to feed them the script/css links.  So the RenderSupport 
>>>> filter would call environment.peekRequired(DocumentLinker.class), which 
>>>> would return the deepest DocumentLinker at the moment (the default, not 
>>>> the Custom one)..
>>>>
>>>> So yeah a little confusing.. :) :)
>>>>
>>>>
>>>> Thiago H. de Paula Figueiredo wrote:
>>>>> Em Thu, 29 Jan 2009 15:14:40 -0300, Fernando Padilla
>>>>> <fe...@alum.mit.edu> 
>>>>> escreveu:
>>>>>
>>>>>> No.  DocumentLinker would be run first ( deeper in the markup filter 
>>>>>> chain ), it would be the only one that RenderSupport would bind to ( 
>>>>>> RenderSupport does a environment.peekRequired ).  So only that 
>>>>>> DocumentLinker would do it's stuff.
>>>>> Even when the custom document linker is explicitly added to the 
>>>>> OrderedConfiguration *before* the normal DocumentLinker? If yes, well, 
>>>>> the contribution overriding mechanism in T5.1 will be extra handy . . .
>>>>> :)
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
> 

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


Re: How to override Tapestry's DocumentLinker ?

Posted by "Dude.Checkitout" <du...@gmail.com>.
Thanks for the reply!

I see there only two render pipelines in the TapestryModule.java.  One is
contributeMarkupRenderer and another one is contributePartialMarkupRenderer.

PartialMarkupRenderer uses "PartialMarkupDocumentLinker" as the Document
Linker. And PartialMarkupDocumentLinker generates output as JSON. Does not
validate against any root html nodes.

So my assumption was I shouldn't be needing to touch that part of rendering.
Correct me if I am wrong.

We do use redirect after post modal.  The page which gives errors is
invoking a specific event on the page in the URL to load the page which has
form.  

Example URL: /myapp/page1:editMe/somekeyvalue  

Is this request a action request or render request?  Which renderes will it
use? My assumption is that this is an action event request and it will just
invoked that event in the page and issue a redirect.

Am I missing any renderer? or which is the "other" renderer that I need to
patch up?




Fernando Padilla wrote:
> 
> Sorry for the wait.  I don't have the final answer for you, but I do 
> have information to share.. :)
> 
> I think it'll be the same technique of overriding tapestry's document 
> linker, but there are two render pipelines, so you have to find the 
> correct place to contribute..
> 
> 
> Don't forget that Tapestry has two request handling pipelines.  One for 
> normal page request.  And another for component events (like form 
> submits) or ajax call backs (like zones).  Most likely the code that we 
> worked out before only covered normal page renders.  But somehow you're 
> hitting the component event handling oversight..
> 
> The reason that i would normally not be an issue, is that component 
> events normally do not do any rendering, they simply send back a 
> redirect asking the client to request the full page, and then causing a 
> clean page render.. (do yo understand this point?)
> 
> That is how I have it working, and probably why I did not have to deal 
> with it before and give you a warning.  You probably have tapestry setup 
> to render the page on the same request as the form submits ( instead of 
> returning a redirect ).
> 
> 
> Is this enough info to get you started hunting?
> 
> 
> 
> Dude.Checkitout wrote:
>> Fernando, need your expertise help!  I thought the following trick
>> configuration.add( "CustomDocumentLinker", mydoclinker,
>> "after:DocumentLinker,before:RenderSupport" ); 
>> worked.  
>> 
>> Looks like it is not working in all conditions. It runs fine for a while,
>> then out of nowhere I start getting the same root <html> required error. 
>> 
>> The strange (may be for me) thing I observed is, it fails only on pages
>> which has Tapestry forms.
>> (we have read only/display version of pages - which seems to work fine in
>> all cases).
>> 
>> Once it starts giving this root <html> error, the whole application
>> reports
>> the same error. (all pages which has tapestry form in it).   FYI, I have
>> more than one tapestry application running on the same JBoss server. Just
>> curious, if it messes up things.
>> 
>> I am stuck and any help would be greatly appreciated!
>> 
>> 
>> Fernando Padilla wrote:
>>> yah, this is little confusing, since it will place the CustomLinker 
>>> first in the list of filters.. :)  But they "execute" as they come out 
>>> of the list.. :)
>>>
>>> CustomLinker -> DocumentLinker -> RenderSupport -> PAGERENDER
>>>
>>> So as the page render unfurls, it gives control to RenderSupport to 
>>> modify the DOM, then DocumentLinker, then CustomLinker.  And the 
>>> document linkers really don't do anything by themselves, and require a 
>>> RenderSupport to feed them the script/css links.  So the RenderSupport 
>>> filter would call environment.peekRequired(DocumentLinker.class), which 
>>> would return the deepest DocumentLinker at the moment (the default, not 
>>> the Custom one)..
>>>
>>> So yeah a little confusing.. :) :)
>>>
>>>
>>> Thiago H. de Paula Figueiredo wrote:
>>>> Em Thu, 29 Jan 2009 15:14:40 -0300, Fernando Padilla
>>>> <fe...@alum.mit.edu> 
>>>> escreveu:
>>>>
>>>>> No.  DocumentLinker would be run first ( deeper in the markup filter 
>>>>> chain ), it would be the only one that RenderSupport would bind to ( 
>>>>> RenderSupport does a environment.peekRequired ).  So only that 
>>>>> DocumentLinker would do it's stuff.
>>>> Even when the custom document linker is explicitly added to the 
>>>> OrderedConfiguration *before* the normal DocumentLinker? If yes, well, 
>>>> the contribution overriding mechanism in T5.1 will be extra handy . . .
>>>> :)
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/How-to-override-Tapestry%27s-DocumentLinker---tp2239793p2259702.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


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


Re: How to override Tapestry's DocumentLinker ?

Posted by Fernando Padilla <fe...@alum.mit.edu>.
Sorry for the wait.  I don't have the final answer for you, but I do 
have information to share.. :)

I think it'll be the same technique of overriding tapestry's document 
linker, but there are two render pipelines, so you have to find the 
correct place to contribute..


Don't forget that Tapestry has two request handling pipelines.  One for 
normal page request.  And another for component events (like form 
submits) or ajax call backs (like zones).  Most likely the code that we 
worked out before only covered normal page renders.  But somehow you're 
hitting the component event handling oversight..

The reason that i would normally not be an issue, is that component 
events normally do not do any rendering, they simply send back a 
redirect asking the client to request the full page, and then causing a 
clean page render.. (do yo understand this point?)

That is how I have it working, and probably why I did not have to deal 
with it before and give you a warning.  You probably have tapestry setup 
to render the page on the same request as the form submits ( instead of 
returning a redirect ).


Is this enough info to get you started hunting?



Dude.Checkitout wrote:
> Fernando, need your expertise help!  I thought the following trick
> configuration.add( "CustomDocumentLinker", mydoclinker,
> "after:DocumentLinker,before:RenderSupport" ); 
> worked.  
> 
> Looks like it is not working in all conditions. It runs fine for a while,
> then out of nowhere I start getting the same root <html> required error. 
> 
> The strange (may be for me) thing I observed is, it fails only on pages
> which has Tapestry forms.
> (we have read only/display version of pages - which seems to work fine in
> all cases).
> 
> Once it starts giving this root <html> error, the whole application reports
> the same error. (all pages which has tapestry form in it).   FYI, I have
> more than one tapestry application running on the same JBoss server. Just
> curious, if it messes up things.
> 
> I am stuck and any help would be greatly appreciated!
> 
> 
> Fernando Padilla wrote:
>> yah, this is little confusing, since it will place the CustomLinker 
>> first in the list of filters.. :)  But they "execute" as they come out 
>> of the list.. :)
>>
>> CustomLinker -> DocumentLinker -> RenderSupport -> PAGERENDER
>>
>> So as the page render unfurls, it gives control to RenderSupport to 
>> modify the DOM, then DocumentLinker, then CustomLinker.  And the 
>> document linkers really don't do anything by themselves, and require a 
>> RenderSupport to feed them the script/css links.  So the RenderSupport 
>> filter would call environment.peekRequired(DocumentLinker.class), which 
>> would return the deepest DocumentLinker at the moment (the default, not 
>> the Custom one)..
>>
>> So yeah a little confusing.. :) :)
>>
>>
>> Thiago H. de Paula Figueiredo wrote:
>>> Em Thu, 29 Jan 2009 15:14:40 -0300, Fernando Padilla <fe...@alum.mit.edu> 
>>> escreveu:
>>>
>>>> No.  DocumentLinker would be run first ( deeper in the markup filter 
>>>> chain ), it would be the only one that RenderSupport would bind to ( 
>>>> RenderSupport does a environment.peekRequired ).  So only that 
>>>> DocumentLinker would do it's stuff.
>>> Even when the custom document linker is explicitly added to the 
>>> OrderedConfiguration *before* the normal DocumentLinker? If yes, well, 
>>> the contribution overriding mechanism in T5.1 will be extra handy . . .
>>> :)
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
> 

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


Re: How to override Tapestry's DocumentLinker ?

Posted by "Dude.Checkitout" <du...@gmail.com>.
Fernando, need your expertise help!  I thought the following trick
configuration.add( "CustomDocumentLinker", mydoclinker,
"after:DocumentLinker,before:RenderSupport" ); 
worked.  

Looks like it is not working in all conditions. It runs fine for a while,
then out of nowhere I start getting the same root <html> required error. 

The strange (may be for me) thing I observed is, it fails only on pages
which has Tapestry forms.
(we have read only/display version of pages - which seems to work fine in
all cases).

Once it starts giving this root <html> error, the whole application reports
the same error. (all pages which has tapestry form in it).   FYI, I have
more than one tapestry application running on the same JBoss server. Just
curious, if it messes up things.

I am stuck and any help would be greatly appreciated!


Fernando Padilla wrote:
> 
> yah, this is little confusing, since it will place the CustomLinker 
> first in the list of filters.. :)  But they "execute" as they come out 
> of the list.. :)
> 
> CustomLinker -> DocumentLinker -> RenderSupport -> PAGERENDER
> 
> So as the page render unfurls, it gives control to RenderSupport to 
> modify the DOM, then DocumentLinker, then CustomLinker.  And the 
> document linkers really don't do anything by themselves, and require a 
> RenderSupport to feed them the script/css links.  So the RenderSupport 
> filter would call environment.peekRequired(DocumentLinker.class), which 
> would return the deepest DocumentLinker at the moment (the default, not 
> the Custom one)..
> 
> So yeah a little confusing.. :) :)
> 
> 
> Thiago H. de Paula Figueiredo wrote:
>> Em Thu, 29 Jan 2009 15:14:40 -0300, Fernando Padilla <fe...@alum.mit.edu> 
>> escreveu:
>> 
>>> No.  DocumentLinker would be run first ( deeper in the markup filter 
>>> chain ), it would be the only one that RenderSupport would bind to ( 
>>> RenderSupport does a environment.peekRequired ).  So only that 
>>> DocumentLinker would do it's stuff.
>> 
>> Even when the custom document linker is explicitly added to the 
>> OrderedConfiguration *before* the normal DocumentLinker? If yes, well, 
>> the contribution overriding mechanism in T5.1 will be extra handy . . .
>> :)
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/How-to-override-Tapestry%27s-DocumentLinker---tp2239793p2250359.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


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


Re: How to override Tapestry's DocumentLinker ?

Posted by Fernando Padilla <fe...@alum.mit.edu>.
yah, this is little confusing, since it will place the CustomLinker 
first in the list of filters.. :)  But they "execute" as they come out 
of the list.. :)

CustomLinker -> DocumentLinker -> RenderSupport -> PAGERENDER

So as the page render unfurls, it gives control to RenderSupport to 
modify the DOM, then DocumentLinker, then CustomLinker.  And the 
document linkers really don't do anything by themselves, and require a 
RenderSupport to feed them the script/css links.  So the RenderSupport 
filter would call environment.peekRequired(DocumentLinker.class), which 
would return the deepest DocumentLinker at the moment (the default, not 
the Custom one)..

So yeah a little confusing.. :) :)


Thiago H. de Paula Figueiredo wrote:
> Em Thu, 29 Jan 2009 15:14:40 -0300, Fernando Padilla <fe...@alum.mit.edu> 
> escreveu:
> 
>> No.  DocumentLinker would be run first ( deeper in the markup filter 
>> chain ), it would be the only one that RenderSupport would bind to ( 
>> RenderSupport does a environment.peekRequired ).  So only that 
>> DocumentLinker would do it's stuff.
> 
> Even when the custom document linker is explicitly added to the 
> OrderedConfiguration *before* the normal DocumentLinker? If yes, well, 
> the contribution overriding mechanism in T5.1 will be extra handy . . . :)
> 

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


Re: How to override Tapestry's DocumentLinker ?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 29 Jan 2009 15:14:40 -0300, Fernando Padilla <fe...@alum.mit.edu>  
escreveu:

> No.  DocumentLinker would be run first ( deeper in the markup filter  
> chain ), it would be the only one that RenderSupport would bind to (  
> RenderSupport does a environment.peekRequired ).  So only that  
> DocumentLinker would do it's stuff.

Even when the custom document linker is explicitly added to the  
OrderedConfiguration *before* the normal DocumentLinker? If yes, well, the  
contribution overriding mechanism in T5.1 will be extra handy . . . :)

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: How to override Tapestry's DocumentLinker ?

Posted by Fernando Padilla <fe...@alum.mit.edu>.
No.  DocumentLinker would be run first ( deeper in the markup filter 
chain ), it would be the only one that RenderSupport would bind to ( 
RenderSupport does a environment.peekRequired ).  So only that 
DocumentLinker would do it's stuff.  and the default DocumentLinker 
throws an exception if the root node is not html.. (adding an option to 
change the fail-fast, into a quiet-fail would be good)

But please be aware, like I said before, you are overriding the default 
documentLinker, so that means that your document linker would have to 
support both html root nodes, and whatever root node you want....



Thiago H. de Paula Figueiredo wrote:
> Em Thu, 29 Jan 2009 14:42:47 -0300, Dude.Checkitout 
> <du...@gmail.com> escreveu:
> 
>> I created my own CustomDocumentLinker extending from the tapestry
>> DocumentLinker and modified the code to fit our needs. But I have no idea
>> how to make Tapestry to use CustomerDocumentLinker instead of its own
>> DocumentLinker.
> 
> Contribute you own DocumentLinker to the MarkupRenderer service. 
> Something like this in your AppModule class or any other Tapestry-IoC 
> module class:
> 
> public void 
> contributePartialMarkupRenderer(OrderedConfiguration<PartialMarkupRendererFilter> 
> configuration) {
> 
>     configuration.add("CustomDocumentLinker", new CustomDocumentLinke(), 
> "before:DocumentLinker");
> 
> }
> 
> I haven't tested it, but that's what I would try. :)
> By the way, a good knowledge of Tapestry-IoC is not required to use 
> Tapestry, but it helps a lot. ;)
> 

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


Re: How to override Tapestry's DocumentLinker ?

Posted by "Dude.Checkitout" <du...@gmail.com>.
Posted the earlier question before reading your post.  Here is the code in my
AppModule:

   public void
contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter>
configuration,

            @Symbol(SymbolConstants.PRODUCTION_MODE)
            final boolean productionMode,

            @Symbol(SymbolConstants.SCRIPTS_AT_TOP)
            final boolean scriptsAtTop,
            
            @Inject final Environment environment)
    {
    	    	    
        MarkupRendererFilter myDocumentLinker = new MarkupRendererFilter()
        {
            public void renderMarkup(MarkupWriter writer, MarkupRenderer
renderer)
            {
            	MyDocumentLinkerImpl linker = new
MyDocumentLinkerImpl(productionMode, scriptsAtTop);

                environment.push(DocumentLinker.class, linker);

                renderer.renderMarkup(writer);

                environment.pop(DocumentLinker.class);

                linker.updateDocument(writer.getDocument());
            }
        };
        configuration.add("MyCustomDocumentLinker", myDocumentLinker,
"before:DocumentLinker");
       }

The above code does not seem to be working. I still get the "The root
element of the rendered document was <div>, not <html>. A root element of
<html> is needed when linking JavaScript and stylesheet resources." errors.

And MyDocumentLinkerImpl class implements the DocumentLinker interface and
has the code to not to validate for <html> as root node.

Am I missing something?


Thiago H. de Paula Figueiredo wrote:
> 
> Em Thu, 29 Jan 2009 14:42:47 -0300, Dude.Checkitout  
> <du...@gmail.com> escreveu:
> 
>> I created my own CustomDocumentLinker extending from the tapestry
>> DocumentLinker and modified the code to fit our needs. But I have no idea
>> how to make Tapestry to use CustomerDocumentLinker instead of its own
>> DocumentLinker.
> 
> Contribute you own DocumentLinker to the MarkupRenderer service. Something  
> like this in your AppModule class or any other Tapestry-IoC module class:
> 
> public void  
> contributePartialMarkupRenderer(OrderedConfiguration<PartialMarkupRendererFilter>  
> configuration) {
> 
> 	configuration.add("CustomDocumentLinker", new CustomDocumentLinke(),  
> "before:DocumentLinker");
> 
> }
> 
> I haven't tested it, but that's what I would try. :)
> By the way, a good knowledge of Tapestry-IoC is not required to use  
> Tapestry, but it helps a lot. ;)
> 
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/How-to-override-Tapestry%27s-DocumentLinker---tp2239793p2240470.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


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


Re: How to override Tapestry's DocumentLinker ?

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 29 Jan 2009 14:42:47 -0300, Dude.Checkitout  
<du...@gmail.com> escreveu:

> I created my own CustomDocumentLinker extending from the tapestry
> DocumentLinker and modified the code to fit our needs. But I have no idea
> how to make Tapestry to use CustomerDocumentLinker instead of its own
> DocumentLinker.

Contribute you own DocumentLinker to the MarkupRenderer service. Something  
like this in your AppModule class or any other Tapestry-IoC module class:

public void  
contributePartialMarkupRenderer(OrderedConfiguration<PartialMarkupRendererFilter>  
configuration) {

	configuration.add("CustomDocumentLinker", new CustomDocumentLinke(),  
"before:DocumentLinker");

}

I haven't tested it, but that's what I would try. :)
By the way, a good knowledge of Tapestry-IoC is not required to use  
Tapestry, but it helps a lot. ;)

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: How to override Tapestry's DocumentLinker ?

Posted by "Dude.Checkitout" <du...@gmail.com>.
Thank you for the quick reply. We are using tapestry to generate a section of
a html page.  We can enforce the requirement of having an root node.

Basically, the requirement will be to accept the root node to be anything.
(not only html)
I created my own CustomDocumentLinker extending from the tapestry
DocumentLinker and modified the code to fit our needs. But I have no idea
how to make Tapestry to use CustomerDocumentLinker instead of its own
DocumentLinker.

Any help in this will be appreciated.



Fernando Padilla wrote:
> 
> I have lots of experience playing with that :)  (since we publish to 
> html, fbml).  Here are some questions:
> 
> 1) do your documents have a root node?  what is it?
> 
> 2) do you want to change the behavior of how it includes javascript and 
> css?  Or just have it work with non-html root nodes?
> 
> 
> 
> Dude.Checkitout wrote:
>> We have a requirement of tml file being delivered without <html> as the
>> root
>> context. As I read the tapestry source, this validation is done in the
>> DocumentLinker.
>> 
>> In contributeMarkupRenderer method:
>>         MarkupRendererFilter documentLinker = new MarkupRendererFilter()
>>         {
>>             public void renderMarkup(MarkupWriter writer, MarkupRenderer
>> renderer)
>>             {
>>                 DocumentLinkerImpl linker = new
>> DocumentLinkerImpl(productionMode, scriptsAtTop);
>> 
>>                 environment.push(DocumentLinker.class, linker);
>> 
>>                 renderer.renderMarkup(writer);
>> 
>>                 environment.pop(DocumentLinker.class);
>> 
>>                 linker.updateDocument(writer.getDocument());
>>             }
>>         };
>> 
>> 
>> Is there anyway I can override my own DocumentLinker with Tapestry's
>> DocumentLinker?
>> 
>> In the Post,  "http://n2.nabble.com/-T5--A-root-element-of-<html
>> -is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762">http://n2.nabble.com/-T5--A-root-element-of-<html>-is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762   
>> Howard said we can override the internal DocumentLinker.  
>> 
>> Can anybody suggest me on how to do?
>> 
>> 
>> 
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/How-to-override-Tapestry%27s-DocumentLinker---tp2239793p2240257.html
Sent from the Tapestry Users mailing list archive at Nabble.com.


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


Re: How to override Tapestry's DocumentLinker ?

Posted by Fernando Padilla <fe...@alum.mit.edu>.
I have lots of experience playing with that :)  (since we publish to 
html, fbml).  Here are some questions:

1) do your documents have a root node?  what is it?

2) do you want to change the behavior of how it includes javascript and 
css?  Or just have it work with non-html root nodes?



Dude.Checkitout wrote:
> We have a requirement of tml file being delivered without <html> as the root
> context. As I read the tapestry source, this validation is done in the
> DocumentLinker.
> 
> In contributeMarkupRenderer method:
>         MarkupRendererFilter documentLinker = new MarkupRendererFilter()
>         {
>             public void renderMarkup(MarkupWriter writer, MarkupRenderer
> renderer)
>             {
>                 DocumentLinkerImpl linker = new
> DocumentLinkerImpl(productionMode, scriptsAtTop);
> 
>                 environment.push(DocumentLinker.class, linker);
> 
>                 renderer.renderMarkup(writer);
> 
>                 environment.pop(DocumentLinker.class);
> 
>                 linker.updateDocument(writer.getDocument());
>             }
>         };
> 
> 
> Is there anyway I can override my own DocumentLinker with Tapestry's
> DocumentLinker?
> 
> In the Post,  "http://n2.nabble.com/-T5--A-root-element-of-<html
> -is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762">http://n2.nabble.com/-T5--A-root-element-of-<html>-is-needed-when-linking-JavaScript-and-stylesheet-resources.-td1470668.html#a1470762   
> Howard said we can override the internal DocumentLinker.  
> 
> Can anybody suggest me on how to do?
> 
> 
> 
> 
> 

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