Return-Path: X-Original-To: apmail-myfaces-dev-archive@www.apache.org Delivered-To: apmail-myfaces-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6559D9762 for ; Wed, 14 Mar 2012 20:13:38 +0000 (UTC) Received: (qmail 71729 invoked by uid 500); 14 Mar 2012 20:13:38 -0000 Delivered-To: apmail-myfaces-dev-archive@myfaces.apache.org Received: (qmail 71691 invoked by uid 500); 14 Mar 2012 20:13:38 -0000 Mailing-List: contact dev-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list dev@myfaces.apache.org Received: (qmail 71681 invoked by uid 99); 14 Mar 2012 20:13:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Mar 2012 20:13:38 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of zoigln@googlemail.com designates 209.85.213.51 as permitted sender) Received: from [209.85.213.51] (HELO mail-yw0-f51.google.com) (209.85.213.51) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Mar 2012 20:13:31 +0000 Received: by yhnn12 with SMTP id n12so2267591yhn.10 for ; Wed, 14 Mar 2012 13:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=vH1LoIvpMkWYTLGJ++wUS4iL73xbqta8WAaz3/be+6k=; b=qMb/+NoOyDFL9iTV6R/L24L+jofaD3W6fzd3XjdUgWwXV6w3JVgFM1GDTTh+X5JX9T /CizkkoDScndpiUxu6xxCZjqioOTn9coJ6LmF1GKLcG/5gao9mDwsWV2ZX1ZOntrOxEl jgS6FNPCM6CCezkmzLd/6nI5jZ5rK1G55Iq3rq8D6Jm+xCS78aGsF2UNKXdf7u3PaxJW avFQFSN0o1TUoLQTdOJ1DMgki9BbFHAeow8igjoX0qAtf8xp37KWXYoO0qOgDtAoHGxu 0seoq1xOhRa8bge+C16ikTQieyT+G6M6OJXklXFAzgqgfRUns+LXykLmIo3naZ5mPZ74 ElFg== MIME-Version: 1.0 Received: by 10.182.86.201 with SMTP id r9mr5058681obz.8.1331755989929; Wed, 14 Mar 2012 13:13:09 -0700 (PDT) Received: by 10.182.24.130 with HTTP; Wed, 14 Mar 2012 13:13:09 -0700 (PDT) In-Reply-To: References: <7EFDA21B0072FC449D32FFDCE5367FB680CBB694DB@MBX02.scisb.isban.corp> Date: Wed, 14 Mar 2012 21:13:09 +0100 Message-ID: Subject: Re: Question about DefaultFaceletsStateManagementStrategy From: Thomas Andraschko To: MyFaces Development Content-Type: multipart/alternative; boundary=f46d0445183bb50f3304bb399ad4 X-Virus-Checked: Checked by ClamAV on apache.org --f46d0445183bb50f3304bb399ad4 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi, all right, thanks Leonardo! Regards, Thomas 2012/3/14 Leonardo Uribe > Hi > > Really I only did a "proof of concept" prototype, fixing the problems > already described and then check its performance against normal jsf. > It is not a fully functional prototype and involved some changes in > myfaces core internals. > > For now my intention in this topic is give some ideas about what can > we do. For the next release, the efforts are focused on improve > myfaces algorithm. Almost all the code has been already committed. > > Maybe after next release I'll check stateless jsf again and propose > something in MYFACES-3465. > > regards, > > Leonardo > > 2012/3/14 Thomas Andraschko : > > Hi, > > > > thanks! > > > > AFAICS you already changed code. Did you also solved this issues? Maybe > you > > could share your changes. > > > > Regards, > > > > > > Thomas > > > > 2012/3/14 Leonardo Uribe > >> > >> Hi > >> > >> In theory there exists 2 ids: the viewId without resolve, and the > >> logical viewId. The first one is the one extracted from request path, > >> and usually contains the suffix mapping (for example /home.jsf) . The > >> logical is the one that points to the real resouce, for example > >> /home.xhtml or /home.jspx or /home.xml). This is an example extracted > >> from my experiments playing with stateless jsf: > >> > >> public class StatelessViewHandler extends ViewHandlerWrapper > >> { > >> > >> @Override > >> public UIViewRoot restoreView(FacesContext context, String viewId) > >> { > >> InitialViewCache ivch =3D InitialViewCache.getInstance(context)= ; > >> ViewHandler viewHandler =3D > >> context.getApplication().getViewHandler(); > >> String logicalViewId =3D viewHandler.deriveLogicalViewId(contex= t, > >> viewId); > >> > >> if (ivch.isMarkedAsStateless(rawViewId)) > >> { > >> > >> > >> The idea is be careful an use always the logical viewId, and when you > >> are not sure call viewHandler.deriveLogicalViewId(context, viewId) . > >> > >> regards, > >> > >> Leonardo Uribe > >> > >> 2012/3/14 Thomas Andraschko : > >> > Hi Leonardo, > >> > > >> > how can i get the viewId/deriveLogicalViewId in initView()? > >> > Maybe i can change this stuff the next weeks. > >> > > >> > Thanks, > >> > Thomas > >> > > >> > > >> > 2012/3/14 Leonardo Uribe > >> >> > >> >> Hi > >> >> > >> >> 2012/3/14 PEREZ ALCAIDE JESUS : > >> >> > Hello, > >> >> > > >> >> > > >> >> > > >> >> > I=92m creating a custom ViewHandler in order to cache the compone= nt > >> >> > tree > >> >> > whenever is possible. I=92m following the idea of =93stateless JS= F=94 to > >> >> > improve > >> >> > performance. > >> >> > > >> >> > >> >> Ok. Please be sure to read the latest discussion about this topic: > >> >> > >> >> > >> >> > >> >> > http://markmail.org/message/24sbs2ltnrql7swz?q=3D[core]+discussion+about+= stateless+jsf+implementation > >> >> > >> >> > > >> >> > > >> >> > My question is about > >> >> > DefaultFaceletsStateManagementStrategy.restoreView() > >> >> > method. In this method, you are calling > >> >> > ViewMetadata.createMetadataView() > >> >> > which ends up calling ViewHandler.createView to create the > >> >> > UIViewRoot > >> >> > used > >> >> > for metadata and a ViewMetadataFacelet to populate it. > >> >> > > >> >> > > >> >> > > >> >> > But this UIViewRoot (created for metadata) is used later to build > the > >> >> > =91real=92 > >> >> > view. Why? > >> >> > > >> >> > >> >> That is for performance reasons. Suppose a request is received with > >> >> some > >> >> query params. To process them, it is only necessary to build the > >> >> metadata > >> >> and then if a navigation occur by some condition, the new view can = be > >> >> build, preventing the overhead associated with build the first view= . > >> >> > >> >> > I think that a new UIViewRoot should be created for the real view= , > >> >> > because > >> >> > metadata-view and real-view use different Facelets to populate th= e > >> >> > view. > >> >> > > >> >> > > >> >> > > >> >> > Also, in the method > >> >> > DefaultFaceletsStateManagementStrategy.restoreView() > >> >> > you > >> >> > are calling the static method > >> >> > ViewMetadata.getViewParameters(UIViewRoot) > >> >> > on > >> >> > an instance of ViewMetadata (I think this should be fixed) and th= e > >> >> > Collection of UIViewParameters returned is not processed. > >> >> > > >> >> > > >> >> > >> >> That's by JSF 2.0 spec. > >> >> > >> >> > > >> >> > I wonder if ViewMetadata should be used in this method. I cannot > see > >> >> > any > >> >> > processing related to metadata happening here. > >> >> > > >> >> > > >> >> > >> >> It should be, because if we don't Partial State Saving algorithm wi= ll > >> >> break. The > >> >> view should be build on restoreView just like the first time + upda= te > >> >> the "delta" > >> >> information. > >> >> > >> >> > > >> >> > Hope you have understood me. > >> >> > > >> >> > > >> >> > >> >> Yes, from my side, I can read the mail without problem. The idea > >> >> proposed > >> >> in "stateless JSF" is feasible, but it requires some changes like: > >> >> > >> >> - Use ConcurrentHashMap/ConcurrentLRUCache instead synchronized > blocks. > >> >> - Use buildView instead clone the view to generate a new one. > >> >> - Use a combination of viewId/deriveLogicalViewId() > >> >> > >> >> Suggestions and contributions are welcome. > >> >> > >> >> regards, > >> >> > >> >> Leonardo Uribe > >> >> > >> >> > > >> >> > > >> >> > > >> >> > Un saludo, > >> >> > > >> >> > > >> >> > > >> >> > Jes=FAs P=E9rez Alcaide > >> >> > > >> >> > Lab. Banksphere - Runtime > >> >> > > >> >> > Tlf: 91 470 5223 > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > *********************AVISO LEGAL ********************** > >> >> > Este mensaje es privado y confidencial y solamente para la person= a > a > >> >> > la > >> >> > que > >> >> > va dirigido. Si usted ha recibido este mensaje por error, no debe > >> >> > revelar, > >> >> > copiar, distribuir o usarlo en ning=FAn sentido. Le rogamos lo > >> >> > comunique > >> >> > al > >> >> > remitente y borre dicho mensaje y cualquier documento adjunto que > >> >> > pudiera > >> >> > contener. No hay renuncia a la confidencialidad ni a ning=FAn > >> >> > privilegio > >> >> > por > >> >> > causa de transmisi=F3n err=F3nea o mal funcionamiento. > >> >> > Cualquier opini=F3n expresada en este mensaje pertenece =FAnicame= nte al > >> >> > autor > >> >> > remitente, y no representa necesariamente la opini=F3n de ISBAN, = a no > >> >> > ser > >> >> > que > >> >> > expresamente se diga y el remitente est=E9 autorizado para hacerl= o. > >> >> > Los correos electr=F3nicos no son seguros, no garantizan la > >> >> > confidencialidad > >> >> > ni la correcta recepci=F3n de los mismos, dado que pueden ser > >> >> > interceptados, > >> >> > manipulados, destruidos, llegar con demora o incompletos, o con > >> >> > virus. > >> >> > ISBAN > >> >> > no se hace responsable de los cambios, alteraciones, errores u > >> >> > omisiones > >> >> > que > >> >> > pudieran hacerse al mensaje una vez enviado. > >> >> > Este mensaje s=F3lo tiene una finalidad de informaci=F3n, y no de= be > >> >> > interpretarse como una oferta de venta o de compra de valores ni = de > >> >> > instrumentos financieros relacionados. > >> >> > > >> >> > **********************DISCLAIMER***************** > >> >> > This message is private and confidential and it is intended > >> >> > exclusively > >> >> > for > >> >> > the addressee. If you receive this message by mistake, you should > not > >> >> > disseminate, distribute or copy this e-mail. Please inform the > sender > >> >> > and > >> >> > delete the message and attachments from your system. No > >> >> > confidentiality > >> >> > nor > >> >> > any privilege regarding the information is waived or lost by any > >> >> > mistransmission or malfunction. > >> >> > Any views or opinions contained in this message are solely those = of > >> >> > the > >> >> > author, and do not necessarily represent those of ISBAN, unless > >> >> > otherwise > >> >> > specifically stated and the sender is authorized to do so. > >> >> > E-mail transmission cannot be guaranteed to be secure, > confidential, > >> >> > or > >> >> > error-free, as information could be intercepted, corrupted, lost, > >> >> > destroyed, > >> >> > arrive late or incomplete, or contain viruses. ISBAN does not > accept > >> >> > responsibility for any changes, errors or omissions in the conten= ts > >> >> > of > >> >> > this > >> >> > message after it has been sent. > >> >> > This message is provided for informational purposes and should no= t > be > >> >> > construed as a solicitation or offer to buy or sell any securitie= s > or > >> >> > related financial instruments. > >> > > >> > > > > > > --f46d0445183bb50f3304bb399ad4 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi,

all right, thanks Leonardo!

Regards,
Thomas

2012/3/14 Leonardo Uribe <= lu4242@gmail.com>
Hi

Really I only did a "proof of concept" prototype, fixing the prob= lems
already described and then check its performance against normal jsf.
It is not a fully functional prototype and involved some changes in
myfaces core internals.

For now my intention in this topic is give some ideas about what can
we do. For the next release, the efforts are focused on improve
myfaces algorithm. Almost all the code has been already committed.

Maybe after next release I'll check stateless jsf again and propose
something in MYFACES-3465.

regards,

Leonardo

2012/3/14 Thomas Andraschko <zo= igln@googlemail.com>:
> Hi,
>
> thanks!
>
> AFAICS you already changed code. Did you also solved this issues? Mayb= e you
> could share your changes.
>
> Regards,
>
>
> Thomas
>
> 2012/3/14 Leonardo Uribe <lu424= 2@gmail.com>
>>
>> Hi
>>
>> In theory there exists 2 ids: the viewId without resolve, and the<= br> >> logical viewId. The first one is the one extracted from request pa= th,
>> and usually contains the suffix mapping (for example /home.jsf) . = The
>> logical is the one that points to the real resouce, for example >> /home.xhtml or /home.jspx or /home.xml). This is an example extrac= ted
>> from my experiments playing with stateless jsf:
>>
>> public class StatelessViewHandler extends ViewHandlerWrapper
>> {
>>
>> =A0 =A0@Override
>> =A0 =A0public UIViewRoot restoreView(FacesContext context, String = viewId)
>> =A0 =A0{
>> =A0 =A0 =A0 =A0InitialViewCache ivch =3D InitialViewCache.getInsta= nce(context);
>> =A0 =A0 =A0 =A0ViewHandler viewHandler =3D
>> context.getApplication().getViewHandler();
>> =A0 =A0 =A0 =A0String logicalViewId =3D viewHandler.deriveLogicalV= iewId(context,
>> viewId);
>>
>> =A0 =A0 =A0 =A0if (ivch.isMarkedAsStateless(rawViewId))
>> =A0 =A0 =A0 =A0{
>>
>>
>> The idea is be careful an use always the logical viewId, and when = you
>> are not sure call viewHandler.deriveLogicalViewId(context, viewId)= .
>>
>> regards,
>>
>> Leonardo Uribe
>>
>> 2012/3/14 Thomas Andraschko <zoigln@googlemail.com>:
>> > Hi Leonardo,
>> >
>> > how can i get the viewId/deriveLogicalViewId in initView()? >> > Maybe i can change this stuff the next weeks.
>> >
>> > Thanks,
>> > Thomas
>> >
>> >
>> > 2012/3/14 Leonardo Uribe <lu4242@gmail.com>
>> >>
>> >> Hi
>> >>
>> >> 2012/3/14 PEREZ ALCAIDE JESUS <jperealc@servexternos.isban.es>:
>> >> > Hello,
>> >> >
>> >> >
>> >> >
>> >> > I=92m creating a custom ViewHandler in order to cach= e the component
>> >> > tree
>> >> > whenever is possible. I=92m following the idea of = =93stateless JSF=94 to
>> >> > improve
>> >> > performance.
>> >> >
>> >>
>> >> Ok. Please be sure to read the latest discussion about th= is topic:
>> >>
>> >>
>> >>
>> >> = http://markmail.org/message/24sbs2ltnrql7swz?q=3D[core]+discussion+about+st= ateless+jsf+implementation
>> >>
>> >> >
>> >> >
>> >> > My question is about
>> >> > DefaultFaceletsStateManagementStrategy.restoreView()=
>> >> > method. In this method, you are calling
>> >> > ViewMetadata.createMetadataView()
>> >> > =A0which ends up calling ViewHandler.createView to c= reate the
>> >> > UIViewRoot
>> >> > used
>> >> > for metadata and a ViewMetadataFacelet to populate i= t.
>> >> >
>> >> >
>> >> >
>> >> > But this UIViewRoot (created for metadata) is used l= ater to build the
>> >> > =91real=92
>> >> > view. Why?
>> >> >
>> >>
>> >> That is for performance reasons. Suppose a request is rec= eived with
>> >> some
>> >> query params. To process them, it is only necessary to bu= ild the
>> >> metadata
>> >> and then if a navigation occur by some condition, the new= view can be
>> >> build, preventing the overhead associated with build the = first view.
>> >>
>> >> > I think that a new UIViewRoot should be created for = the real view,
>> >> > because
>> >> > metadata-view and real-view use different Facelets t= o populate the
>> >> > view.
>> >> >
>> >> >
>> >> >
>> >> > Also, in the method
>> >> > DefaultFaceletsStateManagementStrategy.restoreView()=
>> >> > you
>> >> > are calling the static method
>> >> > ViewMetadata.getViewParameters(UIViewRoot)
>> >> > on
>> >> > an instance of ViewMetadata (I think this should be = fixed) and the
>> >> > Collection of UIViewParameters returned is not proce= ssed.
>> >> >
>> >> >
>> >>
>> >> That's by JSF 2.0 spec.
>> >>
>> >> >
>> >> > I wonder if ViewMetadata should be used in this meth= od. I cannot see
>> >> > any
>> >> > processing related to metadata happening here.
>> >> >
>> >> >
>> >>
>> >> It should be, because if we don't Partial State Savin= g algorithm will
>> >> break. The
>> >> view should be build on restoreView just like the first t= ime + update
>> >> the "delta"
>> >> information.
>> >>
>> >> >
>> >> > Hope you have understood me.
>> >> >
>> >> >
>> >>
>> >> Yes, from my side, I can read the mail without problem. T= he idea
>> >> proposed
>> >> in "stateless JSF" is feasible, but it requires= some changes like:
>> >>
>> >> - Use ConcurrentHashMap/ConcurrentLRUCache instead synchr= onized blocks.
>> >> - Use buildView instead clone the view to generate a new = one.
>> >> - Use a combination of viewId/deriveLogicalViewId()
>> >>
>> >> Suggestions and contributions are welcome.
>> >>
>> >> regards,
>> >>
>> >> Leonardo Uribe
>> >>
>> >> >
>> >> >
>> >> >
>> >> > Un saludo,
>> >> >
>> >> >
>> >> >
>> >> > Jes=FAs P=E9rez Alcaide
>> >> >
>> >> > Lab. Banksphere - Runtime
>> >> >
>> >> > Tlf:=A0 91 470 5223
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > *********************AVISO LEGAL *******************= ***
>> >> > Este mensaje es privado y confidencial y solamente p= ara la persona a
>> >> > la
>> >> > que
>> >> > va dirigido. Si usted ha recibido este mensaje por e= rror, no debe
>> >> > revelar,
>> >> > copiar, distribuir o usarlo en ning=FAn sentido. Le = rogamos lo
>> >> > comunique
>> >> > al
>> >> > remitente y borre dicho mensaje y cualquier document= o adjunto que
>> >> > pudiera
>> >> > contener. No hay renuncia a la confidencialidad ni a= ning=FAn
>> >> > privilegio
>> >> > por
>> >> > causa de transmisi=F3n err=F3nea o mal funcionamient= o.
>> >> > Cualquier opini=F3n expresada en este mensaje perten= ece =FAnicamente al
>> >> > autor
>> >> > remitente, y no representa necesariamente la opini= =F3n de ISBAN, a no
>> >> > ser
>> >> > que
>> >> > expresamente se diga y el remitente est=E9 autorizad= o para hacerlo.
>> >> > Los correos electr=F3nicos no son seguros, no garant= izan la
>> >> > confidencialidad
>> >> > ni la correcta recepci=F3n de los mismos, dado que p= ueden ser
>> >> > interceptados,
>> >> > manipulados, destruidos, llegar con demora o incompl= etos, o con
>> >> > virus.
>> >> > ISBAN
>> >> > no se hace responsable de los cambios, alteraciones,= errores u
>> >> > omisiones
>> >> > que
>> >> > pudieran hacerse al mensaje una vez enviado.
>> >> > Este mensaje s=F3lo tiene una finalidad de informaci= =F3n, y no debe
>> >> > interpretarse como una oferta de venta o de compra d= e valores ni de
>> >> > instrumentos financieros relacionados.
>> >> >
>> >> > **********************DISCLAIMER***************** >> >> > This message is private and confidential and it is i= ntended
>> >> > exclusively
>> >> > for
>> >> > the addressee. If you receive this message by mistak= e, you should not
>> >> > disseminate, distribute or copy this e-mail. Please = inform the sender
>> >> > and
>> >> > delete the message and attachments from your system.= No
>> >> > confidentiality
>> >> > nor
>> >> > any privilege regarding the information is waived or= lost by any
>> >> > mistransmission or malfunction.
>> >> > Any views or opinions contained in this message are = solely those of
>> >> > the
>> >> > author, and do not necessarily represent those of IS= BAN, unless
>> >> > otherwise
>> >> > specifically stated and the sender is authorized to = do so.
>> >> > E-mail transmission cannot be guaranteed to be secur= e, confidential,
>> >> > or
>> >> > error-free, as information could be intercepted, cor= rupted, lost,
>> >> > destroyed,
>> >> > arrive late or incomplete, or contain viruses. ISBAN= does not accept
>> >> > responsibility for any changes, errors or omissions = in the contents
>> >> > of
>> >> > this
>> >> > message after it has been sent.
>> >> > This message is provided for informational purposes = and should not be
>> >> > construed as a solicitation or offer to buy or sell = any securities or
>> >> > related financial instruments.
>> >
>> >
>
>

--f46d0445183bb50f3304bb399ad4--