Your SlideShare is downloading. ×

Resthub

3,246
views

Published on

Fullstack Java toolkit built with HTML5 in mind …

Fullstack Java toolkit built with HTML5 in mind …

Published in: Technology

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,246
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. RESThub
    What is RESThub ?
    Three independant layers
    Security
    Hosting
    Demos
  • 2. What is RESThub ?
    http://resthub.org
  • 3. What is RESThub ?
    Javascript Stack
    Java WebserviceStack
    Security & Identity
    Generic Tests
    Documentation
    Java Middle Stack
  • 4. Keywords behind RESThub
  • 5. Generic DAO & Business Services
    HadesDao
    TESTED
    Generic
    Tested
    Extendable
    « extends »
    GenericDao
    GenericService
    Specific
    Testable
    Customized
    « extends »
    « extends »
    myDao
    myService
  • 6. Generic DAO & Business Services
    Provides…
    CRUD methods (Create, Retrieve, Update, Delete)
    Allows…
    Save time (↘ copy-paste-adjust) on technical layers
    Improve efficiency on the development of business layers
  • 7. Basic Example
    How to… obtain a complete DAO layer for my POJO?
    @Named("plopDao")
    publicclass PlopJpaDao extends GenericJpaDao<Plop> implements PlopDao {
    // Nothing
    }
    What else ?
  • 8. DAO & Business Services stack
    Out of the box configuration
    Identity manager
    Multi-modules JPA entities scanning
    Generic DAO & ServicesGeneric tests
    Embeded database
    JSR 303 Bean validation
    Validator
    1.2
    Dependency injection
    Generic DAO
    Hades 2
    3
    3.5
    Build system
    3
    JPA2 Persistenceengine
  • 9. Generic REST Web Services
    Provides…
    Generic methods to access business services
    XML and JSON objects serialization
    Allows…
    Easily build applications REST-based architecture
    GenericController
    « extends »
    myController
  • 10. Basic Example
    How to… retrieve a persisted object in database ?
    @GET
    @Path("/{id}")
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Response getResource(@PathParam("id") ID id) {
    T entity = this.service.findById(id);
    if(entity == null) {
    return Response.status(Status.NOT_FOUND).build();
    }
    return Response.ok(entity).build();
    }
  • 11. Webservices stack
    JSON Serialization
    OAuth2 based security
    Jackson 1.5
    7.1
    Run/Debug/Tests web application
    Generic webservices Generic tests
    JAX-RS REST Webservices
    Project templates (archetypes)
    Jersey 1.2
  • 12. Generic Tests
    Provides
    Generic methods to test your DAO, Business services and Webservices
    Better protection against side effects caused by code changes
    Allows
    Focus on testing your project functionnalities
  • 13. Basic Example
    How to… entirely test my DAO layer ?
    publicclass PlopDaoTest extends AbstractDaoTest<Plop, PlopDao> {
    @Inject
    @Named("plopDao")
    publicvoid setResourceDao(PlopDao resourceDao) {
    super.setResourceDao(resourceDao);
    }
    }
  • 14. Use case 1 : RESThub + MVC Framework
    Tapestry5 website
    Webservices
    Server side
    DAO and Services
  • 15. Use case 2 : RESThub full stack
    JavaScript stackbasedWebsite
    Client side
    Webservices
    Server side
    DAOandServices
  • 16. Javascript Stack for RIA WebApps
    Provides…
    Script loader
    Route manager
    Templating language
    Allows…
    Use the latest web technologies consistently
    Create lightweight RIA WebApps based on jQuery
    Reduce traffic and server load
  • 17. Wellknownwebapp software design
    Web browser
    Reloading page for each action
    Dynamic pages
    Application server
    SOAP proxytoJSON
    HTTP server
    Images
    SOAPWeb Services
    MVC framework
    based Web GUI
    session
    CSS
    Business Services
    Webservice
    SOAP
    Javascript
    DAO
  • 18. RESThub based webapp software design
    Web browser
    Changing the state of one widget on each action
    Script loader
    HTML 5 based session
    MVC Framework
    HTTP credentials
    JSON/XML Data
    Static pages
    Application server
    HTTP server
    OtherRESTWebservices
    Images
    REST Web Services
    CSS
    Business Services
    Javascript
    DAO
    HTML
  • 19. JavaScript stack
    JavaScript library
    1.4
    Client side templating
    JavaScript stack core
    RESThub controller
    JavaScript loading on route event
    Route & session manager
    Sammy
    WADL explorer jQuery plugin
    Script loader
    JavaScript compressor
  • 20. Consequences on the architecture
    Server is stateless
    Can change just a small part of the page
    Each part is independent (jQuery widget)
    URL are semantic (example.com/product/list)
    Client is statefull
    Recent browser provides « session storage »
    Each widget should knows his status
    Manage the reloading of the page (F5)
  • 21. RESThub on hostingside
    Clear separation between static and dynamic
    Static: interface HTML5, JS, CSS
    Dynamic: stateless secure webservices
    Out of the box caching compliancy
    Even when pages are user-customized
    More operations are computed on client side
    Better scalability thanks to stateless servers
  • 22. Security based on OAuth2
    OAuth 2.0 basedauthentication
    Work in progress IETF standard
    Tokenbased
    Used on Facebook and Twitter
    Maybenext version of OpenIDwill use ittoo
    Different profiles
    User Agent profile
    Webserver profile
    Single Sign On
  • 23. OAuth2 use case
  • 24. Current flow
  • 25. Demos
    Bookingdemo
    Hotelbooking Web application
    Hotelsearchengine
    Consult & cancel bookings
    Roundtabledemo
    Doodlelike
    Pollsearchengine
    Dev console
  • 26. RESThub sample : Roundtable
  • 27. RESThub sample : Booking
  • 28. JavaScript
    HTML
    Route 1
    Controller A
    View A
    Route 2
    Controller B
    View B
    Route 3
    Controller C
    View C
    URL
    Sammy
    Client side
    Route 4
    Controller D
    View D
    Controller E
    View E
    Route 5
    Resthub controller
    Events
    Web services
    Business services
    Server side
    DAO
    DB
  • 29. Booking example (2)
    booking/book.js
    mode=edit
    hotel/view.js
    click(proceed)
    booking/edit.js
    booking/book.js
    booking/book.js
    mode=view
    mode=edit
    hotel/view.js
    click(revise)
    booking/view.js
    click(confirm)
    resthub.controller.js
    Ajax request
    home.js