• Save
Server-Side-Push – Future of the WEB
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Server-Side-Push – Future of the WEB

on

  • 7,880 views

 

Statistics

Views

Total Views
7,880
Views on SlideShare
7,848
Embed Views
32

Actions

Likes
4
Downloads
0
Comments
0

2 Embeds 32

http://www.slideshare.net 24
http://jisi.dreamblog.jp 8

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Server-Side-Push – Future of the WEB Presentation Transcript

  • 1. Server-Side-Push – Future of the WEB ?!
    Matthias Wessendorf | matzew@apache.org
    http://matthiaswessendorf.wordpress.com
    http://twitter.com/mwessendorf
  • 2. Matthias Wessendorf
    Oracle Corporation
    Apache Software Foundation
    ASF Member
    Committer and PMC @Apache MyFaces (PMC Chair)
    Author
    (German) Java- and Eclipse-Magazine
    Books on Struts, J2ME & WebServices
    Speaker
    AjaxWorld
    Oracle Open World
    ApacheCon
    JavaOne
    JAX, WJAX
    @mwessendorf (Twitter)
  • 3. Agenda
    Introduction
    Comet / Server-Side Push
    Comet solutions
    Bayeux
    Generic
    JavaServer Faces
    comet.NEXT
  • 4. Agenda
    Introduction
    Comet / Server-Side Push
    Comet solutions
    Bayeux
    Generic
    JavaServer Faces
    comet.NEXT
  • 5. Google Wave – comet enabler ?
  • 6. „Real-Time“ for the WEB
    Polling (old-school solution)
    annoying..., traffic on the server  chatty solution
    Push
    Don‘t call us, we call you !
    Potential Use Cases
    collaborative tooling
    sharing documents
    chat
    streaming data ( football/soccer, ...)
    trading systems ( auctions)
    live reporting
    monitoring ( server console)
    pushing async data into the client ( credit card verification)
    ...
  • 7. Rethink your WEB APP!
    Push when you need it
  • 8. Don‘t think ONLY
    Request / Response
  • 9. Agenda
    Introduction
    Comet / Server-Side Push
    Comet solutions
    Bayeux
    Generic
    JavaServer Faces
    comet.NEXT
  • 10. Comet / server side push...or „real-time“ web...
  • 11. Issues with the transports
    polling VS long-polling VS streaming
    *  depends on the interval...** fallback to long-polling
  • 12. Comet – Some problems...
    Scalability
    Java NIO ...
    Container specific APIs
    Client side architecture
    How to integrate the pushed data ?
    pushed data callback (respone content):
    <script> _update_function(“html_id“, JSONpayload);</script>
    client side framework
  • 13. Agenda
    Introduction
    Comet / Server-Side Push
    Comet solutions
    Bayeux
    Generic
    JavaServer Faces
    comet.NEXT
  • 14. Agenda
    Bayeux
  • 15. Bayeux
    Bayeux Specification
    JSON-based protocol for transporting asynchronous msgs
    pub/sub  „JMS over http“
    Client and Server APIs
    Client:
    connect("/context/servlet");
    subscribe("/someChannel", javaScriptCallback);
    Server:
    Channel channel = bayeux.getChannel("/someChannel“);
    Message msg = bayeux.newMessage(client);
    msg.put(„city", "Murten");
    msg.put("event", "Developer Day 2009");
    channel.publish(message);
  • 16. Bayeux
    Bayeux Implementations
    Server:
    Jetty
    Tomcat (smaller and cleaner API)
    Glassfish / Grizzly
    Weblogic (HTTP Publish-Subscribe Server)Perl, Pyhton,...
    Client:
    dojo toolkit
    jQuery-based (two are there)
    Issues
    not a real Java standard (e.g. JSF / Servlet)
    different APIs for all implementations...
    (org.apache.** VS org.cometd.** VS weblogic.** ...)
  • 17. Bayeux with JSF ?
    Not yet there
    Steps for a possible JSF-Bayeux integration:
    pick a server-side API
    doing it again ? *
    pick a client-side API
    resue jQuery ?
    reuse dojo ?
    Avoid users from writing JavaScript
    Offer a (behavioral) tag:
    <mylib:bayeux channel="/someChannel" callback="myCallbackJavaScriptFunction"
    .../>
    * Servlet 3.0 will help here...
  • 18. Agenda
    Generic solution
  • 19. Atmosphere
    An Ajax Push (Comet) Framework
    „Comet for the masses“
    Solves the problem of different container APIs
    Servlet 3.0 will help, but ...
    Atmosphere provides a generic API for different containers
    No need to port your application to a specific server
    Runs on any Servlet 2.5 container (  Apache Tomcat 6)
    Uses Java 5 @nnotations
    Supports REST (JSR 311)
    Jersey implementation
    Open Source Framework (CDDL)
  • 20. Agenda
    JavaServer Faces
  • 21. JavaServer FacesWhat is it really ?
    Lightweight and extensible Web-Framework
    POJO, replace the bits (navigation, view-technology,...)
    API for UI Component Development
    Several 3rd party component suites available
    Goals
    Make Java-Web-Development simple
    Tooling (JDeveloper, Netbeans, Eclipse, ...)
    Implementations
    Mojarra  RI, hosted on java.net
    Apache MyFaces
    Caucho Resin
    OperaMasks.org
  • 22. JavaServer Faces
    Page Template
    Server Side
    <f:view>
    <h:form>
    <h:inputText value=“#{b.value}” />
    <h:inputText … />
    <h:inputText …. />

    <h:commandButton … />
    </h:form>
    </f:view>
    Servlet
    JSF
    Lifecycle
    In Memory Tree
    Form
    View Root
    UI Component
    Renderer
  • 23. JavaServer Faces and Comet
    Periodic Polling („old school“):
    request/response  JSF lifecycle
    <tr:poll> (e.g. Apache MyFaces Trinidad)
    Push and long-polling:
    extra „channel“ for comet
    needs a client architecture ...
    „client side rendering“
    <script> _update_component(“html_id“, JSONpayload);</script>
  • 24. JavaServer Faces and Comet
  • 25. Comet solutions for JSF
    Good news!
    There are some JSF/Comet solutions already today!
    more to come ?
    IceFaces
    PrimeFaces (uses Atmosphere)
    Oracle  ADF Faces Rich Client
  • 26. ADF Faces - RIA enabler
    http://tinyurl.com/adf-faces-live
  • 27. ADF Faces - Architecture
    client-side components
    <af:inputText id="idInputText" label="Label 1" value="#{myBean.value}"/>
    <af:panelLabelAndMessage labelAndAccessKey="Label 2">
    <af:inputText autoTab="true" simple="true" id="id1" maximumLength="3" columns="3" label="first"/>
    <af:inputText autoTab="true" simple="true" id="id2" maximumLength="3" columns="3" label="second"/>
    <af:inputText autoTab="true" simple="true" id="id3" maximumLength="3" columns="3" label="third"/>
    </af:panelLabelAndMessage>
    Label1
    Label2
    id1
    id2
    Id3
    OK
  • 28. ADF Faces – server-side Push
    Doing „comet“ is hard
    JavaScript guy and Server-side guy...
    Active Data Support is integrated into ADF
    important interface(s):
    ActiveDataModel
    ActiveDataListener
    custom implementation possible ...
    Channel sharing (no more browser limits)
    HA/fail-over support
    Weblogic
    ... and others
    http://matthiaswessendorf.wordpress.com
  • 29. ADF Faces – server-side Push
     DEMO 
  • 30. Agenda
    Introduction
    Comet / Server-Side Push
    Comet solutions
    Bayeux
    Generic
    JavaServer Faces
    comet.NEXT
  • 31. comet.NEXT – Servlet 3.0
    Part of Java EE 6
    ready in September 2009 December 2009
    ServletRequest interface
    startAsync() : AsyncContext
    startAsync(request, response) : AsyncContext
    isAsyncSupported() : boolean
    AsyncListener interface
    onComplete(asyncEvent) : void
    onTimeout(asyncEvent) : void
    one API for ALL Servlet 3.0 containers!
  • 32. comet.NEXT – Servlet 3.0
    Async example:
    service(Request req, Response res) {
    AsyncContext actx = req.startAsync();
    Runnable runnable = new Runnable() {
    public void run() {
    Message m = jmsTemplate.receive();
    res.write(m);
    req.complete();
    }
    };
    executor.submit(runnable);
    }
    Defensive programming:request.isAsyncSupported();request.isAsyncStarted();request.getAsyncContext();
  • 33. comet.NEXT – HTML 5
    WebSockets
    var socket = new WebSocket("ws://myserver.com");
    socket.onopen = function(evt) {...};
    socket.onmessage = function(evt) {alert( "Received Message: " + evt.data);
    };
    socket.onclose = function(evt) {...};
    Usage
    socket.postMsg(„Hallo Server“);
    socket.disconnect();
  • 34. comet.NEXT – HTML 5
    Server-Send-Events
    standardizes the format of (continuous) data stream
    native in the browser; cross-browser ...
    new HTML element „eventsource“:
    <eventsource src="http://my.server.com" onmessage="alert(event.data)" />
    Data property, contains JSON:
    data: {'conference' : {'city': 'Murten', 'event': 'SBB Developer Day'},'id' : '12345679'}
  • 35. comet.NEXT – HTML 5
    Today
    Server:
    Lift Framework
    Kaazing Gateway
    Jetty 7.x.y
    Browsers:
    Opera / Safari 4* / WebKit / Firefox Minefield*
    Google Chrome
    Future
    IE 11  (or Google Frame)
    UPDATE -> 2009/03/28
    Shrinking of HTML5 spec:
    http://annevankesteren.nl/2009/03/more-shrinking-html5
    *https://bugzilla.mozilla.org/show_bug.cgi?id=472529
  • 36. Questions
    and (maybe) answers
  • 37. Links and Resources
    ADF
    http://www.oracle.com/technology/products/adf/adffaces/index.html
    http://tinyurl.com/adf-faces-live
    Bayeux / Cometd
    http://cometdproject.dojotoolkit.org/
    Jetty and WebSockets
    http://webtide.com (BLOG)
    HTML 5 WebSockets
    http://dev.w3.org/html5/spec/Overview.html#comms
    Slides:
    http://www.slideshare.net/mwessendorf
  • 38. Thank you!matzew@apache.orgBLOG:matthiaswessendorf.wordpress.com