Hi, Dan. Really nice work!
It opens up a whole new world of options, allowing Apache Isis to be a first class option for modeling the Domain of Webapps implemented by other technologies. There are plenty of Web / Mobile UI frameworks or dev environments out there, but neither of them have specific support for implementing a good Domain Model. In fact, nearly all them use the ActiveRecord pattern or, worst, “domain scaffolding” … So this positions Apache Isis as a first class option for the “Domain Model” on nearly all web technology out there supporting Swagger (nearly all nowadays…). Congrats all ! > El 13 dic 2015, a las 17:49, Dan Haywood <[email protected]> > escribió: > > Hi folks > > We've recently been working on building a new mobile app recently [1], > leveraging the new content negotiation stuff in 1.11.0-SNAPSHOT that > returns simplified representations. > > To help build this app we've also put together integration with Swagger > UI. The mobile app example demonstrates this, and we'll make it part of > the simpleapp archetype for 1.11.0. > > The app itself uses Ionic, which is a mobile framework that sits on top of > AngularJS. What's nice about this particular framework is that it > leverages Apache Cordova, so the mobile apps can be packaged as either iOS > or Android apps. The app uses the Apache REST API, and also implements > HTTP Basic auth. > > I've also recorded a pair of screencasts, one demonstrating the swagger UI > [2] and the second demonstrating the ionic frontend [3]. They are a bit > rough-n-ready, but hopefully give the general gist. The ionic app doesn't > actually use any of the swagger generated stubs, but the swagger UI is > still very handy to help understand the data available in the REST API. > > Feedback welcome as ever, some more detailed notes below. > > Cheers > Dan > > > ~~~~ > Some further notes: > - the contactapp [1] is structured as "frontend" and "backend". I modified > the various gulp files etc so that "ionic serve" publishes not to "www" but > instead to ../backend/webapp/src/main/webapp/frontend. This means that the > Isis webapp can host the frontend as a webapp that calls back on itself. > - in web.xml [4], you should set whenNoSession to "unauthorized". The > default, "basicAuthChallenge", causes chrome to pop up its own auth prompt > dialog, which isn't what we want. > - the basic design for security is for the login controller to attempt to > access /restful/user using a HTTP basic auth header [5]. If it succeeds > then this is made the default for all subsequent requests [6] > - it isn't necessary to configure swagger-ui to make this work, but if you > want to do so, then the only requirements are to change the web.xml [7] and > to copy in the swagger-ui/index.html file verbatim [8] > > > [1] https://github.com/incodehq/contactapp > [2] https://youtu.be/87UhGeNXSHc > [3] https://youtu.be/7rL8vQEHZgE > [4] > https://github.com/incodehq/contactapp/blob/40fc861fc25c146ad54d6ec1d040655d0fa1b25a/backend/webapp/src/main/webapp/WEB-INF/web.xml#L293 > [5] > https://github.com/incodehq/contactapp/blob/40fc861fc25c146ad54d6ec1d040655d0fa1b25a/frontend/src/authentication.js#L79 > [6] > https://github.com/incodehq/contactapp/blob/40fc861fc25c146ad54d6ec1d040655d0fa1b25a/frontend/src/authentication.js#L61 > [7] > https://github.com/incodehq/contactapp/blob/40fc861fc25c146ad54d6ec1d040655d0fa1b25a/backend/webapp/src/main/webapp/WEB-INF/web.xml#L196 > [8] > https://github.com/incodehq/contactapp/blob/40fc861fc25c146ad54d6ec1d040655d0fa1b25a/backend/webapp/src/main/webapp/swagger-ui/index.html
