Upload
lserwatka
View
1.730
Download
8
Tags:
Embed Size (px)
DESCRIPTION
Citation preview
Mobile Channels in eZ PublisheZ Conference 2011
Łukasz SerwatkaMobile Lead Engineer at eZ Systems
eZ Systems employee since March 2005Member of the Engineering Division
8 years experience with eZ Publish2 years experience with native mobile applications development (iOS,
Android)Author of many print and online publications about eZ PublishCreator of many eZ Publish extensions
Web: www.serwatka.netTwitter: @lserwatka
10.04.2023PRESENTER: ŁUKASZ SERWATKA 2
Mobile Channels in eZ PublisheZ Conference 2011
Mobile channels available in eZ Publish
mobile web channelweb technologies
HTML5CSS3 & SASSJavaScript
REST interfaceweb service oriented
lightweight client-server communicationJSON as output format
10.04.2023PRESENTER: ŁUKASZ SERWATKA 3
Mobile Channels in eZ PublisheZ Conference 2011
Content channels in eZ Publish
10.04.2023PRESENTER: ŁUKASZ SERWATKA 4
Mobile Channels in eZ PublisheZ Conference 2011
Mobile channels in eZ Publish
10.04.2023PRESENTER: ŁUKASZ SERWATKA 5
Mobile Channels in eZ PublisheZ Conference 2011
Environments: fragmentation
Symbian (Nokia)Andorid (Google)Bada (Samsung)Windows Phone (Microsoft/Nokia)iOS (Apple)BlackBerry (RIM)webOS (Palm/HP)MeeGo (Intel/Nokia/Maemo)
10.04.2023PRESENTER: ŁUKASZ SERWATKA 6
Mobile Channels in eZ PublisheZ Conference 2011
The Web
Cross-platformFamiliar skills & toolsEasily updatedDecentralizedIndexedWell-understood
… but
10.04.2023PRESENTER: ŁUKASZ SERWATKA 7
Mobile Channels in eZ PublisheZ Conference 2011
Caveats
Performance: slower to execute, limited on CPU/GPU resourceBrowser support: some needs to be ignoredDevice access: limited access to hardware, not fully there yetDebug: more difficult on the client sideDiscoverability: no official app store, yetMonetization: more difficultApp ‘experience’
10.04.2023PRESENTER: ŁUKASZ SERWATKA 8
Mobile Channels in eZ PublisheZ Conference 2011
Mobile web: engines
WebKit: ~57% market shareiOSBadaBlackBerry 6.0+SymbianAndoridwebOSMeeGo
Presto: ~21% market shareOpera MiniOpera Mobile
Others: ~22% market shareGecko, Trident, Mango, UC, Obigo …
10.04.2023PRESENTER: ŁUKASZ SERWATKA 9
Mobile Channels in eZ PublisheZ Conference 2011
Mobile HTML5
10.04.2023PRESENTER: ŁUKASZ SERWATKA 10
Mobile Channels in eZ PublisheZ Conference 2011
semantics
offline & storage
device access
connectivity
multimedia
3D, graphics & effects
performance & integration
CSS3
Technologies
accelerometer -webkit @page CSS Text localStorage @mediamanifest transform <video> WebSQLGeoLocationtype=camera canvas keyframe gradienttouch events<audio> Web Workers CSS3 SASS
… and more
10.04.2023PRESENTER: ŁUKASZ SERWATKA 11
Mobile Channels in eZ PublisheZ Conference 2011
Cross-browser
mobile web frameworks
JavaScript-based (programmatic approach)Sencha TouchSproutCore
Markup-based (progressive enhancement approach)jQTouchjQuery Mobile
10.04.2023PRESENTER: ŁUKASZ SERWATKA 12
Mobile Channels in eZ PublisheZ Conference 2011
Mobile web frameworks: why?
Provide user interface componentstoolbars, buttons, navigation bars, etc.
Smooth browser inconsistenciesnormalization is done under the hood, abstractions
Mimic native or server paradigmsUI elements, drop shadows, insets,
Create consistent application architectureMVC framework
10.04.2023PRESENTER: ŁUKASZ SERWATKA 13
Mobile Channels in eZ PublisheZ Conference 2011
jQTouch
sponsored by Sencha Labsmarkup-basedUI layer on top of jQuerylibrary progressively enhancesMIT licensewide browser support
http://jqtouch.com
10.04.2023PRESENTER: ŁUKASZ SERWATKA 14
Mobile Channels in eZ PublisheZ Conference 2011
jQuery Mobile
still in alpha versionmarkup-basedUI layer on top of jQuerylibrary progressively enhancesMIT or GPL2 licensewide browser support
http://jquerymobile.com
10.04.2023PRESENTER: ŁUKASZ SERWATKA 15
Mobile Channels in eZ PublisheZ Conference 2011
Sencha Touch
self-contained librarybuilt on ExtJSJavaScript-based approachstandalone MVC applicationscommercial and open source licenseswide browser support
http://www.sencha.com/products/touch/
10.04.2023PRESENTER: ŁUKASZ SERWATKA 16
Mobile Channels in eZ PublisheZ Conference 2011
Back to eZ Publish …
10.04.2023PRESENTER: ŁUKASZ SERWATKA 17
Mobile Channels in eZ PublisheZ Conference 2011
Mobile web channel in eZ Publish
accessible via eZ Publish “siteaccess” system;supports URI, HOST and PORT based access;permissions handling;can provide mobile optimized content and layout;template engine;content engine;
10.04.2023PRESENTER: ŁUKASZ SERWATKA 18
Mobile Channels in eZ PublisheZ Conference 2011
Mobile web channel in eZ Publish: configuration
Web server configurationVirtual-Host setup
eZ Publish configurationSiteaccess settingsPermissions setupDesign extension
10.04.2023PRESENTER: ŁUKASZ SERWATKA 19
Mobile Channels in eZ PublisheZ Conference 2011
Mobile web channel in eZ Publish: mobile detection
Apache Mobile Filterhttp://www.apachemobilefilter.org/
No built-in solution
10.04.2023PRESENTER: ŁUKASZ SERWATKA 20
Mobile Channels in eZ PublisheZ Conference 2011
Mobile web channel in eZ Publish: mobile detection
Smart detection but let user choice.Place link to the desktop version of your site as well.
10.04.2023PRESENTER: ŁUKASZ SERWATKA 21
Mobile Channels in eZ PublisheZ Conference 2011
Mobile web channel in eZ Publish: VH setup
Possible scenariosUse a separate domain altogether (e.g www.mobile-example.com)
Use a subdomain (e.g m.example.com)Probably the most popular optionURI approach as alternative (e.g example.com/mobile)
Use a .mobi top level domain
Combine with smart detection
10.04.2023PRESENTER: ŁUKASZ SERWATKA 22
Mobile Channels in eZ PublisheZ Conference 2011
Mobile web channel in eZ Publish: siteaccess
/settings/override/site.ini.append.php...[SiteAccessSettings]AvailableSiteAccessList[]AvailableSiteAccessList[]=exampleAvailableSiteAccessList[]=mobileMatchOrder=host
HostMatchMapItems[]=www.example.com;exampleHostMatchMapItems[]=m.example.com;mobile...
10.04.2023PRESENTER: ŁUKASZ SERWATKA 23
Mobile Channels in eZ PublisheZ Conference 2011
Mobile web channel in eZ Publish: viewport
Use the viewport meta tag to improve the presentation of your web content
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=yes" />
10.04.2023PRESENTER: ŁUKASZ SERWATKA 24
Mobile Channels in eZ PublisheZ Conference 2011
DEMO
10.04.2023PRESENTER: ŁUKASZ SERWATKA SLIDE 25
Mobile web channel in eZ Publish: hybrid apps
Native shell for a mobile webEmbedded WebView
PhoneGapaccess to device APIsonline build toolwide range of supported platforms
Distributed via AppStore, Android Market, etc.Access to download statisticsAccess to the application via native shell (Icon on device screen)
10.04.2023PRESENTER: ŁUKASZ SERWATKA 26
Mobile Channels in eZ PublisheZ Conference 2011
DEMO
10.04.2023PRESENTER: ŁUKASZ SERWATKA SLIDE 27
REST
REST
REpresentationalStateTransfer
10.04.2023PRESENTER: ŁUKASZ SERWATKA 29
Mobile Channels in eZ PublisheZ Conference 2011
REST
REpresentationalStateTransfer
REST is a set of principles that how Web standards, such as HTTP and URIs, are supposed to be used.
Give every “thing” an IDLink things togetherUse standard methodsResource with multiple representationsCommunicate statelessly
10.04.2023PRESENTER: ŁUKASZ SERWATKA 30
Mobile Channels in eZ PublisheZ Conference 2011
REST
REpresentationalStateTransfer
Key goals of REST include:
Scalability of component interactionsGenerality of interfacesIndependent deployment of componentsIntermediary components to reduce latency, enforce security and
encapsulate legacy systems
10.04.2023PRESENTER: ŁUKASZ SERWATKA 31
Mobile Channels in eZ PublisheZ Conference 2011
Life before eZ Publish REST interface
custom siteaccess s and template based XML outputcustom web service implementations involving eZ Publish modules/viewezjscore based web service implementations
10.04.2023PRESENTER: ŁUKASZ SERWATKA 32
Mobile Channels in eZ PublisheZ Conference 2011
eZ Publish REST interface
available as a core feature since version 4.5
10.04.2023PRESENTER: ŁUKASZ SERWATKA 33
Mobile Channels in eZ PublisheZ Conference 2011
eZ Publish REST interface
available as a core feature since version 4.5
dedicated front-end controller (index_rest.php as REST endpoint)
10.04.2023PRESENTER: ŁUKASZ SERWATKA 34
Mobile Channels in eZ PublisheZ Conference 2011
eZ Publish REST interface
available as a core feature since version 4.5
dedicated front-end controller (index_rest.php as REST endpoint)
10.04.2023PRESENTER: ŁUKASZ SERWATKA 35
Mobile Channels in eZ PublisheZ Conference 2011
eZ Publish REST interface
available as a core feature since version 4.5
dedicated front-end controller (index_rest.php as REST endpoint)based on the Zeta Components: MVCTools component
10.04.2023PRESENTER: ŁUKASZ SERWATKA 36
Mobile Channels in eZ PublisheZ Conference 2011
eZ Publish REST interface
available as a core feature since version 4.5
dedicated front-end controller (index_rest.php as REST endpoint)based on the Zeta Components: MVCTools component
content retrieval only, with possibility to extend
10.04.2023PRESENTER: ŁUKASZ SERWATKA 37
Mobile Channels in eZ PublisheZ Conference 2011
eZ Publish REST interface
available as a core feature since version 4.5
dedicated front-end controller (index_rest.php as REST endpoint)based on the Zeta Components: MVCTools component
content retrieval only, with possibility to extend
extensions mechanism
10.04.2023PRESENTER: ŁUKASZ SERWATKA 38
Mobile Channels in eZ PublisheZ Conference 2011
eZ Publish REST interface
available as a core feature since version 4.5
dedicated front-end controller (index_rest.php as REST endpoint)based on the Zeta Components: MVCTools component
content retrieval only, with possibility to extend
extensions mechanism
versioning
10.04.2023PRESENTER: ŁUKASZ SERWATKA 39
Mobile Channels in eZ PublisheZ Conference 2011
eZ Publish REST interface
available as a core feature since version 4.5
dedicated front-controller (index_rest.php as REST endpoint)based on the Zeta Components: MVCTools component
content retrieval only, with possibility to extend
extensions mechanism
versioning
OAuth 2.0 authentication
10.04.2023PRESENTER: ŁUKASZ SERWATKA 40
Mobile Channels in eZ PublisheZ Conference 2011
eZ Publish REST interface: other features
built-in caching
template based output for various resources
returned fields configured per request: responseGroups
10.04.2023PRESENTER: ŁUKASZ SERWATKA 41
Mobile Channels in eZ PublisheZ Conference 2011
eZ Publish REST interface: front-controller
10.04.2023PRESENTER: ŁUKASZ SERWATKA 42
Mobile Channels in eZ PublisheZ Conference 2011
eZ Publish REST interface: OAuth 2.0
web interface for applications management
support for custom OAuth login pages: override oauthloginpagelayout.tpl
configurable token expiry time in the rest.ini
10.04.2023PRESENTER: ŁUKASZ SERWATKA 43
Mobile Channels in eZ PublisheZ Conference 2011
eZ Publish REST interface
content is mapped into the resourcenodeobjectlistsfields
resources provided by the ezprestapiprovider extensionfor better upgradability and easier maintenance
new resources can be provided without eZ Publish upgrade
10.04.2023PRESENTER: ŁUKASZ SERWATKA 44
Mobile Channels in eZ PublisheZ Conference 2011
eZ Publish REST interface
content is mapped into the resourcenodeobjectlistsfields
resources provided by the ezprestapiprovider extensionfor better upgradability and easier maintenance
new resources can be provided without eZ Publish upgrade
10.04.2023PRESENTER: ŁUKASZ SERWATKA 45
Mobile Channels in eZ PublisheZ Conference 2011
ezpRestProviderInterface
every REST resource provider needs to implement ezpRestProviderInterface
interface ezpRestProviderInterface{ /** * Returns registered versioned routes for provider * * @abstract * @return array */ public function getRoutes();
/** * Returns associated with provider view controller * * @abstract * @return ezpRestViewController */ public function getViewController();}
10.04.2023PRESENTER: ŁUKASZ SERWATKA 46
Mobile Channels in eZ PublisheZ Conference 2011
REST URI pattern explained
10.04.2023PRESENTER: ŁUKASZ SERWATKA 47
Mobile Channels in eZ PublisheZ Conference 2011
REST URI pattern explained
10.04.2023PRESENTER: ŁUKASZ SERWATKA 48
Mobile Channels in eZ PublisheZ Conference 2011
global prefix which can be configured in the rest.iniworks as a token to trigger your re-write rule;/api/ as default prefix;
REST URI pattern explained
ezpRestPrefixFilterInterfaceresponsible for handling providers informationresponsible for handling version tokenezpRestDefaultRegexpPrefixFilter
/ezp/ as default provider tokenv + integer (e.g v1) as a version token
10.04.2023PRESENTER: ŁUKASZ SERWATKA 49
Mobile Channels in eZ PublisheZ Conference 2011
Versioning
versioning is supportedversion token is part of the URI resource e.g. /api/ezp/v1/…
use ezpRestVersionedRoute class to register your versioned resources
10.04.2023PRESENTER: ŁUKASZ SERWATKA 50
Mobile Channels in eZ PublisheZ Conference 2011
Versioning: examples
new ezpRestVersionedRoute( new ezpMvcRailsRoute( '/content/node/:nodeId/fields', 'ezpRestContentController', 'viewFields' ), 1 )
new ezpRestVersionedRoute( new ezpMvcRailsRoute( '/content/node/:nodeId/field/:fieldIdentifier', 'ezpRestContentController', 'viewField' ), 1 )
new ezpRestVersionedRoute( new ezpMvcRailsRoute( '/content/node/:nodeId/childrenCount', 'ezpRestContentController', 'countChildren' ), 1 )
new ezpRestVersionedRoute( new ezpMvcRailsRoute( '/content/object/:objectId', 'ezpRestContentController', 'viewContent' ), 1 )
10.04.2023PRESENTER: ŁUKASZ SERWATKA 51
Mobile Channels in eZ PublisheZ Conference 2011
Extensibility
done via eZ Publish extension systemcreate new provider by implementing ezpRestProviderInterface
register your new versioned resources
see ezprestapiprovider extension as a source of your inspiration
10.04.2023PRESENTER: ŁUKASZ SERWATKA 52
Mobile Channels in eZ PublisheZ Conference 2011
Resources
content consumption only
full CRUD in the next versionsneeds to be inline with eZ Publish PHP API
10.04.2023PRESENTER: ŁUKASZ SERWATKA 53
Mobile Channels in eZ PublisheZ Conference 2011
Resources: example
GET /[api]/v1/content/object/<objectId>/fields HTTP/1.1
/content/node/:nodeId/content/node/:nodeId/fields/content/node/:nodeId/field/:fieldIdentifier/content/node/:nodeId/childrenCount/content/object/:objectId/content/object/:objectId/fields
10.04.2023PRESENTER: ŁUKASZ SERWATKA 54
Mobile Channels in eZ PublisheZ Conference 2011
Resources: example
10.04.2023PRESENTER: ŁUKASZ SERWATKA 55
Mobile Channels in eZ PublisheZ Conference 2011
DEMO
10.04.2023PRESENTER: ŁUKASZ SERWATKA SLIDE 56
Knowledge sharing
guidelines for the developersmobile webhybrid applicationsnative applications
source code for sample apps available on GitHub
10.04.2023PRESENTER: ŁUKASZ SERWATKA 57
Mobile Channels in eZ PublisheZ Conference 2011