SlideShare una empresa de Scribd logo
1 de 57
Wednesday, May 4, 2011
Filling The Gap: Going Mobile
                            With JBoss Technologies Today

                                 Jay Balunas                 Wesley Hales
                         Principal Software Engineer   Senior Software Engineer
                            JBoss, by Red Hat Inc.      JBoss, by Red Hat Inc.




Wednesday, May 4, 2011
Jay Balunas
                         •RichFaces Project Lead
                         •JBoss Core Developer
                         •JSF 2.2 Expert Group
                         •Red Hat W3C Member
                         •http://in.relation.to/Bloggers/Jay
                         •http://twitter.com/tech4j
                         •jbalunas@jboss.org




Wednesday, May 4, 2011
Wesley Hales
                         •JBoss Portlet Bridge Lead
                         •Core GateIn Developer
                         •JSR-301/329 Red Hat Rep.
                         •Committer on Mozilla, Apache, Richfaces....
                         •Multiple series on InfoQ, Dzone, Refcards,
                          personal blog, etc...
                         •www.wesleyhales.com
                         •@wesleyhales



Wednesday, May 4, 2011
Check It Out For Yourself
       Wireless SSID:
                                tweatstream
        Local URL:
                   http://bit.ly/tweetstream1
      Matching Tweets Tags
                    #jboss #JBW #JUDCon



Wednesday, May 4, 2011
TweetStream
                         •Built to support mobile webkit
                          devices
                         •No 3rd party front end
                          frameworks
                         •Completely driven by JBoss tech
                          (from front to back)




Wednesday, May 4, 2011
TweetStream Breakdown



                         •Filling The Gap...




Wednesday, May 4, 2011
TweetStream Architectural Overview
                                                                                                                                           TwitterSource gets
                                                                                                                                           JUDCon tweet history
                                                                                                                                           based on "tracks", on
                                                                                                                                           application start




                                                                                                                                           CacheBuilder stores

                                                        Css Transitions


                                                                                        .js DOM tweet filtering
                                                                                                                                           different key value
                                                                                                                                           sets into infinispan.




                                                                                                                 Richfaces / Weld / Seam
                           Front End / User Interface




                                                                                                                                           TweetListenerBean
                                                                                                                                           listens for real time
                                                              socket/comet div update




                                                                                                                                           tweets based on
                                                                                                                                           hashtag.
                                                                                                                                           Triggers refresh of
                                                                                                                                           CacheBuilder



                                                                                                                                           CacheListener
                                                                                                                                           Listens for infinispan
                                                                                                                                           events and publishes
                                                                                                                                           refreshed view



                                                                                                                                           a4j:push subscribes
                                                                                                                                           to topic and gets
                                                                                                                                           updates as needed.




Wednesday, May 4, 2011
Tweetstream
                         Architecture Details



Wednesday, May 4, 2011
TweetStream Twitter4j


                                       •Open source project
                                       •Java API for easy access
                                       •OAuth support
                                       •Streaming feeds
                                       •Historical feeds




Wednesday, May 4, 2011
TweetStream Infinispan

                                        •JBoss open source
                                        •Highly scalable
                                         datagrid
                                        •In memory & disk
                                         options
                                        •Easily clusters out
                                        •Management facilities




Wednesday, May 4, 2011
TweetStream HornetQ & RichFaces

                                             •JBoss open source
                                             •Reliable, high
                                              performant
                                             •Flexible clustering
                                             •POJO based design
                                             •Perfect for RichFaces
                                              Push!




Wednesday, May 4, 2011
From Standard To Mobile
                                  Web



Wednesday, May 4, 2011
From standard to mobile
                                  web




Wednesday, May 4, 2011
From standard to mobile
                                  web


                                   +




Wednesday, May 4, 2011
From standard to mobile
                                  web


                             +         =




Wednesday, May 4, 2011
Considerations

                         •Device and feature detection
                         •Using RichFaces push effectively
                         •HTML 5 & CSS3
                         •Touch & gesture support
                         •Optimizations & tweaks


Wednesday, May 4, 2011
Device Detection




Wednesday, May 4, 2011
Header Inspection
    HTTP_HOST == myproxylists.com
    HTTP_USER_AGENT == Mozilla/5.0 (iPad; U; CPU OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML
    like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5
    HTTP_ACCEPT == application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/
    *;q=0.5
    HTTP_ACCEPT_LANGUAGE == en-us
    HTTP_ACCEPT_ENCODING == gzip, deflate
    HTTP_CONNECTION == keep-alive
    REMOTE_ADDR == xx.xxx.x.xxx                                 Don’t Parse This Yourself....
    REMOTE_PORT == 53298
    REQUEST_METHOD == GET
    REQUEST_URI == /my-http-headers
    REQUEST_TIME == 1304015649
    REMOTE_HOST == pool-xx-xxx-x-xxx.fios.verizon.net
    COUNTRY == [US]  UNITED STATES




Wednesday, May 4, 2011
Help Is Out There


                                 •MobileESP    Single Class
                                               User-Agent Processor

                                 •WURFL APIs


         Wireless Universal Resource File




Wednesday, May 4, 2011
For Tweetstream


                                 •MobileESP    Single Class
                                               User-Agent Processor

                                 •WURFL APIs


         Wireless Universal Resource File




Wednesday, May 4, 2011
@Named("userAgent")
      @RequestScoped
      public class UserAgentProcessor
                                           Mobile ESP
      {
         @PostConstruct
         public void init()
         {
            FacesContext context = FacesContext.getCurrentInstance();
            HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
            userAgentStr = request.getHeader("user-agent");
            httpAccept = request.getHeader("Accept");
            uAgentTest = new UAgentInfo(userAgentStr, httpAccept);
         }

             public boolean isPhone()
             {
                //Detects a whole tier of phones that support similar functionality as the iphone
                return uAgentTest.detectTierIphone();
             }

             public boolean isTablet()
             {
                //Detect ipads, xooms, blackberry tablets, but not galaxy - they use a strange user-agent
                return uAgentTest.detectTierTablet();
             }
      }




Wednesday, May 4, 2011
home.xhtml

                          <c:choose>
                             <c:when test="#{userAgent.phone}">
        Single Point of
                                <ui:include src="phoneHome.xhtml"/>
             Entry
                             </c:when>
                             <c:when test="#{userAgent.tablet}">
                                                                              Detection
                                <ui:include src="tabletHome.xhtml"/>
                                                                               Made By
                             </c:when>
                                                                             Form-Factor
                             <c:otherwise>
                                <!-- <ui:include src=”desktopHome.xhtml”/>
                                <ui:include src="tabletHome.xhtml"/>
                             </c:otherwise>
                          </c:choose>




Wednesday, May 4, 2011
Feature Detection
                          •WURFL ( server-side )

                          •Modernizr ( client-

                           side )

                          •CSS 3 & HTML 5


Wednesday, May 4, 2011
For TweetStream
                         •WURFL ( server-side )

                         •Modernizr ( client-

                          side )

                         •CSS 3 & HTML 5


Wednesday, May 4, 2011
CSS 3
     /* catch tablet portrait orientation */
     @media all and (orientation:portrait) {}

     /* catch tablet landscape orientation */
     @media all and (orientation:landscape) {}




    /*iphone landscape screen width*/
    @media screen and (max-device-width: 480px) and (orientation:landscape) {}

    /*iphone portrait screen width*/
    @media screen and (max-device-width: 320px) and (orientation:portrait) {}




Wednesday, May 4, 2011
Modernizr Example

                           Simple JavaScript File to load

                         .multiplebgs div p {
                           /* properties for browsers that
                              support multiple backgrounds */
                         }
                         .no-multiplebgs div p {
                           /* optional fallback properties
                              for browsers that don't */
                         }




Wednesday, May 4, 2011
RichFaces Push




Wednesday, May 4, 2011
RichFaces Push

                         •Integrates with Atmosphere
                          o Comet/WebSockets
                          o Graceful degradation
                                                                Cross Browser
                                                                Cross Device
                                                               Cross Enterprise
                         •Java Messaging Service (JMS)
                          o Reliability, flexibility, etc....




Wednesday, May 4, 2011
Getting The Message Out


                           •RichFaces TopicsContext
                           •Direct JMS




Wednesday, May 4, 2011
For TweetStream


                         •RichFaces TopicsContext
                         •Direct JMS




Wednesday, May 4, 2011
TopicsContext
     try
     {
                 log.debug("Pushing Update notification, no data needed”);
                 TopicsContext.lookup().publish(
                               new TopicKey("twitter", "content"), null);
     }
     catch (Exception e)
     {
        log.error(e.getMessage(), e);
     }
                                                 JMS Topic        Sub-Topic




Wednesday, May 4, 2011
JMS Direct
     //Standard JMS connection setup not shown
     topicConnection = cf.createConnection("guest", "guest");
     Topic topic = (Topic) ic.lookup("/topic/twitter");

     ...
                                                          JMS Topic
     message = session.createTextMessage();
     //Publishing update notification, no data needed
     message.setText(null);                                      Sub-Topic
     //Set the subtopic for the message to "content"
     message.setStringProperty("rf_push_subtopic", "content");

     producer.send(message);



Wednesday, May 4, 2011
Client Side Push Options


                           •Direct DOM Updates
                           •Partial Page Rendering




Wednesday, May 4, 2011
For TweetStream


                         •Direct DOM Updates
                         •Partial Page Rendering




Wednesday, May 4, 2011
Partial Page Rendering
                         Topic & Sub-Topic

                              <a4j:push address="content@twitter"
                                        onerror="alert(‘Error processing push’)">
                                <a4j:ajax event="dataavailable"
                                          render="tweeters tops”                    Event
                                          execute="@none”/>                       Triggered
                              </a4j:push>

                                                                What to
                                                               Re-Render



Wednesday, May 4, 2011
DOM Updates With Data
                                  Push
                         <a4j:push address="tweets@twitter"
                                   onerror="alert(event.rf.data)"
                                   ondataavailable="processData(event.rf.data)"/>


                                                                       Direct DOM processing
          •JMS Message Types                                           in processData function
           •ObjectMessage ( JSON )
           •TextMessage ( String )
                                                       event.rf.data on
                                                          client side




Wednesday, May 4, 2011
The Front End




Wednesday, May 4, 2011
Using JSF for Mobile Dev
                    •Sacrifices, sacrifices...
                    •Mobile HTML5 apps live or die
                     by the UI
                    •Making components work
                     with touch events




Wednesday, May 4, 2011
Understanding The Problems


                         •We know today’s components are built for desktop
                         •What exists for mobile JSF today?
                         •The future




Wednesday, May 4, 2011
User Interface/Experience
                   •CSS3 transitions
                   •Orientation Detection / Media Queries
                   •Page layout approach
                   •Understanding Touch Events and Gestures
                   •Performance and Tweaks




Wednesday, May 4, 2011
User Interaction
                         @media screen and (max-device-width: 320px) and (orientation:portrait) {
                            .stage-left {
                              opacity: 0;
                              left: -320px;
                            }
                            .stage-right {
                              opacity: 0;
                              left: 320px;
                            }
                           .transition {
                              -moz-transition-duration: 1s;
                            }


Wednesday, May 4, 2011
User Interaction




Wednesday, May 4, 2011
User Interaction

                         <div class="stage-left..."   <div class="stage-center..."   <div class="stage-right..."


                                                         <a4j:commandLink
                                                      oncomplete="showPage*"


                                                         <a4j:commandLink
                                                      oncomplete="showPage*"


                                                         <a4j:commandLink
                                                      oncomplete="showPage*"


                                                         <a4j:commandLink
                                                      oncomplete="showPage*"




Wednesday, May 4, 2011
UX / Orientation Detection

               • CSS3 Media Queries
                    @media screen and (max-device-width: 320px)
                    and (orientation:portrait) {


               • Viewport Settings
                    <meta name="viewport" content="width=device-width,
                    minimum-scale=1.0, maximum-scale=1.0"/>




Wednesday, May 4, 2011
Using Touch Events and Gestures

                •Duck Punch approach
                 http://bit.ly/k8b2aB

                •onmousedown /
                 onmouseup measurements
                 for swipe




Wednesday, May 4, 2011
Network Detection (WiFi, 3G, etc..)

                         •navigator.connection (Android 2.2+)
                          // contents of navigator.connection object  
                          {  
                            "type": "3",  
                            "UNKNOWN": "0",  
                            "ETHERNET": "1",  
                            "WIFI": "2",  
                            "CELL_2G": "3",  
                            "CELL_3G": "4"  
                          }  




Wednesday, May 4, 2011
Tweaks and Optimization
          •Getting close to a native feel...
          •Start with chrome or firebug profiling (SpeedTracer, yslow, etc...)
          •Access the GPU for smooth transitions:
              -webkit-transform: translateZ(0);




Wednesday, May 4, 2011
Other Helper Frameworks


                         •SenchaTouch
                         •JQuery*
                         •Phone Gap
                         •...




Wednesday, May 4, 2011
Questions?
             The Source:
                  https://github.com/richfaces/tweetstream




Wednesday, May 4, 2011
Page Layout / Optimization


                         •Reducing Latency over cell networks:
                          •One huge page o’ markup = less file requests
                          •Dealing with external file requests
                          •What about client side caching?
                         •Paving the way for future components...




Wednesday, May 4, 2011
Reducing Latency




Wednesday, May 4, 2011
Caching External Resources


                         •One possible solution would be:
                          •Base64 images to javascript using canvas
                          •Infinispan Storage




Wednesday, May 4, 2011
Caching External Resources
                           // Base64 an image
                         function getBase64Image(img) {
                             // Create an empty canvas element
                             var canvas = document.createElement("canvas");
                             canvas.width = img.width;
                             canvas.height = img.height;

                             // Copy the image contents to the canvas
                             var ctx = canvas.getContext("2d");
                             ctx.drawImage(img, 0, 0);

                               // Get the data-URL formatted image
                               // Firefox supports PNG and JPEG. You could check img.src to guess the
                               // original format, but be aware the using "image/jpg" will re-encode
                         the   image.
                               var dataURL = canvas.toDataURL("image/png");

                             return dataURL.replace(/^data:image/(png|jpg);base64,/, "");
                         }


Wednesday, May 4, 2011
Client Side Caching


                         •What about HTML5...
                          • localStorage
                          • sessionStorage
                          • cacheManifest




Wednesday, May 4, 2011
TweetStream / JSF UI
                              Profiling




Wednesday, May 4, 2011
Questions?
             The Source:
                  https://github.com/richfaces/tweetstream




Wednesday, May 4, 2011

Más contenido relacionado

Destacado

Mule json transformers and Examples
Mule json transformers and ExamplesMule json transformers and Examples
Mule json transformers and ExamplesNaresh Naidu
 
5 steps into creating your first mobile game
5 steps into creating your first mobile game5 steps into creating your first mobile game
5 steps into creating your first mobile gameDennis Adriansyah Ganda
 
Mule concepts connectors
Mule concepts connectorsMule concepts connectors
Mule concepts connectorskunal vishe
 
Arquitetura de Serviços - SOA, REST, Microservices e a plataforma .NET
Arquitetura de Serviços - SOA, REST, Microservices e a plataforma .NETArquitetura de Serviços - SOA, REST, Microservices e a plataforma .NET
Arquitetura de Serviços - SOA, REST, Microservices e a plataforma .NETRenato Groff
 
Basic Optimization and Unity Tips & Tricks by Yogie Aditya
Basic Optimization and Unity Tips & Tricks by Yogie AdityaBasic Optimization and Unity Tips & Tricks by Yogie Aditya
Basic Optimization and Unity Tips & Tricks by Yogie AdityagamelanYK
 
Scatter gather flow in mule
Scatter gather flow in muleScatter gather flow in mule
Scatter gather flow in mulePraneethchampion
 
Continuous Deployment with Jenkins on Kubernetes
Continuous Deployment with Jenkins on KubernetesContinuous Deployment with Jenkins on Kubernetes
Continuous Deployment with Jenkins on KubernetesMatt Baldwin
 
Using RAML 1.0 Like a Pro
Using RAML 1.0 Like a ProUsing RAML 1.0 Like a Pro
Using RAML 1.0 Like a ProMuleSoft
 
2016 - Continuously Delivering Microservices in Kubernetes using Jenkins
2016 - Continuously Delivering Microservices in Kubernetes using Jenkins2016 - Continuously Delivering Microservices in Kubernetes using Jenkins
2016 - Continuously Delivering Microservices in Kubernetes using Jenkinsdevopsdaysaustin
 
Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...
Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...
Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...Docker, Inc.
 

Destacado (14)

Mule json transformers and Examples
Mule json transformers and ExamplesMule json transformers and Examples
Mule json transformers and Examples
 
Life in the Fast Lane: Full Speed XPages!, #dd13
Life in the Fast Lane: Full Speed XPages!, #dd13Life in the Fast Lane: Full Speed XPages!, #dd13
Life in the Fast Lane: Full Speed XPages!, #dd13
 
Basic Pixel Art
Basic Pixel ArtBasic Pixel Art
Basic Pixel Art
 
Mule: Java Component
Mule: Java ComponentMule: Java Component
Mule: Java Component
 
5 steps into creating your first mobile game
5 steps into creating your first mobile game5 steps into creating your first mobile game
5 steps into creating your first mobile game
 
Mule concepts connectors
Mule concepts connectorsMule concepts connectors
Mule concepts connectors
 
Arquitetura de Serviços - SOA, REST, Microservices e a plataforma .NET
Arquitetura de Serviços - SOA, REST, Microservices e a plataforma .NETArquitetura de Serviços - SOA, REST, Microservices e a plataforma .NET
Arquitetura de Serviços - SOA, REST, Microservices e a plataforma .NET
 
Basic Optimization and Unity Tips & Tricks by Yogie Aditya
Basic Optimization and Unity Tips & Tricks by Yogie AdityaBasic Optimization and Unity Tips & Tricks by Yogie Aditya
Basic Optimization and Unity Tips & Tricks by Yogie Aditya
 
Scatter gather flow in mule
Scatter gather flow in muleScatter gather flow in mule
Scatter gather flow in mule
 
Docker cloud
Docker cloudDocker cloud
Docker cloud
 
Continuous Deployment with Jenkins on Kubernetes
Continuous Deployment with Jenkins on KubernetesContinuous Deployment with Jenkins on Kubernetes
Continuous Deployment with Jenkins on Kubernetes
 
Using RAML 1.0 Like a Pro
Using RAML 1.0 Like a ProUsing RAML 1.0 Like a Pro
Using RAML 1.0 Like a Pro
 
2016 - Continuously Delivering Microservices in Kubernetes using Jenkins
2016 - Continuously Delivering Microservices in Kubernetes using Jenkins2016 - Continuously Delivering Microservices in Kubernetes using Jenkins
2016 - Continuously Delivering Microservices in Kubernetes using Jenkins
 
Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...
Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...
Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...
 

Similar a Filling The Gap - Going Mobile With JBoss Technologies Today

JavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayJavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayWesley Hales
 
Making Portals Cool: The Compelling Advantages of a Portlet Bridge
Making Portals Cool: The Compelling Advantages of a Portlet BridgeMaking Portals Cool: The Compelling Advantages of a Portlet Bridge
Making Portals Cool: The Compelling Advantages of a Portlet BridgeWesley Hales
 
Linked Data - the Future for Open Repositories. Kultivate Workshop
Linked Data - the Future for Open Repositories. Kultivate WorkshopLinked Data - the Future for Open Repositories. Kultivate Workshop
Linked Data - the Future for Open Repositories. Kultivate WorkshopAdrian Stevenson
 
Секреты Фейсбука: как выдержать 50 миллионов запросов в секунду (Robert Johnson)
Секреты Фейсбука: как выдержать 50 миллионов запросов в секунду (Robert Johnson)Секреты Фейсбука: как выдержать 50 миллионов запросов в секунду (Robert Johnson)
Секреты Фейсбука: как выдержать 50 миллионов запросов в секунду (Robert Johnson)Ontico
 
If You Know JSF, You Know Portals and Portlets
If You Know JSF, You Know Portals and PortletsIf You Know JSF, You Know Portals and Portlets
If You Know JSF, You Know Portals and PortletsWesley Hales
 
Linked data and the LOCAH project ILI2011
Linked data and the LOCAH project ILI2011Linked data and the LOCAH project ILI2011
Linked data and the LOCAH project ILI2011Bethan Ruddock
 
Open stack swift_essex_meetup_2012_06_21_judd_maltin
Open stack swift_essex_meetup_2012_06_21_judd_maltinOpen stack swift_essex_meetup_2012_06_21_judd_maltin
Open stack swift_essex_meetup_2012_06_21_judd_maltinKamesh Pemmaraju
 
Ext JS 4.0 - Creating extensions, plugins and components
Ext JS 4.0 - Creating extensions, plugins and componentsExt JS 4.0 - Creating extensions, plugins and components
Ext JS 4.0 - Creating extensions, plugins and componentsPatrick Sheridan
 
Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020Lorenzo Miniero
 
Vb tutorial-das-update may2010
Vb tutorial-das-update may2010Vb tutorial-das-update may2010
Vb tutorial-das-update may2010VectorBase
 
Bratsas Web Science Semantic Wiki
Bratsas Web Science Semantic WikiBratsas Web Science Semantic Wiki
Bratsas Web Science Semantic WikiCharalampos Bratsas
 
IKS Technology Impact
IKS Technology ImpactIKS Technology Impact
IKS Technology ImpactFabian Christ
 
Project plan [kbs jhproper] v1
Project plan [kbs jhproper]  v1Project plan [kbs jhproper]  v1
Project plan [kbs jhproper] v1Aplesh_Rana
 
Next Generation Development Infrastructure: Maven, m2eclipse, Nexus & Hudson ...
Next Generation Development Infrastructure: Maven, m2eclipse, Nexus & Hudson ...Next Generation Development Infrastructure: Maven, m2eclipse, Nexus & Hudson ...
Next Generation Development Infrastructure: Maven, m2eclipse, Nexus & Hudson ...EclipseDayParis
 
Alfresco xenit webinar fred boosting your desktop - 9 march 2011
Alfresco xenit webinar fred boosting your desktop - 9 march 2011Alfresco xenit webinar fred boosting your desktop - 9 march 2011
Alfresco xenit webinar fred boosting your desktop - 9 march 2011Alfresco Software
 
Sean coates fifty things and tricks, confoo 2011
Sean coates fifty things and tricks, confoo 2011Sean coates fifty things and tricks, confoo 2011
Sean coates fifty things and tricks, confoo 2011Bachkoutou Toutou
 

Similar a Filling The Gap - Going Mobile With JBoss Technologies Today (19)

JavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies TodayJavaOne 2011 - Going Mobile With Java Based Technologies Today
JavaOne 2011 - Going Mobile With Java Based Technologies Today
 
Making Portals Cool: The Compelling Advantages of a Portlet Bridge
Making Portals Cool: The Compelling Advantages of a Portlet BridgeMaking Portals Cool: The Compelling Advantages of a Portlet Bridge
Making Portals Cool: The Compelling Advantages of a Portlet Bridge
 
Linked Data - the Future for Open Repositories. Kultivate Workshop
Linked Data - the Future for Open Repositories. Kultivate WorkshopLinked Data - the Future for Open Repositories. Kultivate Workshop
Linked Data - the Future for Open Repositories. Kultivate Workshop
 
Секреты Фейсбука: как выдержать 50 миллионов запросов в секунду (Robert Johnson)
Секреты Фейсбука: как выдержать 50 миллионов запросов в секунду (Robert Johnson)Секреты Фейсбука: как выдержать 50 миллионов запросов в секунду (Robert Johnson)
Секреты Фейсбука: как выдержать 50 миллионов запросов в секунду (Robert Johnson)
 
If You Know JSF, You Know Portals and Portlets
If You Know JSF, You Know Portals and PortletsIf You Know JSF, You Know Portals and Portlets
If You Know JSF, You Know Portals and Portlets
 
Linked data and the LOCAH project ILI2011
Linked data and the LOCAH project ILI2011Linked data and the LOCAH project ILI2011
Linked data and the LOCAH project ILI2011
 
Open stack swift_essex_meetup_2012_06_21_judd_maltin
Open stack swift_essex_meetup_2012_06_21_judd_maltinOpen stack swift_essex_meetup_2012_06_21_judd_maltin
Open stack swift_essex_meetup_2012_06_21_judd_maltin
 
Ext JS 4.0 - Creating extensions, plugins and components
Ext JS 4.0 - Creating extensions, plugins and componentsExt JS 4.0 - Creating extensions, plugins and components
Ext JS 4.0 - Creating extensions, plugins and components
 
新 · 交互
新 · 交互新 · 交互
新 · 交互
 
Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020Janus Workshop @ ClueCon 2020
Janus Workshop @ ClueCon 2020
 
Vb tutorial-das-update may2010
Vb tutorial-das-update may2010Vb tutorial-das-update may2010
Vb tutorial-das-update may2010
 
Bratsas Web Science Semantic Wiki
Bratsas Web Science Semantic WikiBratsas Web Science Semantic Wiki
Bratsas Web Science Semantic Wiki
 
IKS Technology Impact
IKS Technology ImpactIKS Technology Impact
IKS Technology Impact
 
Jsf+ejb 50
Jsf+ejb 50Jsf+ejb 50
Jsf+ejb 50
 
Project plan [kbs jhproper] v1
Project plan [kbs jhproper]  v1Project plan [kbs jhproper]  v1
Project plan [kbs jhproper] v1
 
Maven 3.0 by jason - fossa2010
Maven 3.0 by jason - fossa2010Maven 3.0 by jason - fossa2010
Maven 3.0 by jason - fossa2010
 
Next Generation Development Infrastructure: Maven, m2eclipse, Nexus & Hudson ...
Next Generation Development Infrastructure: Maven, m2eclipse, Nexus & Hudson ...Next Generation Development Infrastructure: Maven, m2eclipse, Nexus & Hudson ...
Next Generation Development Infrastructure: Maven, m2eclipse, Nexus & Hudson ...
 
Alfresco xenit webinar fred boosting your desktop - 9 march 2011
Alfresco xenit webinar fred boosting your desktop - 9 march 2011Alfresco xenit webinar fred boosting your desktop - 9 march 2011
Alfresco xenit webinar fred boosting your desktop - 9 march 2011
 
Sean coates fifty things and tricks, confoo 2011
Sean coates fifty things and tricks, confoo 2011Sean coates fifty things and tricks, confoo 2011
Sean coates fifty things and tricks, confoo 2011
 

Más de Wesley Hales

Owning Web Performance
Owning Web PerformanceOwning Web Performance
Owning Web PerformanceWesley Hales
 
Owning Web Performance with PhantomJS 2 - Fluent 2016
Owning Web Performance with PhantomJS 2 - Fluent 2016Owning Web Performance with PhantomJS 2 - Fluent 2016
Owning Web Performance with PhantomJS 2 - Fluent 2016Wesley Hales
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesThe Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesWesley Hales
 
GateIn - The Solution for Managing and Building Enterprise Web Apps
GateIn - The Solution for Managing and Building Enterprise Web AppsGateIn - The Solution for Managing and Building Enterprise Web Apps
GateIn - The Solution for Managing and Building Enterprise Web AppsWesley Hales
 
GateIn - Presented at Atlanta JUG on 1/19/2010
GateIn - Presented at Atlanta JUG on 1/19/2010GateIn - Presented at Atlanta JUG on 1/19/2010
GateIn - Presented at Atlanta JUG on 1/19/2010Wesley Hales
 
Ajax In Enterprise Portals
Ajax In Enterprise PortalsAjax In Enterprise Portals
Ajax In Enterprise PortalsWesley Hales
 

Más de Wesley Hales (6)

Owning Web Performance
Owning Web PerformanceOwning Web Performance
Owning Web Performance
 
Owning Web Performance with PhantomJS 2 - Fluent 2016
Owning Web Performance with PhantomJS 2 - Fluent 2016Owning Web Performance with PhantomJS 2 - Fluent 2016
Owning Web Performance with PhantomJS 2 - Fluent 2016
 
The Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devicesThe Mobile Web - HTML5 on mobile devices
The Mobile Web - HTML5 on mobile devices
 
GateIn - The Solution for Managing and Building Enterprise Web Apps
GateIn - The Solution for Managing and Building Enterprise Web AppsGateIn - The Solution for Managing and Building Enterprise Web Apps
GateIn - The Solution for Managing and Building Enterprise Web Apps
 
GateIn - Presented at Atlanta JUG on 1/19/2010
GateIn - Presented at Atlanta JUG on 1/19/2010GateIn - Presented at Atlanta JUG on 1/19/2010
GateIn - Presented at Atlanta JUG on 1/19/2010
 
Ajax In Enterprise Portals
Ajax In Enterprise PortalsAjax In Enterprise Portals
Ajax In Enterprise Portals
 

Último

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Último (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

Filling The Gap - Going Mobile With JBoss Technologies Today

  • 2. Filling The Gap: Going Mobile With JBoss Technologies Today Jay Balunas Wesley Hales Principal Software Engineer Senior Software Engineer JBoss, by Red Hat Inc. JBoss, by Red Hat Inc. Wednesday, May 4, 2011
  • 3. Jay Balunas •RichFaces Project Lead •JBoss Core Developer •JSF 2.2 Expert Group •Red Hat W3C Member •http://in.relation.to/Bloggers/Jay •http://twitter.com/tech4j •jbalunas@jboss.org Wednesday, May 4, 2011
  • 4. Wesley Hales •JBoss Portlet Bridge Lead •Core GateIn Developer •JSR-301/329 Red Hat Rep. •Committer on Mozilla, Apache, Richfaces.... •Multiple series on InfoQ, Dzone, Refcards, personal blog, etc... •www.wesleyhales.com •@wesleyhales Wednesday, May 4, 2011
  • 5. Check It Out For Yourself Wireless SSID: tweatstream Local URL: http://bit.ly/tweetstream1 Matching Tweets Tags #jboss #JBW #JUDCon Wednesday, May 4, 2011
  • 6. TweetStream •Built to support mobile webkit devices •No 3rd party front end frameworks •Completely driven by JBoss tech (from front to back) Wednesday, May 4, 2011
  • 7. TweetStream Breakdown •Filling The Gap... Wednesday, May 4, 2011
  • 8. TweetStream Architectural Overview TwitterSource gets JUDCon tweet history based on "tracks", on application start CacheBuilder stores Css Transitions .js DOM tweet filtering different key value sets into infinispan. Richfaces / Weld / Seam Front End / User Interface TweetListenerBean listens for real time socket/comet div update tweets based on hashtag. Triggers refresh of CacheBuilder CacheListener Listens for infinispan events and publishes refreshed view a4j:push subscribes to topic and gets updates as needed. Wednesday, May 4, 2011
  • 9. Tweetstream Architecture Details Wednesday, May 4, 2011
  • 10. TweetStream Twitter4j •Open source project •Java API for easy access •OAuth support •Streaming feeds •Historical feeds Wednesday, May 4, 2011
  • 11. TweetStream Infinispan •JBoss open source •Highly scalable datagrid •In memory & disk options •Easily clusters out •Management facilities Wednesday, May 4, 2011
  • 12. TweetStream HornetQ & RichFaces •JBoss open source •Reliable, high performant •Flexible clustering •POJO based design •Perfect for RichFaces Push! Wednesday, May 4, 2011
  • 13. From Standard To Mobile Web Wednesday, May 4, 2011
  • 14. From standard to mobile web Wednesday, May 4, 2011
  • 15. From standard to mobile web + Wednesday, May 4, 2011
  • 16. From standard to mobile web + = Wednesday, May 4, 2011
  • 17. Considerations •Device and feature detection •Using RichFaces push effectively •HTML 5 & CSS3 •Touch & gesture support •Optimizations & tweaks Wednesday, May 4, 2011
  • 19. Header Inspection HTTP_HOST == myproxylists.com HTTP_USER_AGENT == Mozilla/5.0 (iPad; U; CPU OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5 HTTP_ACCEPT == application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/ *;q=0.5 HTTP_ACCEPT_LANGUAGE == en-us HTTP_ACCEPT_ENCODING == gzip, deflate HTTP_CONNECTION == keep-alive REMOTE_ADDR == xx.xxx.x.xxx Don’t Parse This Yourself.... REMOTE_PORT == 53298 REQUEST_METHOD == GET REQUEST_URI == /my-http-headers REQUEST_TIME == 1304015649 REMOTE_HOST == pool-xx-xxx-x-xxx.fios.verizon.net COUNTRY == [US]  UNITED STATES Wednesday, May 4, 2011
  • 20. Help Is Out There •MobileESP Single Class User-Agent Processor •WURFL APIs Wireless Universal Resource File Wednesday, May 4, 2011
  • 21. For Tweetstream •MobileESP Single Class User-Agent Processor •WURFL APIs Wireless Universal Resource File Wednesday, May 4, 2011
  • 22. @Named("userAgent") @RequestScoped public class UserAgentProcessor Mobile ESP { @PostConstruct public void init() { FacesContext context = FacesContext.getCurrentInstance(); HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest(); userAgentStr = request.getHeader("user-agent"); httpAccept = request.getHeader("Accept"); uAgentTest = new UAgentInfo(userAgentStr, httpAccept); } public boolean isPhone() { //Detects a whole tier of phones that support similar functionality as the iphone return uAgentTest.detectTierIphone(); } public boolean isTablet() { //Detect ipads, xooms, blackberry tablets, but not galaxy - they use a strange user-agent return uAgentTest.detectTierTablet(); } } Wednesday, May 4, 2011
  • 23. home.xhtml <c:choose> <c:when test="#{userAgent.phone}"> Single Point of <ui:include src="phoneHome.xhtml"/> Entry </c:when> <c:when test="#{userAgent.tablet}"> Detection <ui:include src="tabletHome.xhtml"/> Made By </c:when> Form-Factor <c:otherwise> <!-- <ui:include src=”desktopHome.xhtml”/> <ui:include src="tabletHome.xhtml"/> </c:otherwise> </c:choose> Wednesday, May 4, 2011
  • 24. Feature Detection •WURFL ( server-side ) •Modernizr ( client- side ) •CSS 3 & HTML 5 Wednesday, May 4, 2011
  • 25. For TweetStream •WURFL ( server-side ) •Modernizr ( client- side ) •CSS 3 & HTML 5 Wednesday, May 4, 2011
  • 26. CSS 3 /* catch tablet portrait orientation */ @media all and (orientation:portrait) {} /* catch tablet landscape orientation */ @media all and (orientation:landscape) {} /*iphone landscape screen width*/ @media screen and (max-device-width: 480px) and (orientation:landscape) {} /*iphone portrait screen width*/ @media screen and (max-device-width: 320px) and (orientation:portrait) {} Wednesday, May 4, 2011
  • 27. Modernizr Example Simple JavaScript File to load .multiplebgs div p { /* properties for browsers that support multiple backgrounds */ } .no-multiplebgs div p { /* optional fallback properties for browsers that don't */ } Wednesday, May 4, 2011
  • 29. RichFaces Push •Integrates with Atmosphere o Comet/WebSockets o Graceful degradation Cross Browser Cross Device Cross Enterprise •Java Messaging Service (JMS) o Reliability, flexibility, etc.... Wednesday, May 4, 2011
  • 30. Getting The Message Out •RichFaces TopicsContext •Direct JMS Wednesday, May 4, 2011
  • 31. For TweetStream •RichFaces TopicsContext •Direct JMS Wednesday, May 4, 2011
  • 32. TopicsContext try { log.debug("Pushing Update notification, no data needed”); TopicsContext.lookup().publish( new TopicKey("twitter", "content"), null); } catch (Exception e) { log.error(e.getMessage(), e); } JMS Topic Sub-Topic Wednesday, May 4, 2011
  • 33. JMS Direct //Standard JMS connection setup not shown topicConnection = cf.createConnection("guest", "guest"); Topic topic = (Topic) ic.lookup("/topic/twitter"); ... JMS Topic message = session.createTextMessage(); //Publishing update notification, no data needed message.setText(null); Sub-Topic //Set the subtopic for the message to "content" message.setStringProperty("rf_push_subtopic", "content"); producer.send(message); Wednesday, May 4, 2011
  • 34. Client Side Push Options •Direct DOM Updates •Partial Page Rendering Wednesday, May 4, 2011
  • 35. For TweetStream •Direct DOM Updates •Partial Page Rendering Wednesday, May 4, 2011
  • 36. Partial Page Rendering Topic & Sub-Topic <a4j:push address="content@twitter" onerror="alert(‘Error processing push’)"> <a4j:ajax event="dataavailable" render="tweeters tops” Event execute="@none”/> Triggered </a4j:push> What to Re-Render Wednesday, May 4, 2011
  • 37. DOM Updates With Data Push <a4j:push address="tweets@twitter" onerror="alert(event.rf.data)" ondataavailable="processData(event.rf.data)"/> Direct DOM processing •JMS Message Types in processData function •ObjectMessage ( JSON ) •TextMessage ( String ) event.rf.data on client side Wednesday, May 4, 2011
  • 39. Using JSF for Mobile Dev •Sacrifices, sacrifices... •Mobile HTML5 apps live or die by the UI •Making components work with touch events Wednesday, May 4, 2011
  • 40. Understanding The Problems •We know today’s components are built for desktop •What exists for mobile JSF today? •The future Wednesday, May 4, 2011
  • 41. User Interface/Experience •CSS3 transitions •Orientation Detection / Media Queries •Page layout approach •Understanding Touch Events and Gestures •Performance and Tweaks Wednesday, May 4, 2011
  • 42. User Interaction @media screen and (max-device-width: 320px) and (orientation:portrait) { .stage-left { opacity: 0; left: -320px; } .stage-right { opacity: 0; left: 320px; } .transition { -moz-transition-duration: 1s; } Wednesday, May 4, 2011
  • 44. User Interaction <div class="stage-left..." <div class="stage-center..." <div class="stage-right..." <a4j:commandLink oncomplete="showPage*" <a4j:commandLink oncomplete="showPage*" <a4j:commandLink oncomplete="showPage*" <a4j:commandLink oncomplete="showPage*" Wednesday, May 4, 2011
  • 45. UX / Orientation Detection • CSS3 Media Queries @media screen and (max-device-width: 320px) and (orientation:portrait) { • Viewport Settings <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/> Wednesday, May 4, 2011
  • 46. Using Touch Events and Gestures •Duck Punch approach http://bit.ly/k8b2aB •onmousedown / onmouseup measurements for swipe Wednesday, May 4, 2011
  • 47. Network Detection (WiFi, 3G, etc..) •navigator.connection (Android 2.2+) // contents of navigator.connection object   {     "type": "3",     "UNKNOWN": "0",     "ETHERNET": "1",     "WIFI": "2",     "CELL_2G": "3",     "CELL_3G": "4"   }   Wednesday, May 4, 2011
  • 48. Tweaks and Optimization •Getting close to a native feel... •Start with chrome or firebug profiling (SpeedTracer, yslow, etc...) •Access the GPU for smooth transitions: -webkit-transform: translateZ(0); Wednesday, May 4, 2011
  • 49. Other Helper Frameworks •SenchaTouch •JQuery* •Phone Gap •... Wednesday, May 4, 2011
  • 50. Questions? The Source: https://github.com/richfaces/tweetstream Wednesday, May 4, 2011
  • 51. Page Layout / Optimization •Reducing Latency over cell networks: •One huge page o’ markup = less file requests •Dealing with external file requests •What about client side caching? •Paving the way for future components... Wednesday, May 4, 2011
  • 53. Caching External Resources •One possible solution would be: •Base64 images to javascript using canvas •Infinispan Storage Wednesday, May 4, 2011
  • 54. Caching External Resources // Base64 an image function getBase64Image(img) {     // Create an empty canvas element     var canvas = document.createElement("canvas");     canvas.width = img.width;     canvas.height = img.height;     // Copy the image contents to the canvas     var ctx = canvas.getContext("2d");     ctx.drawImage(img, 0, 0);     // Get the data-URL formatted image     // Firefox supports PNG and JPEG. You could check img.src to guess the     // original format, but be aware the using "image/jpg" will re-encode the image.     var dataURL = canvas.toDataURL("image/png");     return dataURL.replace(/^data:image/(png|jpg);base64,/, ""); } Wednesday, May 4, 2011
  • 55. Client Side Caching •What about HTML5... • localStorage • sessionStorage • cacheManifest Wednesday, May 4, 2011
  • 56. TweetStream / JSF UI Profiling Wednesday, May 4, 2011
  • 57. Questions? The Source: https://github.com/richfaces/tweetstream Wednesday, May 4, 2011