Full stackframework
Whatis RESThub ?Java StackJavascriptStack
Don'tRepeatYourself
Keep It Simple, Stupid
Not reinventing the wheel !Some rights reserved by vrogy
Java Stack
Java stack modulesGenericRESTWebserviceTapestry 5IntegrationPlugin ArchitectureGeneric Middle classesTooling - TestingDocumentation
Software designPlugin based architectureSpring + naming conventionclasspath*: scanningMaven multi modulesRuntime configurationwith SpELMultilayered software designInterface - ImplementationDAO - Service - ViewFocus on businessEnable progressive complexity
Java Middle stackValidatorJSR 303 Bean validationSpringDBUnitintegrationHades 2Generic DAOGeneric Services and tests3.5JPA2 PersistenceengineCross modules scanningfor JPA entitiesEmbedded database1.3
Generic classes@Named("bookingDao") public class JpaBookingDaoextends GenericJpaResourceDao<Booking> implements BookingDao {     ...}@Named("bookingService") public class BookingServiceImplextends GenericResourceServiceImpl<Booking, BookingDao> implements BookingService {     ...}
Generic testsDefault Spring behaviour (Rollback=true) isdisabled !In memory H2 database configurationAbstractResthubTest: Spring configuration aware
AbstractResthubTransactionalTest: your test istransactional
AbstractResthubTransactionAwareTest: designed to test yourservice layer
AbstractResthubWebTest: embeddedpreconfiguredJetty
AbstractDaoTest, AbstractServiceTest, AbstractControlerTest:generic CRUD unit testsSpringDBUnit integration@Named("sampleDataSet")public class SampleDataSetInitializerimplements DataSetInitializer{   @Overridepublic void createData() throws Exception { ...}}@InjectDataSet(value ="sampleDataSet",onceForClass=false)public class SampleDaoTest {@Testpublic void sampleTest() {	 ...}}
REST webservicesJAX-RS REST WebservicesOAuth2 basedsecurityJersey 1.6GenericwebservicesGeneric testsJSON SerializationJackson 1.77.3WADL explorer jQuery pluginRun/Debug web application
Generic REST ServicesHow to… retrieve a persisted object in database ?@GET@Path("/{ref}")@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})public Response getResource(@PathParam("ref") String ref) {	T entity = this.service.findByRef(ref);if(entity == null) {return Response.status(Status.NOT_FOUND).build();	}return Response.ok(entity).build();}
OAuth2
SerializationXML serialization thanks to JAXB annotation
JSON serialization
Not so simple to manage (cyclic object graphs)
« BadgerFish » or « Mapped » strategy are not easy to use
We have chosen Jackson  POJO serialization
Interesting features like parent/children bi–directional link support
Missing reference supportJavascriptStack
Use case 1 : server based MVC FrameworkClientsideStatelessBrowserDynamicpagesSessionMVC FrameworkWebservices(optional)MVCframeworkServer sideMiddleTemplateprocessing
Use case 2 : client MVC with RESThub JSSessionBrowserMVCframeworkClient sideHTML5/JavaScript RIATemplateprocessingStaticfilesDynamicdataRESTWebservices      Static file(JS, HTML, CSS)StatelessServer sideMiddle
Why Java developpershate JS ?Contextloss, and no classesScopes and closuresNo strongtypingCross browser compatibilityDamnit, it’s Web developpement !
But Web techno Rocks !ConcernsseparationHighlydynamicProductive and quickApps are trendy and sexy
No restart needed !
Javascriptstack for RIA WebappsBut why ?RIA vs Server sidepresentationframeworkSo muchunused power on our desktop !CompetitorsalreadyprovideframeworkAllows…Use the latest web technologies consistentlyReduce traffic and server loadReuse server-programming good practices
JavascriptstackWidgetsJavaScript core libraryui 1.81.4Script loader andOptimizerClass supportRESThub JS MVC
Script loadingI wantmy imports !define(['lib/resthub', 'routes', 'controllers/home'], function() { 	... });
RoutingOnly one « real » pageUsing the hash > no reload$.route('#/home', function() { 	... });$.route('#/home');
ClassesWe’reused to OOP, not prototypedefine(['lib/class'], function(Class) {returnClass.extend('MyClass', {attribute: 'some value',method: function() {         }    });});Static, instance, single inheritance
Controllers & templatesController: presentationlogicdefine(['lib/controller'], function(Controller) {returnController.extend('HomeController', {template : 'views/home.html',init : function() { this.render({user:{name:'Tyler'}});        }    });});Template: readable DOM fragment<p>Hello ${user.name} !</p>
WidgetsInteractive enhanced GUIBuildyour GUI, as in Swing/SWTinit: function() { this.render();    $('a.confirm', this.element)        .click($.proxy(this, '_confirmHandler')        .button({            label: i18n.buttons.confirm        });}
RepositoriesConnection to REST serversdefine(['lib/repository'], function(Repository) {returnRepository.extend('UserRepository', {root: 'api/users/',findByName: function(name, callback) { this._get(this.root + name, callback);        }    });});
BonusLocal storage > client sessionEvent bus > betweencontrollersI18n > like in JavaSecurity > OAuth2JSON > effective communicationConsole > like log4j…

Resthub lyonjug