This is in regard with how Trinidad handle JavaScript free fallback during mobile rendering. Basically, we assign the JavaScript capability for a few mobile user-agents to 'none' in their capability files (Trinidad maintains a capability file for each user-agent). The method supportsScripting determines whether to fallback based on a user-agent's JavaScript capability, and this method is available in org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer.

I guess we can tweak this method based on some configuration parameter to return false to accomplish JavaScript free fallback.

Mechanism behind JavaScript free fallback:
The primary purpose of the JavaScript in the client-side is to assign values to parameters like source, event, etc.

1) During fallback rendering, we encode all these parameters and their values to the name attribute of a component. Example, for commandButton, we render:
<input  type = "submit"  name = "source<<encodingkey>><<sourcevalue>>" />
All components that are intended to submit a page are rendered as input element of type 'submit' and their name attributes are encoded with parameters and their values. Also, we render a hidden parameter '_noJavaScript' during form rendering to indicate that parameters are encoded.

2) During page submission, the submitting component's name attribute which contains the encoded parameters will be returned to the server. In the Trinidad filter, we check for the hidden parameter '_noJavaScript', if true, we wrap the incoming httpRequest with a wrapper that decoded these parameters from the name attribute. The wrapper adds these decoded parameters (source, event) to the parameterMap.

Wrapper Class: org.apache.myfaces.trinidadinternal.webapp.wrappers.BasicHTMLBrowserRequestWrapper

Example, a page has two commandButtons, whose source parameters are 'commandButton1' and 'commandButton2' respectively. These commandButtons will be rendered as below:
<input  type = "submit"  name = "source_parameterkeycommandButton1" />
<input  type = "submit"  name = "source_parameterkeycommandButton2" />

if the page is submitted by commandButton2, the payload will contain 'source_parameterkeycommandButton2'. Hence, the wrapper can decoded the source parameter value to be 'commandButton2'

Hope it helps.

Thanks
Mamallan
On 3/9/2010 9:51 AM, Matthias Wessendorf wrote:
On Tue, Mar 9, 2010 at 8:19 AM, Martin Marinschek
<mmarinsc...@apache.org> wrote:
Ok - if you are alright with that, I would have some more proposals.
Some starters in the following:

- Partial State Saving performance improvements in MyFaces 2.0
- Implement a JavaScript-Free Fallback in Tomahawk, Trinidad and/or Tobago

Trinidad has some fallback already, however it is only applied when
mobile rendering
is involved (by user-agent detection of the components). So, we could
port that...
Basically, we assign the JavaScript capability for a few mobile user-agents to 'none' in their capability files (Trinidad maintains a capability file for each user-agent). The method supportsScripting which determines whether to fallback based on a user-agent's JavaScript capability is available in org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer.

I guess we can tweak this method based on some configuration parameter to return false to accomplish JavaScript free fallback.

Mechanism behind JavaScript free fallback:
The primary purpose of the JavaScript in the client-side is to assign values to parameters like source, event, etc.

1) During fallback rendering, we encode all these parameters and their values to the name attribute of a component. Example, for commandButton, we render:
<input  type = "submit"  name = "source<<encodingkey>><<sourcevalue>>" />
All components that are intended to submit a page are rendered as input element of type 'submit' and their name attributes are encoded with parameters and their values. Also, we render a hidden parameter '_noJavaScript' during form rendering to indicate that parameters are encoded.

2) During page submission, the submitting component's name attribute which contains the encoded parameters will be returned to the server. In the Trinidad filter, we check for the hidden parameter '_noJavaScript', if true, we wrap the incoming httpRequest with a wrapper that decoded these parameters from the name attribute. The wrapper adds these decoded parameters (source, event) to the parameterMap.

Wrapper Class: org.apache.myfaces.trinidadinternal.webapp.wrappers.BasicHTMLBrowserRequestWrapper

Example, a page has two commandButtons, whose source parameters are 'commandButton1' and 'commandButton2' respectively. These commandButtons will be rendered as below:
<input  type = "submit"  name = "source_parameterkeycommandButton1" />
<input  type = "submit"  name = "source_parameterkeycommandButton2" />

if the page is submitted by commandButton2, the payload will contain 'source_parameterkeycommandButton2'. Hence, the wrapper can decoded the source parameter value to be 'commandButton2'

Hope it helps.

Thanks
Mamallan











Thanks
Mamallan






- Write (more) new skins for Trinidad

yeah! :-)


- Implement Double-Submit-Handling/Back-Button Handling in one of the
MyFaces subprojects
- Extend Orchestra use Conversations based on the JSF 2.0 custom scope
API, Extend Orchestra to work with Spring Conversations, to do
File->New Window Handling

what do you guys think?

best regards,

Martin



On 3/9/10, Matthias Wessendorf <mat...@apache.org> wrote:
Hey

On Tue, Mar 9, 2010 at 4:28 AM, Martin Marinschek
<mmarinsc...@apache.org> wrote:
Hi guys,

question: Google SoC - I saw some administrative mails already, but no
real proposals from the MyFaces community (just one proposal by a
potential student). So is there something already worked on with
regards to this? Are people interested in mentoring students? In
getting projects done?

I think we are supposed to use the issue tracker for this year's
project - is that true?
yep. I understood the mails that way too. Once the ASF has registered, I
think
Norin will do that 2day, I will get some wiki to prepare the JIRA entry.

-Matthias

best regards,

Martin

--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces


--
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces




Reply via email to