Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bclozel/spring-resource-handling
Spring Framework 4.1 Resource Handling example
https://github.com/bclozel/spring-resource-handling
Last synced: 7 days ago
JSON representation
Spring Framework 4.1 Resource Handling example
- Host: GitHub
- URL: https://github.com/bclozel/spring-resource-handling
- Owner: bclozel
- Created: 2014-04-24T14:13:01.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-01-16T17:20:48.000Z (almost 8 years ago)
- Last Synced: 2024-10-31T22:42:22.678Z (14 days ago)
- Language: Java
- Homepage: http://spring.io/blog/2014/07/24/spring-framework-4-1-handling-static-web-resources
- Size: 271 KB
- Stars: 132
- Watchers: 16
- Forks: 36
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Spring Resource Handling
========================[![Build Status](https://travis-ci.org/bclozel/spring-resource-handling.svg?branch=master)](https://travis-ci.org/bclozel/spring-resource-handling)
This application demonstrates new resource handling features in Spring Framework 4.1.
It was originally developed for the talk [Resource Handling in Spring MVC 4.1](https://2014.event.springone2gx.com/schedule/sessions/resource_handling_in_spring_mvc_4_1.html) talk at SpringOne2GX 2014.This projects requires a local install of node+npm (see [nvm](https://github.com/creationix/nvm)).
The easiest way to get started - from the project root - development version:
SPRING_PROFILES_ACTIVE=development ./gradlew :server:bootRun
Or the production version (more optimizations):SPRING_PROFILES_ACTIVE=production ./gradlew :server:bootRun
Then go to:* http://localhost:8080/ for an example with JMustache templating
* http://localhost:8080/groovy for an example with Groovy Template Engine
* http://localhost:8080/app for an example with an [HTML5 AppCache Manifest](http://www.html5rocks.com/en/tutorials/appcache/beginner/)
(you can check this in Chrome with chrome://appcache-internals/ )
* http://localhost:8080/less for an example with a LESS stylesheet; this page uses less files and the LESS JS transpiler
in development mode, and a transpiled version in production
* http://localhost:8080/jsp for a JSP example
* http://localhost:8080/velocity for a Velocity exampleInteresting parts of the application:
* [configuring resource handlers with resource resolvers and resource transformers](https://github.com/bclozel/spring-resource-handling/blob/master/server/src/main/resources/application-production.properties)
* [a sample template file using JMustache](https://github.com/bclozel/spring-resource-handling/blob/master/server/src/main/resources/mustache/index.html)
and a [custom Mustache lambdas](https://github.com/bclozel/spring-resource-handling/blob/master/server/src/main/java/org/springframework/samples/resources/support/MustacheViewResolverCustomizer.java) to resolve URLs to static resources