SlideShare une entreprise Scribd logo
1  sur  50
Télécharger pour lire hors ligne
Going Mobile With Java Based Technologies Today
          JavaOne 2011
          Speaker: Wesley Hales
        @wesleyhales
Sunday, October 9, 2011
Wesley Hales
                          • Senior Developer at Red Hat           @w
                                                                    esle
                          • W3C Member                                  yha
                                                                           les
                          • JSR 301/329 Rep.
                          • HTML5 User Group Founder
                          • html5rocks.com, DZone Refcard, and author of
                            many other articles around the web.




Sunday, October 9, 2011
Sunday, October 9, 2011
Mobile Platforms




                          Mobile Frameworks




                           And many more...


Sunday, October 9, 2011
Todays Focus




Sunday, October 9, 2011
Mobile Web Browsers
                                       Available Features


                          • As a Java developer, which HTML5
                            features should I care about?

                            • Web Workers
                            • Web Sockets
                            • Web Storage
                            • Application Cache
                            • Notifications, Geolocation, etc...


Sunday, October 9, 2011
Mobile Web Browsers
                                        Available Features




                          Web Sockets        no                        yes

                          Web Workers        no                         no

                                              * [10-2-2011] http://caniuse.com/#feat=webworkers


Sunday, October 9, 2011
Mobile Web Browsers
                                        Available Features




                           appCache      unlimited           10MB

                          Web Storage       5MB              5MB



Sunday, October 9, 2011
HTML5 Mime Mappings
                          <mime-mapping>
                            <extension>appcache</extension>
                            <mime-type>text/cache-manifest</mime-type>
                          </mime-mapping>


                          <mime-mapping>
                            <extension>html</extension>
                            <mime-type>text/html-sandboxed</mime-type>
                          </mime-mapping>


Sunday, October 9, 2011
Top 5 Best Practices
                                     When working with HTML5
                          1) Use client side DBs instead of server round
                          trips (localStorage)
                          2) Use CSS transitions instead of javascript animations
                          (Enable hardware acceleration)
                          3) Boost performance with javascript 1.6 (no more "for
                          loops")... [‘apples’,‘oranges’,‘forge’].forEach{...}
                          4) Use cache manifests for live sites, not just offline apps
                          (reduce requests)
                          5) HTML5 Form attributes and input styles (paceholder,
                          pattern, etc...)


Sunday, October 9, 2011
About The Demo




Sunday, October 9, 2011
TweetStream


                               • Built to work with mobile
                                 webkit devices

                               • Not using any mobile
                                 frameworks

                               • Java app optimized for
                                 mobile




Sunday, October 9, 2011
TweetStream
                            Java Tech Breakdown

                          • Data Grids with Infinispan
                          • JSR 299: CDI/Weld + Seam 3
                          • JMS 1.1 API
                          • JSF 2.0 + RichFaces 4




Sunday, October 9, 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.




Sunday, October 9, 2011
TweetStream Twitter4J



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




Sunday, October 9, 2011
TweetStream Infinispan



                                        •Highly scalable
                                        •In memory w/ spool off
                                         options
                                        •Easily clusterable and
                                         manageable




Sunday, October 9, 2011
TweetStream Twitter4J




                                        •Reliable and performant
                                        •Flexible clustering
                                        •Perfect for hookup into UI




Sunday, October 9, 2011
Access It Live Now!
                             http://bit.ly/mobilejava
                            #javaone and #mobilejava




Sunday, October 9, 2011
How Does Mobile Affect My Code?

                          • Airplane mode
                          • Integration and Extending features
                            • Web Storage
                            • Web Sockets
                            • XHR2, File System API, etc...
                          • Latency and file requests are everything
                            • Dynamic resource serving optimizations


Sunday, October 9, 2011
Java Mobile Web Settings
                • Device and feature detection
                • Optimizing RichFaces push
                • JSF2 + HTML5
                • Touch and gesture support
                • Mime mappings




Sunday, October 9, 2011
Other Mobile Web Settings

                           • Minification (html5boilerplate)
                           • Ajax Improvements
                           • File Request Reduction




Sunday, October 9, 2011
Other Mobile Web Settings

                           • Minification (html5boilerplate)
                           • Ajax Improvements
                           • File Request Reduction




Sunday, October 9, 2011
Device & Feature Detection




Sunday, October 9, 2011
Device & Feature Detection


                           • MobileESP (server-side)
                           • Modernizr (client-side)
                           • CSS3 Media Queries




Sunday, October 9, 2011
Server Side Device Detection


                            • Parsing the USER_AGENT
                            • MobileESP
                            • WURFL APIs




Sunday, October 9, 2011
Server Side Device Detection


                            • Parsing the USER_AGENT
                            • MobileESP
                            • WURFL APIs




Sunday, October 9, 2011
MobileESP
                   ...{
                     HttpServletRequest request...
                     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();
       }
Sunday, October 9, 2011
WURFL
                                         Wireless Universal Resource File




                          • Up to date list of all mobile devices
                          • Available as XML file
                          • Wrappers for most languages




Sunday, October 9, 2011
Feature Detection
                           Modernizr
                          • <html class="js canvas canvastext
                            no-geolocation rgba hsla
                            multiplebgs borderimage
                            borderradius boxshadow opacity
                            cssanimations csscolumns
                            cssgradients cssreflections
                            csstransforms csstransforms3d
                            csstransitions video audio
                            localstorage sessionstorage
                            webworkers applicationcache
                            fontface">




Sunday, October 9, 2011
Feature Detection
                            Modernizr
                          • Adds classnames of available
                            features to DOM

                          • Allows use of browser features with
                            fallback options

                          • shiv & polyfills




Sunday, October 9, 2011
Feature Detection
                          “Cascading” the detection:
                          #nice {
                              background: url(background-one.png) top left repeat-x;
                              background: url(background-one.png) top left repeat-x,
                              url(background-two.png) bottom left repeat-x;
                          }

                          Using Modernizr:

                          #nice {
                              background: url(background-one.png) top left repeat-x;
                          }
                          .multiplebgs #nice {
                              background: url(background-one.png) top left repeat-x,
                              url(background-two.png) bottom left repeat-x;
                          }



Sunday, October 9, 2011
Web Sockets




Sunday, October 9, 2011
RichFaces Push

                          • Integrates with Atmosphere
                            • Supports Comet & WebSockets
                          • Allows usage JMS queues/topic
                          • Optimizable with custom queueing
                            or use of CDI events




Sunday, October 9, 2011
RichFaces Push

                          • 2 options
                            • render specific UI regions on
                              push

                            • parse response as JSON




Sunday, October 9, 2011
RichFaces Push
                          <a4j:jsFunction name="updateContent" action="
                          #{twitterAgent.refreshList}" render="list-form"/>
                           <a4j:push address="content@twitter"
                                  onerror="alert('Error retrieving pushed data')"
                                  ondataavailable="updateContent()">
                           </a4j:push>




Sunday, October 9, 2011
JSF + Mobile




Sunday, October 9, 2011
JSF2 on Mobile

                          • Sacrifices...
                          • Created for the desktop
                          • What exists for mobile JSF today?
                          • the future




Sunday, October 9, 2011
Using JSF2 with HTML5

                          • HTML5 allows XML markup (which
                            is emitted by JSF/Facelets)

                          • XML Namespaces are only used
                            server side




Sunday, October 9, 2011
Using JSF2 with HTML5
                    Normal JSF Markup...                            Renders to...
                    <!DOCTYPE html>
                    <html lang="en"                                 <!DOCTYPE html>
                        xmlns:f="http://java.sun.com/jsf/core"      <html lang="en">
                        xmlns:h="http://java.sun.com/jsf/html">
                        <h:head>                                        <head>
                            <title>Title</title>                            <title>Title</title>
                        </h:head>
                        <h:body>                                        </head>
                            <h:outputText value="#{bean.text}" />       <body>
                        </h:body>
                    </html>                                                 Some text
                                                                        </body>
                                                                    </html>




Sunday, October 9, 2011
Back Button and Bookmarking

                            • Doable with 3rd party JSF
                              frameworks like RichFaces

                            • Uses location.hash




Sunday, October 9, 2011
Back Button and Bookmarking
                    http://someurl.com/#foo:bar


                    <a4j:jsFunction name="handleHashChange" render="@form" oncomplete="slideTo('foo
                                                           location.hash.split(':')

                                <f:param name="demo" value="param1"/>
                                <f:param name="sample" value="param2"/>
                    </a4j:jsFunction>



                    window.onhashchange = function(){
                            handleHashChange(location.hash.split(':'))
                    };




Sunday, October 9, 2011
Mobile UI & Experience




Sunday, October 9, 2011
Mobile UI & Experience
                          • Hardware Acceleration
                          • Page Transitions: Sliding, Flipping, and Rotating
                          • Fetching and Caching
                          • Network Detection
                          • Debugging & Profiling


                                  http://bit.ly/javaonemobile


Sunday, October 9, 2011
Touch Events
                          •Duck Punch approach
                           http://bit.ly/k8b2aB

                          •onmousedown / onmouseup
                           measurements for swipe




Sunday, October 9, 2011
CSS3 Media Queries
                                          Orientation Detection

                          • Orientation Detection
                          @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"/>




Sunday, October 9, 2011
Page Transitions

                          • translate3D(0,0,0)
                          • Hardware acceleration via the
                            device GPU




Sunday, October 9, 2011
Network Detection
                          navigator.connection
                          {  
                            "type": "3",  
                            "UNKNOWN": "0",  
                            "ETHERNET": "1",  
                            "WIFI": "2",  
                            "CELL_2G": "3",  
                            "CELL_3G": "4"  
                          }  




Sunday, October 9, 2011
Profiling and Optimizations
                          • Getting close to a native feel
                          • Start with WebKit Dev Tools, SpeedTracer, yslow, etc...




Sunday, October 9, 2011
Demos




Sunday, October 9, 2011
Questions?
                          git@github.com:richfaces/tweetstream.git




Sunday, October 9, 2011

Contenu connexe

Tendances

ActiveMQ Performance Tuning
ActiveMQ Performance TuningActiveMQ Performance Tuning
ActiveMQ Performance TuningChristian Posta
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Nuxeo
 
Camel oneactivemq posta-final
Camel oneactivemq posta-finalCamel oneactivemq posta-final
Camel oneactivemq posta-finalChristian Posta
 
Chicago Microservices Integration Talk
Chicago Microservices Integration TalkChicago Microservices Integration Talk
Chicago Microservices Integration TalkChristian Posta
 
Seamless Integrations between WebCenter Content, Site Studio, and WebCenter S...
Seamless Integrations between WebCenter Content, Site Studio, and WebCenter S...Seamless Integrations between WebCenter Content, Site Studio, and WebCenter S...
Seamless Integrations between WebCenter Content, Site Studio, and WebCenter S...Brian Huff
 
The Top 10 Things Oracle UCM Users Need To Know About WebLogic
The Top 10 Things Oracle UCM Users Need To Know About WebLogicThe Top 10 Things Oracle UCM Users Need To Know About WebLogic
The Top 10 Things Oracle UCM Users Need To Know About WebLogicBrian Huff
 
Essential Camel Components
Essential Camel ComponentsEssential Camel Components
Essential Camel ComponentsChristian Posta
 
Web Components v1
Web Components v1Web Components v1
Web Components v1Mike Wilcox
 
7 Stages of Scaling Web Applications
7 Stages of Scaling Web Applications7 Stages of Scaling Web Applications
7 Stages of Scaling Web ApplicationsDavid Mitzenmacher
 
Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0Mayank Srivastava
 
Great Responsive-ability Web Design
Great Responsive-ability Web DesignGreat Responsive-ability Web Design
Great Responsive-ability Web DesignMike Wilcox
 
Social Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and DominoSocial Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and DominoPaul Withers
 
The Future of Database Development
The Future of Database DevelopmentThe Future of Database Development
The Future of Database DevelopmentSteve Jones
 
Java EE Servlet/JSP Tutorial- Cookbook 2
Java EE Servlet/JSP Tutorial- Cookbook 2Java EE Servlet/JSP Tutorial- Cookbook 2
Java EE Servlet/JSP Tutorial- Cookbook 2billdigman
 
Integrating Microservices with Apache Camel
Integrating Microservices with Apache CamelIntegrating Microservices with Apache Camel
Integrating Microservices with Apache CamelChristian Posta
 
Shopzilla - Performance By Design
Shopzilla - Performance By DesignShopzilla - Performance By Design
Shopzilla - Performance By DesignTim Morrow
 
Benefits of an Open environment with Wakanda
Benefits of an Open environment with WakandaBenefits of an Open environment with Wakanda
Benefits of an Open environment with WakandaAlexandre Morgaut
 

Tendances (20)

Building SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.jsBuilding SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.js
 
ActiveMQ Performance Tuning
ActiveMQ Performance TuningActiveMQ Performance Tuning
ActiveMQ Performance Tuning
 
Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011Mobile ECM with JavaScript - JSE 2011
Mobile ECM with JavaScript - JSE 2011
 
Camel oneactivemq posta-final
Camel oneactivemq posta-finalCamel oneactivemq posta-final
Camel oneactivemq posta-final
 
Chicago Microservices Integration Talk
Chicago Microservices Integration TalkChicago Microservices Integration Talk
Chicago Microservices Integration Talk
 
Seamless Integrations between WebCenter Content, Site Studio, and WebCenter S...
Seamless Integrations between WebCenter Content, Site Studio, and WebCenter S...Seamless Integrations between WebCenter Content, Site Studio, and WebCenter S...
Seamless Integrations between WebCenter Content, Site Studio, and WebCenter S...
 
Azure Umbraco workshop
Azure Umbraco workshopAzure Umbraco workshop
Azure Umbraco workshop
 
The Top 10 Things Oracle UCM Users Need To Know About WebLogic
The Top 10 Things Oracle UCM Users Need To Know About WebLogicThe Top 10 Things Oracle UCM Users Need To Know About WebLogic
The Top 10 Things Oracle UCM Users Need To Know About WebLogic
 
Essential Camel Components
Essential Camel ComponentsEssential Camel Components
Essential Camel Components
 
Web Components v1
Web Components v1Web Components v1
Web Components v1
 
7 Stages of Scaling Web Applications
7 Stages of Scaling Web Applications7 Stages of Scaling Web Applications
7 Stages of Scaling Web Applications
 
Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0Targeting Mobile Platform with MVC 4.0
Targeting Mobile Platform with MVC 4.0
 
Great Responsive-ability Web Design
Great Responsive-ability Web DesignGreat Responsive-ability Web Design
Great Responsive-ability Web Design
 
Social Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and DominoSocial Connections 2015 CrossWorlds and Domino
Social Connections 2015 CrossWorlds and Domino
 
The Future of Database Development
The Future of Database DevelopmentThe Future of Database Development
The Future of Database Development
 
Html5
Html5Html5
Html5
 
Java EE Servlet/JSP Tutorial- Cookbook 2
Java EE Servlet/JSP Tutorial- Cookbook 2Java EE Servlet/JSP Tutorial- Cookbook 2
Java EE Servlet/JSP Tutorial- Cookbook 2
 
Integrating Microservices with Apache Camel
Integrating Microservices with Apache CamelIntegrating Microservices with Apache Camel
Integrating Microservices with Apache Camel
 
Shopzilla - Performance By Design
Shopzilla - Performance By DesignShopzilla - Performance By Design
Shopzilla - Performance By Design
 
Benefits of an Open environment with Wakanda
Benefits of an Open environment with WakandaBenefits of an Open environment with Wakanda
Benefits of an Open environment with Wakanda
 

Similaire à JavaOne 2011 - Going Mobile With Java Based Technologies Today

Mobile drupal: building a mobile theme
Mobile drupal: building a mobile themeMobile drupal: building a mobile theme
Mobile drupal: building a mobile themeJohn Albin Wilkins
 
[DCTPE2011] 7) Mobile Drupal(英/中雙語)
[DCTPE2011] 7) Mobile Drupal(英/中雙語)[DCTPE2011] 7) Mobile Drupal(英/中雙語)
[DCTPE2011] 7) Mobile Drupal(英/中雙語)Drupal Taiwan
 
Introduction To J Boss Seam
Introduction To J Boss SeamIntroduction To J Boss Seam
Introduction To J Boss Seamashishkulkarni
 
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)Peter Lubbers
 
Getting Started with HTML5 in Tech Com (STC 2012)
Getting Started with HTML5 in Tech Com (STC 2012)Getting Started with HTML5 in Tech Com (STC 2012)
Getting Started with HTML5 in Tech Com (STC 2012)Peter Lubbers
 
An introduction to GWT and Ext GWT
An introduction to GWT and Ext GWTAn introduction to GWT and Ext GWT
An introduction to GWT and Ext GWTDarrell Meyer
 
Developer Pitfalls & Strategies for Improving Mobile Web Developer Experience
Developer Pitfalls & Strategies for Improving Mobile Web Developer ExperienceDeveloper Pitfalls & Strategies for Improving Mobile Web Developer Experience
Developer Pitfalls & Strategies for Improving Mobile Web Developer ExperienceTasneem Sayeed
 
MongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema DesignMongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema DesignDATAVERSITY
 
WebBee rapid web app development teck stack
WebBee rapid web app development teck stackWebBee rapid web app development teck stack
WebBee rapid web app development teck stackALDAN3
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby ConferenceJohn Woodell
 
Flowdock's full-text search with MongoDB
Flowdock's full-text search with MongoDBFlowdock's full-text search with MongoDB
Flowdock's full-text search with MongoDBFlowdock
 
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
 
Starting from scratch in 2017
Starting from scratch in 2017Starting from scratch in 2017
Starting from scratch in 2017Stefano Bonetta
 
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)Shreeraj Shah
 
2010 code camp rest for the rest of us
2010 code camp   rest for the rest of us2010 code camp   rest for the rest of us
2010 code camp rest for the rest of usKen Yagen
 
W3C Mobile Web technologies
W3C Mobile Web technologiesW3C Mobile Web technologies
W3C Mobile Web technologiesRobin Berjon
 
Using mvvm on the web using knockoutjs & ignite ui
Using mvvm on the web using knockoutjs & ignite uiUsing mvvm on the web using knockoutjs & ignite ui
Using mvvm on the web using knockoutjs & ignite uiNish Anil
 
Going Mobile with HTML5
Going Mobile with HTML5Going Mobile with HTML5
Going Mobile with HTML5John Reiser
 

Similaire à JavaOne 2011 - Going Mobile With Java Based Technologies Today (20)

Mobile drupal: building a mobile theme
Mobile drupal: building a mobile themeMobile drupal: building a mobile theme
Mobile drupal: building a mobile theme
 
[DCTPE2011] 7) Mobile Drupal(英/中雙語)
[DCTPE2011] 7) Mobile Drupal(英/中雙語)[DCTPE2011] 7) Mobile Drupal(英/中雙語)
[DCTPE2011] 7) Mobile Drupal(英/中雙語)
 
Introduction To J Boss Seam
Introduction To J Boss SeamIntroduction To J Boss Seam
Introduction To J Boss Seam
 
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
 
Getting Started with HTML5 in Tech Com (STC 2012)
Getting Started with HTML5 in Tech Com (STC 2012)Getting Started with HTML5 in Tech Com (STC 2012)
Getting Started with HTML5 in Tech Com (STC 2012)
 
An introduction to GWT and Ext GWT
An introduction to GWT and Ext GWTAn introduction to GWT and Ext GWT
An introduction to GWT and Ext GWT
 
Developer Pitfalls & Strategies for Improving Mobile Web Developer Experience
Developer Pitfalls & Strategies for Improving Mobile Web Developer ExperienceDeveloper Pitfalls & Strategies for Improving Mobile Web Developer Experience
Developer Pitfalls & Strategies for Improving Mobile Web Developer Experience
 
MongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema DesignMongoDB at Sailthru: Scaling and Schema Design
MongoDB at Sailthru: Scaling and Schema Design
 
WebBee rapid web app development teck stack
WebBee rapid web app development teck stackWebBee rapid web app development teck stack
WebBee rapid web app development teck stack
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby Conference
 
Future of web_apps
Future of web_appsFuture of web_apps
Future of web_apps
 
Flowdock's full-text search with MongoDB
Flowdock's full-text search with MongoDBFlowdock's full-text search with MongoDB
Flowdock's full-text search with MongoDB
 
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
 
Starting from scratch in 2017
Starting from scratch in 2017Starting from scratch in 2017
Starting from scratch in 2017
 
Lift Introduction
Lift IntroductionLift Introduction
Lift Introduction
 
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
 
2010 code camp rest for the rest of us
2010 code camp   rest for the rest of us2010 code camp   rest for the rest of us
2010 code camp rest for the rest of us
 
W3C Mobile Web technologies
W3C Mobile Web technologiesW3C Mobile Web technologies
W3C Mobile Web technologies
 
Using mvvm on the web using knockoutjs & ignite ui
Using mvvm on the web using knockoutjs & ignite uiUsing mvvm on the web using knockoutjs & ignite ui
Using mvvm on the web using knockoutjs & ignite ui
 
Going Mobile with HTML5
Going Mobile with HTML5Going Mobile with HTML5
Going Mobile with HTML5
 

Dernier

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 

Dernier (20)

The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 

JavaOne 2011 - Going Mobile With Java Based Technologies Today

  • 1. Going Mobile With Java Based Technologies Today JavaOne 2011 Speaker: Wesley Hales @wesleyhales Sunday, October 9, 2011
  • 2. Wesley Hales • Senior Developer at Red Hat @w esle • W3C Member yha les • JSR 301/329 Rep. • HTML5 User Group Founder • html5rocks.com, DZone Refcard, and author of many other articles around the web. Sunday, October 9, 2011
  • 4. Mobile Platforms Mobile Frameworks And many more... Sunday, October 9, 2011
  • 6. Mobile Web Browsers Available Features • As a Java developer, which HTML5 features should I care about? • Web Workers • Web Sockets • Web Storage • Application Cache • Notifications, Geolocation, etc... Sunday, October 9, 2011
  • 7. Mobile Web Browsers Available Features Web Sockets no yes Web Workers no no * [10-2-2011] http://caniuse.com/#feat=webworkers Sunday, October 9, 2011
  • 8. Mobile Web Browsers Available Features appCache unlimited 10MB Web Storage 5MB 5MB Sunday, October 9, 2011
  • 9. HTML5 Mime Mappings <mime-mapping> <extension>appcache</extension> <mime-type>text/cache-manifest</mime-type> </mime-mapping> <mime-mapping> <extension>html</extension> <mime-type>text/html-sandboxed</mime-type> </mime-mapping> Sunday, October 9, 2011
  • 10. Top 5 Best Practices When working with HTML5 1) Use client side DBs instead of server round trips (localStorage) 2) Use CSS transitions instead of javascript animations (Enable hardware acceleration) 3) Boost performance with javascript 1.6 (no more "for loops")... [‘apples’,‘oranges’,‘forge’].forEach{...} 4) Use cache manifests for live sites, not just offline apps (reduce requests) 5) HTML5 Form attributes and input styles (paceholder, pattern, etc...) Sunday, October 9, 2011
  • 11. About The Demo Sunday, October 9, 2011
  • 12. TweetStream • Built to work with mobile webkit devices • Not using any mobile frameworks • Java app optimized for mobile Sunday, October 9, 2011
  • 13. TweetStream Java Tech Breakdown • Data Grids with Infinispan • JSR 299: CDI/Weld + Seam 3 • JMS 1.1 API • JSF 2.0 + RichFaces 4 Sunday, October 9, 2011
  • 14. 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. Sunday, October 9, 2011
  • 15. TweetStream Twitter4J •Open source project •Java API for easy access •OAuth support •Streaming feeds •Historical feeds Sunday, October 9, 2011
  • 16. TweetStream Infinispan •Highly scalable •In memory w/ spool off options •Easily clusterable and manageable Sunday, October 9, 2011
  • 17. TweetStream Twitter4J •Reliable and performant •Flexible clustering •Perfect for hookup into UI Sunday, October 9, 2011
  • 18. Access It Live Now! http://bit.ly/mobilejava #javaone and #mobilejava Sunday, October 9, 2011
  • 19. How Does Mobile Affect My Code? • Airplane mode • Integration and Extending features • Web Storage • Web Sockets • XHR2, File System API, etc... • Latency and file requests are everything • Dynamic resource serving optimizations Sunday, October 9, 2011
  • 20. Java Mobile Web Settings • Device and feature detection • Optimizing RichFaces push • JSF2 + HTML5 • Touch and gesture support • Mime mappings Sunday, October 9, 2011
  • 21. Other Mobile Web Settings • Minification (html5boilerplate) • Ajax Improvements • File Request Reduction Sunday, October 9, 2011
  • 22. Other Mobile Web Settings • Minification (html5boilerplate) • Ajax Improvements • File Request Reduction Sunday, October 9, 2011
  • 23. Device & Feature Detection Sunday, October 9, 2011
  • 24. Device & Feature Detection • MobileESP (server-side) • Modernizr (client-side) • CSS3 Media Queries Sunday, October 9, 2011
  • 25. Server Side Device Detection • Parsing the USER_AGENT • MobileESP • WURFL APIs Sunday, October 9, 2011
  • 26. Server Side Device Detection • Parsing the USER_AGENT • MobileESP • WURFL APIs Sunday, October 9, 2011
  • 27. MobileESP ...{ HttpServletRequest request... 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(); } Sunday, October 9, 2011
  • 28. WURFL Wireless Universal Resource File • Up to date list of all mobile devices • Available as XML file • Wrappers for most languages Sunday, October 9, 2011
  • 29. Feature Detection Modernizr • <html class="js canvas canvastext no-geolocation rgba hsla multiplebgs borderimage borderradius boxshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions video audio localstorage sessionstorage webworkers applicationcache fontface"> Sunday, October 9, 2011
  • 30. Feature Detection Modernizr • Adds classnames of available features to DOM • Allows use of browser features with fallback options • shiv & polyfills Sunday, October 9, 2011
  • 31. Feature Detection “Cascading” the detection: #nice {     background: url(background-one.png) top left repeat-x;     background: url(background-one.png) top left repeat-x,     url(background-two.png) bottom left repeat-x; } Using Modernizr: #nice {     background: url(background-one.png) top left repeat-x; } .multiplebgs #nice {     background: url(background-one.png) top left repeat-x,     url(background-two.png) bottom left repeat-x; } Sunday, October 9, 2011
  • 33. RichFaces Push • Integrates with Atmosphere • Supports Comet & WebSockets • Allows usage JMS queues/topic • Optimizable with custom queueing or use of CDI events Sunday, October 9, 2011
  • 34. RichFaces Push • 2 options • render specific UI regions on push • parse response as JSON Sunday, October 9, 2011
  • 35. RichFaces Push <a4j:jsFunction name="updateContent" action=" #{twitterAgent.refreshList}" render="list-form"/> <a4j:push address="content@twitter" onerror="alert('Error retrieving pushed data')" ondataavailable="updateContent()"> </a4j:push> Sunday, October 9, 2011
  • 36. JSF + Mobile Sunday, October 9, 2011
  • 37. JSF2 on Mobile • Sacrifices... • Created for the desktop • What exists for mobile JSF today? • the future Sunday, October 9, 2011
  • 38. Using JSF2 with HTML5 • HTML5 allows XML markup (which is emitted by JSF/Facelets) • XML Namespaces are only used server side Sunday, October 9, 2011
  • 39. Using JSF2 with HTML5 Normal JSF Markup... Renders to... <!DOCTYPE html> <html lang="en" <!DOCTYPE html>     xmlns:f="http://java.sun.com/jsf/core" <html lang="en">     xmlns:h="http://java.sun.com/jsf/html">     <h:head>     <head>         <title>Title</title>         <title>Title</title>     </h:head>     <h:body>     </head>         <h:outputText value="#{bean.text}" />     <body>     </h:body> </html>         Some text     </body> </html> Sunday, October 9, 2011
  • 40. Back Button and Bookmarking • Doable with 3rd party JSF frameworks like RichFaces • Uses location.hash Sunday, October 9, 2011
  • 41. Back Button and Bookmarking http://someurl.com/#foo:bar <a4j:jsFunction name="handleHashChange" render="@form" oncomplete="slideTo('foo location.hash.split(':')             <f:param name="demo" value="param1"/>             <f:param name="sample" value="param2"/> </a4j:jsFunction> window.onhashchange = function(){ handleHashChange(location.hash.split(':')) }; Sunday, October 9, 2011
  • 42. Mobile UI & Experience Sunday, October 9, 2011
  • 43. Mobile UI & Experience • Hardware Acceleration • Page Transitions: Sliding, Flipping, and Rotating • Fetching and Caching • Network Detection • Debugging & Profiling http://bit.ly/javaonemobile Sunday, October 9, 2011
  • 44. Touch Events •Duck Punch approach http://bit.ly/k8b2aB •onmousedown / onmouseup measurements for swipe Sunday, October 9, 2011
  • 45. CSS3 Media Queries Orientation Detection • Orientation Detection @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"/> Sunday, October 9, 2011
  • 46. Page Transitions • translate3D(0,0,0) • Hardware acceleration via the device GPU Sunday, October 9, 2011
  • 47. Network Detection navigator.connection {     "type": "3",     "UNKNOWN": "0",     "ETHERNET": "1",     "WIFI": "2",     "CELL_2G": "3",     "CELL_3G": "4"   }   Sunday, October 9, 2011
  • 48. Profiling and Optimizations • Getting close to a native feel • Start with WebKit Dev Tools, SpeedTracer, yslow, etc... Sunday, October 9, 2011
  • 50. Questions? git@github.com:richfaces/tweetstream.git Sunday, October 9, 2011