You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Andrew Robinson <an...@gmail.com> on 2008/02/25 05:02:58 UTC

[Trinidad] Is it possible to PPR the tr:document?

I am attempting to create a 100% AJAX interfaces to my application,
that not only includes page updates but navigation as well.

If 2 of my pages share the same facelets template, I am fine. If the
user is navigating between two unrelated templates I want to PPR the
entire page. In order to do this, I use the RequestContext
addPartialTarget(UIComponent) method with the UIXDocument.

The problem is that the PPR framework of Trinidad is not escaping any
CDATA blocks in the response. As a result the CDATA block terminates
early.

The beginning of the response content:

<?xml version="1.0" ?>
<?Tr-XHR-Response-Type ?>
<content action="/test-app/test.jsf"> <fragment><![CDATA[<html
xmlns="http://www.w3.org/1999/xhtml"
 dir="ltr" xml:lang="en">
      <head>
        <meta name="generator" content="Apache Trinidad">
...

"]]>" appear inside this CDATA block (nested blocks from the
document's scripts).

I presume this is a bug, or am I missing something?

trinidad 1.2.7-SNAPSHOT

-Andrew

Re: [Trinidad] Is it possible to PPR the tr:document?

Posted by Andrew Robinson <an...@gmail.com>.
For anyone who read this reply, please note that I was naive and
thought the URL hash would be sent to the server. It is not. So
refresh & bookmarking is still problematic, but back & forward can be
handled gracefully.

-Andrew

On Mon, Feb 25, 2008 at 8:59 AM, Andrew Robinson
<an...@gmail.com> wrote:
> Well, I am just starting it, and it is a bit hard to incorporate into
>  myfaces (facelets requirement, servlet filter and a custom view root),
>  but I may blog on it. The gist is:
>
>  1) Custom ViewHandler to re-use UIViewRoot if the template doesn't change
>  2) Custom UISubview component that uses a TagHandler based on the
>  DecoratorHandler of Facelets that forces a PPR of a template region
>  when either
>  2a) the view has changed (so PPR template "zones") or
>  2b) the included file has changed
>  3) use of widow.location.hash to have browser back-forward history as
>  well as bookmarking (see the filter below)
>  4) Custom JavaScript interval that checks the page hash to see if the
>  user has hit back or forward
>  5) Custom servlet filter to alter the hash of a URL into a different
>  URL and query string to keep 3rd party JSF libraries like Seam happy
>  (I may be able to do this in the ViewHandler, but I'll have to see)
>  6) Custom code tied with an XML configuration file to tie viewIds to a
>  hash and to the base template to use.
>
>  It would be quite a bit of work to make this open source
>  (documentation, more flexible API, more reusable, etc.) and also a
>  long blog, but when I get done I'll see if I have the energy. I do a
>  lot of things on the side, so even more open source work may not fit
>  in to my schedule, but I'll see what I can do.
>
>  If the team lets me, I may add a new project onto Trinidad's offering
>  that is more of an optional controller library that requires facelets
>  and then ask ppl. for help to clean it up to get it to public
>  consumption quality.
>
>  -Andrew
>
>
>
>  On Mon, Feb 25, 2008 at 2:42 AM, Danny Robinson
>  <da...@gmail.com> wrote:
>  > Andrew,
>  >
>  > Any chance you could share a how-to on this - or at least some tips.  It's
>  > something we've seen in past projects also.
>  >
>  > Thanks,
>  > Danny
>  >
>  >
>  >
>  > On Sun, Feb 24, 2008 at 11:13 PM, Andrew Robinson
>  > <an...@gmail.com> wrote:
>  >
>  > > Ignore this thread
>  > >
>  > > Sorry, as long as the UIView root is not re-used the partial target
>  > > code is not needed
>  > >
>  > >
>  > >
>  > >
>  > > On Sun, Feb 24, 2008 at 9:02 PM, Andrew Robinson
>  > > <an...@gmail.com> wrote:
>  > > > I am attempting to create a 100% AJAX interfaces to my application,
>  > > >  that not only includes page updates but navigation as well.
>  > > >
>  > > >  If 2 of my pages share the same facelets template, I am fine. If the
>  > > >  user is navigating between two unrelated templates I want to PPR the
>  > > >  entire page. In order to do this, I use the RequestContext
>  > > >  addPartialTarget(UIComponent) method with the UIXDocument.
>  > > >
>  > > >  The problem is that the PPR framework of Trinidad is not escaping any
>  > > >  CDATA blocks in the response. As a result the CDATA block terminates
>  > > >  early.
>  > > >
>  > > >  The beginning of the response content:
>  > > >
>  > > >  <?xml version="1.0" ?>
>  > > >  <?Tr-XHR-Response-Type ?>
>  > > >  <content action="/test-app/test.jsf"> <fragment><![CDATA[<html
>  > > >  xmlns="http://www.w3.org/1999/xhtml"
>  > > >   dir="ltr" xml:lang="en">
>  > > >       <head>
>  > > >         <meta name="generator" content="Apache Trinidad">
>  > > >  ...
>  > > >
>  > > >  "]]>" appear inside this CDATA block (nested blocks from the
>  > > >  document's scripts).
>  > > >
>  > > >  I presume this is a bug, or am I missing something?
>  > > >
>  > > >  trinidad 1.2.7-SNAPSHOT
>  > > >
>  > > >  -Andrew
>  > > >
>  > >
>  >
>  >
>  >
>  > --
>  > Chordiant Software Inc.
>  > www.chordiant.com
>

Re: [Trinidad] Is it possible to PPR the tr:document?

Posted by Andrew Robinson <an...@gmail.com>.
Well, I am just starting it, and it is a bit hard to incorporate into
myfaces (facelets requirement, servlet filter and a custom view root),
but I may blog on it. The gist is:

1) Custom ViewHandler to re-use UIViewRoot if the template doesn't change
2) Custom UISubview component that uses a TagHandler based on the
DecoratorHandler of Facelets that forces a PPR of a template region
when either
2a) the view has changed (so PPR template "zones") or
2b) the included file has changed
3) use of widow.location.hash to have browser back-forward history as
well as bookmarking (see the filter below)
4) Custom JavaScript interval that checks the page hash to see if the
user has hit back or forward
5) Custom servlet filter to alter the hash of a URL into a different
URL and query string to keep 3rd party JSF libraries like Seam happy
(I may be able to do this in the ViewHandler, but I'll have to see)
6) Custom code tied with an XML configuration file to tie viewIds to a
hash and to the base template to use.

It would be quite a bit of work to make this open source
(documentation, more flexible API, more reusable, etc.) and also a
long blog, but when I get done I'll see if I have the energy. I do a
lot of things on the side, so even more open source work may not fit
in to my schedule, but I'll see what I can do.

If the team lets me, I may add a new project onto Trinidad's offering
that is more of an optional controller library that requires facelets
and then ask ppl. for help to clean it up to get it to public
consumption quality.

-Andrew

On Mon, Feb 25, 2008 at 2:42 AM, Danny Robinson
<da...@gmail.com> wrote:
> Andrew,
>
> Any chance you could share a how-to on this - or at least some tips.  It's
> something we've seen in past projects also.
>
> Thanks,
> Danny
>
>
>
> On Sun, Feb 24, 2008 at 11:13 PM, Andrew Robinson
> <an...@gmail.com> wrote:
>
> > Ignore this thread
> >
> > Sorry, as long as the UIView root is not re-used the partial target
> > code is not needed
> >
> >
> >
> >
> > On Sun, Feb 24, 2008 at 9:02 PM, Andrew Robinson
> > <an...@gmail.com> wrote:
> > > I am attempting to create a 100% AJAX interfaces to my application,
> > >  that not only includes page updates but navigation as well.
> > >
> > >  If 2 of my pages share the same facelets template, I am fine. If the
> > >  user is navigating between two unrelated templates I want to PPR the
> > >  entire page. In order to do this, I use the RequestContext
> > >  addPartialTarget(UIComponent) method with the UIXDocument.
> > >
> > >  The problem is that the PPR framework of Trinidad is not escaping any
> > >  CDATA blocks in the response. As a result the CDATA block terminates
> > >  early.
> > >
> > >  The beginning of the response content:
> > >
> > >  <?xml version="1.0" ?>
> > >  <?Tr-XHR-Response-Type ?>
> > >  <content action="/test-app/test.jsf"> <fragment><![CDATA[<html
> > >  xmlns="http://www.w3.org/1999/xhtml"
> > >   dir="ltr" xml:lang="en">
> > >       <head>
> > >         <meta name="generator" content="Apache Trinidad">
> > >  ...
> > >
> > >  "]]>" appear inside this CDATA block (nested blocks from the
> > >  document's scripts).
> > >
> > >  I presume this is a bug, or am I missing something?
> > >
> > >  trinidad 1.2.7-SNAPSHOT
> > >
> > >  -Andrew
> > >
> >
>
>
>
> --
> Chordiant Software Inc.
> www.chordiant.com

Re: [Trinidad] Is it possible to PPR the tr:document?

Posted by Danny Robinson <da...@gmail.com>.
Andrew,

Any chance you could share a how-to on this - or at least some tips.  It's
something we've seen in past projects also.

Thanks,
Danny

On Sun, Feb 24, 2008 at 11:13 PM, Andrew Robinson <
andrew.rw.robinson@gmail.com> wrote:

> Ignore this thread
>
> Sorry, as long as the UIView root is not re-used the partial target
> code is not needed
>
> On Sun, Feb 24, 2008 at 9:02 PM, Andrew Robinson
> <an...@gmail.com> wrote:
> > I am attempting to create a 100% AJAX interfaces to my application,
> >  that not only includes page updates but navigation as well.
> >
> >  If 2 of my pages share the same facelets template, I am fine. If the
> >  user is navigating between two unrelated templates I want to PPR the
> >  entire page. In order to do this, I use the RequestContext
> >  addPartialTarget(UIComponent) method with the UIXDocument.
> >
> >  The problem is that the PPR framework of Trinidad is not escaping any
> >  CDATA blocks in the response. As a result the CDATA block terminates
> >  early.
> >
> >  The beginning of the response content:
> >
> >  <?xml version="1.0" ?>
> >  <?Tr-XHR-Response-Type ?>
> >  <content action="/test-app/test.jsf"> <fragment><![CDATA[<html
> >  xmlns="http://www.w3.org/1999/xhtml"
> >   dir="ltr" xml:lang="en">
> >       <head>
> >         <meta name="generator" content="Apache Trinidad">
> >  ...
> >
> >  "]]>" appear inside this CDATA block (nested blocks from the
> >  document's scripts).
> >
> >  I presume this is a bug, or am I missing something?
> >
> >  trinidad 1.2.7-SNAPSHOT
> >
> >  -Andrew
> >
>



-- 
Chordiant Software Inc.
www.chordiant.com

Re: [Trinidad] Is it possible to PPR the tr:document?

Posted by Andrew Robinson <an...@gmail.com>.
Ignore this thread

Sorry, as long as the UIView root is not re-used the partial target
code is not needed

On Sun, Feb 24, 2008 at 9:02 PM, Andrew Robinson
<an...@gmail.com> wrote:
> I am attempting to create a 100% AJAX interfaces to my application,
>  that not only includes page updates but navigation as well.
>
>  If 2 of my pages share the same facelets template, I am fine. If the
>  user is navigating between two unrelated templates I want to PPR the
>  entire page. In order to do this, I use the RequestContext
>  addPartialTarget(UIComponent) method with the UIXDocument.
>
>  The problem is that the PPR framework of Trinidad is not escaping any
>  CDATA blocks in the response. As a result the CDATA block terminates
>  early.
>
>  The beginning of the response content:
>
>  <?xml version="1.0" ?>
>  <?Tr-XHR-Response-Type ?>
>  <content action="/test-app/test.jsf"> <fragment><![CDATA[<html
>  xmlns="http://www.w3.org/1999/xhtml"
>   dir="ltr" xml:lang="en">
>       <head>
>         <meta name="generator" content="Apache Trinidad">
>  ...
>
>  "]]>" appear inside this CDATA block (nested blocks from the
>  document's scripts).
>
>  I presume this is a bug, or am I missing something?
>
>  trinidad 1.2.7-SNAPSHOT
>
>  -Andrew
>