×
Copy
Open
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Slide 1
Slide 1 text
Static Resources Management workshop Brian Clozel @brianclozel
Slide 2
Slide 2 text
Getting started $ open http://bit.ly/resourcehandling $ git clone http://github.com/bclozel/… $ git fetch -‐-‐all $ cd angularjs && mvn package
Slide 3
Slide 3 text
Brian Clozel @brianclozel http://spring.io/team/bclozel
Slide 4
Slide 4 text
First application 4 What could we achieve before Spring 4.1?
Slide 5
Slide 5 text
Resource Handling < 4.1 • Serve static resources from *any* Spring Resource location • Basic Cache header management • Easy to configure 5
Slide 6
Slide 6 text
WORKSHOP PART #1
Slide 7
Slide 7 text
Remaining questions • optimize (concatenate, minify) • transform (LESS, coffeescript, gzip) • front-‐end optimization (cache busting URLs, concatenate, minify) • development experience 7
Slide 8
Slide 8 text
AngularJS 8 First run with Resource Handling
Slide 9
Slide 9 text
Sources of inspiration • a complete asset pipeline built into Spring MVC • fingerprinting URLs for cache busting • client side dev in Sagan project 9
Slide 10
Slide 10 text
Why not an asset pipeline? • runtime vs. build time approach • languages and tools evolve *fast* • ES6, HTTP/2 10
Slide 11
Slide 11 text
Client source code layout • src/main/webapp just not adequate anymore • client *and* server: dependency management, modularity, tests, build artifacts • client-‐side development: ctrl+S, F5 11
Slide 12
Slide 12 text
WORKSHOP PART #2
Slide 13
Slide 13 text
ES6 app 13 client-‐side build and JS module loaders
Slide 14
Slide 14 text
Spring 4.1 resource handling • ResourceResolver • ResourceTransformer • ResourceUrlProvider 14
Slide 15
Slide 15 text
Built-‐in ResourceResolvers • PathResourceResolver • VersionResourceResolver • GzipResourceResolver • CachingResourceResolver 15
Slide 16
Slide 16 text
Built-‐in ResourceTransformers • CssLinkResourceTransformer • AppCacheManifestResourceTransformer • CachingResourceTransformer 16
Slide 17
Slide 17 text
VersionResourceResolver • VersionStrategies: • ContentVersionStrategy (md5 hashes) • FixedVersionStrategy (version string as a path prefix) 17
Slide 18
Slide 18 text
WORKSHOP PART #3
Slide 19
Slide 19 text
Q&A 19 …and what’s next?
Slide 20
Slide 20 text
What’s next? • https://github.com/bclozel/spring-‐resource-‐ handling • https://github.com/spring-‐io/sagan • https://jira.spring.io 20