├── src ├── test │ ├── resources │ │ ├── templates │ │ │ ├── hello.hbs │ │ │ └── suffixed.html │ │ └── views │ │ │ └── prefixed.hbs │ └── groovy │ │ └── pl │ │ └── allegro │ │ └── tech │ │ └── boot │ │ └── autoconfigure │ │ └── handlebars │ │ ├── HandlebarsHelpersAutoConfigurationSpec.groovy │ │ ├── HandlebarsCustomHelpersAutoConfigurationSpec.groovy │ │ ├── HandlebarsTemplateAvailabilityProviderSpec.groovy │ │ ├── HandlebarsPropertiesSpec.groovy │ │ └── HandlebarsAutoConfigurationSpec.groovy └── main │ ├── resources │ └── META-INF │ │ ├── spring │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ │ └── spring.factories │ └── java │ └── pl │ └── allegro │ └── tech │ └── boot │ └── autoconfigure │ └── handlebars │ ├── HandlebarsHelper.java │ ├── HandlebarsValueResolversProperties.java │ ├── HandlebarsTemplateAvailabilityProvider.java │ ├── HandlebarsProperties.java │ ├── HandlebarsAutoConfiguration.java │ └── HandlebarsHelpersAutoConfiguration.java ├── settings.gradle ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── libs.versions.toml ├── test-dependencies ├── build.gradle └── src │ └── test │ └── groovy │ └── pl │ └── allegro │ └── tech │ └── boot │ └── autoconfigure │ └── handlebars │ └── HandlebarsHelpersDependenciesSpec.groovy ├── config ├── codenarc │ ├── test-rules.groovy │ └── StarterRuleSet-AllRulesByCategory.groovy ├── findbugs │ ├── findbugs-excludes.xml │ └── findbugs-includes.xml ├── checkstyle │ ├── suppressions.xml │ └── checkstyle.xml └── pmd │ └── pmd.xml ├── .gitignore ├── .github ├── dependabot.yml └── workflows │ ├── gradle.yml │ └── publish.yml ├── gradlew.bat ├── README.md ├── gradlew └── LICENSE /src/test/resources/templates/hello.hbs: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /src/test/resources/views/prefixed.hbs: -------------------------------------------------------------------------------- 1 | prefixed body -------------------------------------------------------------------------------- /src/test/resources/templates/suffixed.html: -------------------------------------------------------------------------------- 1 | suffixed body -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'handlebars-spring-boot-starter' 2 | include 'test-dependencies' -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/allegro/handlebars-spring-boot-starter/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | pl.allegro.tech.boot.autoconfigure.handlebars.HandlebarsAutoConfiguration 2 | pl.allegro.tech.boot.autoconfigure.handlebars.HandlebarsHelpersAutoConfiguration -------------------------------------------------------------------------------- /test-dependencies/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | testImplementation(parent) { exclude module: 'joda-time' } 3 | testImplementation libs.spock.core 4 | testImplementation libs.spring.boot.starter.web 5 | testImplementation libs.spring.boot.starter.test 6 | } -------------------------------------------------------------------------------- /config/codenarc/test-rules.groovy: -------------------------------------------------------------------------------- 1 | ruleset { 2 | ruleset('file:config/codenarc/StarterRuleSet-AllRulesByCategory.groovy') { 3 | ClassJavadoc(enabled: false) 4 | MethodName(enabled: false) 5 | NoDef(enabled: false) 6 | SpaceAroundMapEntryColon(enabled: false) 7 | Instanceof(enabled: false) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | distributionSha256Sum=bed1da33cca0f557ab13691c77f38bb67388119e4794d113e051039b80af9bb1 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Intellij Idea project files 2 | .idea/ 3 | *.iml 4 | *.ipr 5 | *.iws 6 | 7 | # gradle config 8 | .gradle/ 9 | 10 | # project binaries 11 | build/ 12 | /out/ 13 | /classes/ 14 | target 15 | 16 | # mac os x 17 | .DS_Store 18 | 19 | # netbeans 20 | .nb-gradle 21 | .nb-gradle-properties 22 | 23 | # eclipse project 24 | bin/ 25 | .classpath 26 | .project 27 | .settings/ -------------------------------------------------------------------------------- /src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | # Auto Configure 2 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 3 | pl.allegro.tech.boot.autoconfigure.handlebars.HandlebarsAutoConfiguration,\ 4 | pl.allegro.tech.boot.autoconfigure.handlebars.HandlebarsHelpersAutoConfiguration 5 | 6 | # Template availability providers 7 | org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider=\ 8 | pl.allegro.tech.boot.autoconfigure.handlebars.HandlebarsTemplateAvailabilityProvider 9 | -------------------------------------------------------------------------------- /src/main/java/pl/allegro/tech/boot/autoconfigure/handlebars/HandlebarsHelper.java: -------------------------------------------------------------------------------- 1 | package pl.allegro.tech.boot.autoconfigure.handlebars; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | @Target(ElementType.TYPE) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Component 13 | public @interface HandlebarsHelper { 14 | } 15 | -------------------------------------------------------------------------------- /config/findbugs/findbugs-excludes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "gradle" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | ignore: 13 | - dependency-name: "*" 14 | update-types: ["version-update:semver-patch"] 15 | -------------------------------------------------------------------------------- /.github/workflows/gradle.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Gradle 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle 3 | 4 | name: Java CI with Gradle 5 | 6 | on: [push, pull_request, workflow_dispatch] 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | with: 15 | fetch-depth: '2' 16 | - name: Set up JDK 17 | uses: actions/setup-java@v4 18 | with: 19 | java-version: '17' 20 | distribution: 'adopt' 21 | - name: Build with Gradle 22 | run: ./gradlew build 23 | - name: jacoco, coveralls 24 | run: ./gradlew test jacocoTestReport coveralls 25 | 26 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | release: 5 | types: [ created ] 6 | 7 | jobs: 8 | publish: 9 | 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | with: 14 | fetch-depth: 0 15 | 16 | - uses: gradle/wrapper-validation-action@v1 17 | 18 | - name: Set up JDK 17 19 | uses: actions/setup-java@v4 20 | with: 21 | java-version: 17 22 | distribution: 'adopt' 23 | 24 | - name: Publish to maven central 25 | run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository 26 | env: 27 | SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} 28 | SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} 29 | GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} 30 | GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} 31 | GPG_PRIVATE_KEY_PASSWORD: ${{ secrets.GPG_PRIVATE_KEY_PASSWORD }} 32 | -------------------------------------------------------------------------------- /config/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 11 | 14 | 17 | 20 | 23 | 26 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/java/pl/allegro/tech/boot/autoconfigure/handlebars/HandlebarsValueResolversProperties.java: -------------------------------------------------------------------------------- 1 | package pl.allegro.tech.boot.autoconfigure.handlebars; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | @ConfigurationProperties(prefix = "handlebars.resolver") 6 | public class HandlebarsValueResolversProperties { 7 | 8 | private Boolean map = true; 9 | 10 | private Boolean javaBean = true; 11 | 12 | private Boolean field = false; 13 | 14 | private Boolean method = false; 15 | 16 | public Boolean isMap() { 17 | return map; 18 | } 19 | 20 | public void setMap(Boolean map) { 21 | this.map = map; 22 | } 23 | 24 | public Boolean isJavaBean() { 25 | return javaBean; 26 | } 27 | 28 | public void setJavaBean(Boolean javaBean) { 29 | this.javaBean = javaBean; 30 | } 31 | 32 | public Boolean isField() { 33 | return field; 34 | } 35 | 36 | public void setField(Boolean field) { 37 | this.field = field; 38 | } 39 | 40 | public Boolean isMethod() { 41 | return method; 42 | } 43 | 44 | public void setMethod(Boolean method) { 45 | this.method = method; 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/pl/allegro/tech/boot/autoconfigure/handlebars/HandlebarsTemplateAvailabilityProvider.java: -------------------------------------------------------------------------------- 1 | package pl.allegro.tech.boot.autoconfigure.handlebars; 2 | 3 | import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider; 4 | import org.springframework.core.env.Environment; 5 | import org.springframework.core.io.ResourceLoader; 6 | 7 | import static org.springframework.util.ClassUtils.isPresent; 8 | import static pl.allegro.tech.boot.autoconfigure.handlebars.HandlebarsProperties.DEFAULT_PREFIX; 9 | import static pl.allegro.tech.boot.autoconfigure.handlebars.HandlebarsProperties.DEFAULT_SUFFIX; 10 | 11 | public class HandlebarsTemplateAvailabilityProvider implements TemplateAvailabilityProvider { 12 | 13 | @Override 14 | public boolean isTemplateAvailable(String view, Environment env, ClassLoader classLoader, ResourceLoader resourceLoader) { 15 | if (!isPresent("com.github.jknack.handlebars.Handlebars", classLoader)) { 16 | return false; 17 | } 18 | String prefix = env.getProperty("handlebars.prefix", DEFAULT_PREFIX); 19 | String suffix = env.getProperty("handlebars.suffix", DEFAULT_SUFFIX); 20 | 21 | return resourceLoader.getResource(prefix + view + suffix).exists(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test-dependencies/src/test/groovy/pl/allegro/tech/boot/autoconfigure/handlebars/HandlebarsHelpersDependenciesSpec.groovy: -------------------------------------------------------------------------------- 1 | package pl.allegro.tech.boot.autoconfigure.handlebars 2 | 3 | import com.github.jknack.handlebars.springmvc.HandlebarsViewResolver 4 | import org.springframework.boot.test.util.TestPropertyValues 5 | import org.springframework.mock.web.MockServletContext 6 | import org.springframework.web.context.support.AnnotationConfigWebApplicationContext 7 | import spock.lang.Specification 8 | 9 | class HandlebarsHelpersDependenciesSpec extends Specification { 10 | 11 | def context = new AnnotationConfigWebApplicationContext() 12 | 13 | def setup() { 14 | context.servletContext = new MockServletContext() 15 | TestPropertyValues.empty().applyTo(context) 16 | context.register(HandlebarsAutoConfiguration) 17 | context.register(HandlebarsHelpersAutoConfiguration) 18 | context.refresh() 19 | } 20 | 21 | def cleanup() { 22 | context?.close() 23 | } 24 | 25 | def 'should register helpers based on dependencies'() { 26 | given: 27 | def resolver = context.getBean(HandlebarsViewResolver) 28 | 29 | expect: 30 | !resolver.helper('jodaPattern') 31 | resolver.helper('json') 32 | resolver.helper('assign') 33 | resolver.helper('include') 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/test/groovy/pl/allegro/tech/boot/autoconfigure/handlebars/HandlebarsHelpersAutoConfigurationSpec.groovy: -------------------------------------------------------------------------------- 1 | package pl.allegro.tech.boot.autoconfigure.handlebars 2 | 3 | import com.github.jknack.handlebars.springmvc.HandlebarsViewResolver 4 | import org.springframework.boot.test.util.TestPropertyValues 5 | import org.springframework.mock.web.MockServletContext 6 | import org.springframework.web.context.support.AnnotationConfigWebApplicationContext 7 | import org.springframework.boot.test.util.TestPropertyValues; 8 | import spock.lang.Specification 9 | 10 | class HandlebarsHelpersAutoConfigurationSpec extends Specification { 11 | 12 | def context = new AnnotationConfigWebApplicationContext() 13 | 14 | def setup() { 15 | context.servletContext = new MockServletContext() 16 | TestPropertyValues.empty().applyTo(context) 17 | context.register(HandlebarsAutoConfiguration) 18 | context.register(HandlebarsHelpersAutoConfiguration) 19 | context.refresh() 20 | } 21 | 22 | def cleanup() { 23 | context?.close() 24 | } 25 | 26 | def 'should register helpers'() { 27 | given: 28 | def resolver = context.getBean(HandlebarsViewResolver) 29 | 30 | expect: 31 | with(resolver) { 32 | helper('json') 33 | helper('assign') 34 | helper('include') 35 | helper('stringFormat') 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/groovy/pl/allegro/tech/boot/autoconfigure/handlebars/HandlebarsCustomHelpersAutoConfigurationSpec.groovy: -------------------------------------------------------------------------------- 1 | package pl.allegro.tech.boot.autoconfigure.handlebars 2 | 3 | import com.github.jknack.handlebars.springmvc.HandlebarsViewResolver 4 | import org.springframework.boot.test.util.TestPropertyValues 5 | import org.springframework.mock.web.MockServletContext 6 | import org.springframework.web.context.support.AnnotationConfigWebApplicationContext 7 | import org.springframework.boot.test.util.TestPropertyValues; 8 | import spock.lang.Specification 9 | 10 | class HandlebarsCustomHelpersAutoConfigurationSpec extends Specification { 11 | 12 | def context = new AnnotationConfigWebApplicationContext() 13 | 14 | def setup() { 15 | context.servletContext = new MockServletContext() 16 | TestPropertyValues.empty().applyTo(context) 17 | context.register(HandlebarsAutoConfiguration) 18 | context.register(HandlebarsHelpersAutoConfiguration) 19 | context.register(CustomHelper) 20 | context.refresh() 21 | } 22 | 23 | def cleanup() { 24 | context?.close() 25 | } 26 | 27 | def 'should register helper'() { 28 | given: 29 | def resolver = context.getBean(HandlebarsViewResolver) 30 | 31 | expect: 32 | resolver.helper('foo') 33 | } 34 | } 35 | 36 | @HandlebarsHelper 37 | class CustomHelper { 38 | CharSequence foo() { 39 | 'bar' 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/groovy/pl/allegro/tech/boot/autoconfigure/handlebars/HandlebarsTemplateAvailabilityProviderSpec.groovy: -------------------------------------------------------------------------------- 1 | package pl.allegro.tech.boot.autoconfigure.handlebars 2 | 3 | import org.springframework.core.io.DefaultResourceLoader 4 | import org.springframework.mock.env.MockEnvironment 5 | import spock.lang.Specification 6 | 7 | class HandlebarsTemplateAvailabilityProviderSpec extends Specification { 8 | 9 | def provider = new HandlebarsTemplateAvailabilityProvider() 10 | def resourceLoader = new DefaultResourceLoader() 11 | def environment = new MockEnvironment() 12 | 13 | def 'should find template in default location'() { 14 | expect: 15 | provider.isTemplateAvailable('hello', environment, this.class.classLoader, resourceLoader) 16 | } 17 | 18 | def 'should not find template that does not exist'() { 19 | expect: 20 | !provider.isTemplateAvailable('whatever', environment, this.class.classLoader, resourceLoader) 21 | } 22 | 23 | def 'should find template with custom prefix'() { 24 | given: 25 | environment.setProperty('handlebars.prefix', 'classpath:views/') 26 | 27 | expect: 28 | provider.isTemplateAvailable('prefixed', environment, this.class.classLoader, resourceLoader) 29 | } 30 | 31 | def 'should find template with custom suffix'() { 32 | given: 33 | environment.setProperty('handlebars.suffix', '.html') 34 | 35 | expect: 36 | provider.isTemplateAvailable('suffixed', environment, this.class.classLoader, resourceLoader) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | spock = "2.3-groovy-4.0" 3 | joda = "2.13.0" 4 | handlebars = "4.4.0" 5 | springBoot = "3.3.4" 6 | spotbugsGradlePlugin = "6.0.23" 7 | nexusPublishGradlePlugin = "1.0.0" 8 | nebulaOptionalGradlePlugin = "6.0.0" 9 | coverallsGradlePlugin = "2.12.0" 10 | axionReleaseGradlePlugin = "1.13.3" 11 | nebulaExtra = "6.0.0" 12 | 13 | [libraries] 14 | spock-core = { group = "org.spockframework", name = "spock-core", version.ref = "spock" } 15 | spock-spring = { group = "org.spockframework", name = "spock-spring", version.ref = "spock" } 16 | spring-boot-starter-web = { group = "org.springframework.boot", name = "spring-boot-starter-web", version.ref = "springBoot" } 17 | joda-time = { group = "joda-time", name = "joda-time", version.ref = "joda" } 18 | handlebars-springmvc = { group = "com.github.jknack", name = "handlebars-springmvc", version.ref = "handlebars" } 19 | handlebars-guava-cache = { group = "com.github.jknack", name = "handlebars-guava-cache", version.ref = "handlebars" } 20 | handlebars-helpers = { group = "com.github.jknack", name = "handlebars-helpers", version.ref = "handlebars" } 21 | handlebars-jackson = { group = "com.github.jknack", name = "handlebars-jackson", version.ref = "handlebars" } 22 | spring-boot-configuration-processor = { group = "org.springframework.boot", name = "spring-boot-configuration-processor", version.ref = "springBoot" } 23 | spring-boot-starter-test = { group = "org.springframework.boot", name = "spring-boot-starter-test", version.ref = "springBoot" } 24 | nebula-extra = { group = "com.netflix.nebula", name = "gradle-extra-configurations-plugin", version.ref = "nebulaExtra" } 25 | 26 | [bundles] 27 | spock = ["spock-core", "spock-spring"] 28 | 29 | [plugins] 30 | spotbugs = { id = "com.github.spotbugs", version.ref = "spotbugsGradlePlugin" } 31 | nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPublishGradlePlugin" } 32 | nebula-optional = { id = "nebula.optional-base", version.ref = "nebulaOptionalGradlePlugin" } 33 | coveralls = { id = "com.github.kt3k.coveralls", version.ref = "coverallsGradlePlugin" } 34 | axion-release = { id = "pl.allegro.tech.build.axion-release", version.ref = "axionReleaseGradlePlugin" } 35 | -------------------------------------------------------------------------------- /src/test/groovy/pl/allegro/tech/boot/autoconfigure/handlebars/HandlebarsPropertiesSpec.groovy: -------------------------------------------------------------------------------- 1 | package pl.allegro.tech.boot.autoconfigure.handlebars 2 | 3 | import com.github.jknack.handlebars.context.FieldValueResolver 4 | import com.github.jknack.handlebars.context.JavaBeanValueResolver 5 | import com.github.jknack.handlebars.context.MapValueResolver 6 | import com.github.jknack.handlebars.springmvc.HandlebarsViewResolver 7 | import spock.lang.Specification 8 | 9 | class HandlebarsPropertiesSpec extends Specification { 10 | 11 | def viewResolver = new HandlebarsViewResolver() 12 | 13 | def 'should configure handlebars'() { 14 | given: 15 | def properties = new HandlebarsProperties(new HandlebarsValueResolversProperties()) 16 | 17 | when: 18 | properties.applyToMvcViewResolver(viewResolver) 19 | 20 | then: 21 | viewResolver.valueResolvers.size() == 2 22 | viewResolver.valueResolvers.contains(JavaBeanValueResolver.INSTANCE) 23 | viewResolver.valueResolvers.contains(MapValueResolver.INSTANCE) 24 | viewResolver.registerMessageHelper 25 | !viewResolver.failOnMissingFile 26 | !viewResolver.bindI18nToMessageSource 27 | } 28 | 29 | def 'should not register message helper'() { 30 | given: 31 | def properties = new HandlebarsProperties(new HandlebarsValueResolversProperties()) 32 | 33 | and: 34 | properties.registerMessageHelper = false 35 | 36 | when: 37 | properties.applyToMvcViewResolver(viewResolver) 38 | 39 | then: 40 | !viewResolver.helper('message') 41 | } 42 | 43 | def 'should set fail on missing file'() { 44 | given: 45 | def properties = new HandlebarsProperties(new HandlebarsValueResolversProperties()) 46 | 47 | and: 48 | properties.failOnMissingFile = true 49 | 50 | when: 51 | properties.applyToMvcViewResolver(viewResolver) 52 | 53 | then: 54 | viewResolver.failOnMissingFile 55 | } 56 | 57 | def 'should bind i18n to message source'() { 58 | given: 59 | def properties = new HandlebarsProperties(new HandlebarsValueResolversProperties()) 60 | 61 | and: 62 | properties.bindI18nToMessageSource = true 63 | 64 | when: 65 | properties.applyToMvcViewResolver(viewResolver) 66 | 67 | then: 68 | viewResolver.bindI18nToMessageSource 69 | } 70 | 71 | def 'should set value resolvers based on configuration'() { 72 | given: 73 | def configuration = [field: true, javaBean: false, map: false, method: false] 74 | def properties = new HandlebarsProperties(new HandlebarsValueResolversProperties(configuration)) 75 | 76 | when: 77 | properties.applyToMvcViewResolver(viewResolver) 78 | 79 | then: 80 | viewResolver.valueResolvers.size() == 1 81 | viewResolver.valueResolvers.contains(FieldValueResolver.INSTANCE) 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /src/main/java/pl/allegro/tech/boot/autoconfigure/handlebars/HandlebarsProperties.java: -------------------------------------------------------------------------------- 1 | package pl.allegro.tech.boot.autoconfigure.handlebars; 2 | 3 | import com.github.jknack.handlebars.ValueResolver; 4 | import com.github.jknack.handlebars.context.FieldValueResolver; 5 | import com.github.jknack.handlebars.context.JavaBeanValueResolver; 6 | import com.github.jknack.handlebars.context.MapValueResolver; 7 | import com.github.jknack.handlebars.context.MethodValueResolver; 8 | import com.github.jknack.handlebars.springmvc.HandlebarsViewResolver; 9 | 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.boot.autoconfigure.template.AbstractTemplateViewResolverProperties; 12 | import org.springframework.boot.context.properties.ConfigurationProperties; 13 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | import static org.springframework.util.Assert.isInstanceOf; 19 | 20 | @ConfigurationProperties(prefix = "handlebars") 21 | @EnableConfigurationProperties(HandlebarsValueResolversProperties.class) 22 | public class HandlebarsProperties extends AbstractTemplateViewResolverProperties { 23 | 24 | static final String DEFAULT_PREFIX = "classpath:templates/"; 25 | static final String DEFAULT_SUFFIX = ".hbs"; 26 | 27 | private Boolean registerMessageHelper = true; 28 | private Boolean failOnMissingFile = false; 29 | private Boolean bindI18nToMessageSource = false; 30 | 31 | private final HandlebarsValueResolversProperties valueResolversProperties; 32 | 33 | @Autowired 34 | protected HandlebarsProperties(HandlebarsValueResolversProperties valueResolversProperties) { 35 | super(DEFAULT_PREFIX, DEFAULT_SUFFIX); 36 | this.valueResolversProperties = valueResolversProperties; 37 | this.setCache(true); 38 | } 39 | 40 | @Override 41 | public void applyToMvcViewResolver(Object viewResolver) { 42 | super.applyToMvcViewResolver(viewResolver); 43 | isInstanceOf(HandlebarsViewResolver.class, viewResolver, 44 | "ViewResolver is not an instance of HandlebarsViewResolver :" + viewResolver); 45 | HandlebarsViewResolver resolver = (HandlebarsViewResolver) viewResolver; 46 | 47 | List valueResolvers = new ArrayList(); 48 | 49 | addValueResolverIfNeeded(valueResolvers, valueResolversProperties.isJavaBean(), JavaBeanValueResolver.INSTANCE); 50 | addValueResolverIfNeeded(valueResolvers, valueResolversProperties.isMap(), MapValueResolver.INSTANCE); 51 | addValueResolverIfNeeded(valueResolvers, valueResolversProperties.isField(), FieldValueResolver.INSTANCE); 52 | addValueResolverIfNeeded(valueResolvers, valueResolversProperties.isMethod(), MethodValueResolver.INSTANCE); 53 | 54 | resolver.setValueResolvers(listToArray(valueResolvers)); 55 | resolver.setRegisterMessageHelper(registerMessageHelper); 56 | resolver.setFailOnMissingFile(failOnMissingFile); 57 | resolver.setBindI18nToMessageSource(bindI18nToMessageSource); 58 | } 59 | 60 | public void setRegisterMessageHelper(Boolean registerMessageHelper) { 61 | this.registerMessageHelper = registerMessageHelper; 62 | } 63 | 64 | public void setFailOnMissingFile(Boolean failOnMissingFile) { 65 | this.failOnMissingFile = failOnMissingFile; 66 | } 67 | 68 | public void setBindI18nToMessageSource(Boolean bindI18nToMessageSource) { 69 | this.bindI18nToMessageSource = bindI18nToMessageSource; 70 | } 71 | 72 | private void addValueResolverIfNeeded(List resolvers, boolean property, ValueResolver resolver) { 73 | if (property) { 74 | resolvers.add(resolver); 75 | } 76 | } 77 | 78 | private ValueResolver[] listToArray(List resolvers) { 79 | return resolvers.toArray(new ValueResolver[resolvers.size()]); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Spring Boot Starter Handlebars 2 | ==== 3 | 4 | [![Build Status](https://img.shields.io/github/actions/workflow/status/allegro/handlebars-spring-boot-starter/gradle.yml)](https://github.com/allegro/handlebars-spring-boot-starter/actions/workflows/gradle.yml) 5 | [![Coverage Status](https://coveralls.io/repos/allegro/handlebars-spring-boot-starter/badge.svg)](https://coveralls.io/r/allegro/handlebars-spring-boot-starter) 6 | ![Maven Central](https://img.shields.io/maven-central/v/pl.allegro.tech.boot/handlebars-spring-boot-starter.svg) 7 | 8 | Spring Boot Starter support for 9 | [Handlebars.java](https://github.com/jknack/handlebars.java) 10 | (logic-less templates). 11 | 12 | ## Usage 13 | 14 | Add `handlebars-spring-boot-starter` as dependency: 15 | ```gradle 16 | repositories { 17 | mavenCentral() 18 | } 19 | 20 | dependencies { 21 | compile 'pl.allegro.tech.boot:handlebars-spring-boot-starter:$version' 22 | } 23 | ``` 24 | 25 | ## Requirements 26 | 27 | Since version 0.5.0 handlebars-spring-boot-starter requires Spring Boot 3, Spring Framework 6 and Java 17. 28 | 29 | ## Helpers 30 | 31 | Spring Boot Starter Handlebars will automatically register handlebars helpers based on project dependencies. 32 | Add any handlebars helper to dependencies and you can start using it. 33 | ```gradle 34 | dependencies { 35 | compile 'com.github.jknack:handlebars-helpers:4.4.0', 36 | 'com.github.jknack:handlebars-jackson:4.4.0' 37 | } 38 | ``` 39 | NOTE: JacksonHelper will register with name `json`. 40 | Every other helper will register with its default name. 41 | 42 | More information about available helpers can be found on 43 | [Handlebars.java](https://github.com/jknack/handlebars.java#helpers). 44 | 45 | ### Custom helpers 46 | 47 | To register a custom helper use [@HandlebarsHelper](src/main/java/pl/allegro/tech/boot/autoconfigure/handlebars/HandlebarsHelper.java) annotation. 48 | 49 | #### Example 50 | ```java 51 | @HandlebarsHelper 52 | public class CustomHelper { 53 | CharSequence foo() { 54 | return 'bar' 55 | } 56 | } 57 | ``` 58 | More information about how to create custom helpers can be found on [Using a HelperSource](https://github.com/jknack/handlebars.java#using-a-helpersource) 59 | 60 | ## Configuration 61 | 62 | Properties space is: `handlebars`. All basic properties of 63 | [AbstractTemplateViewResolverProperties.java](http://docs.spring.io/autorepo/docs/spring-boot/current/api/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.html) 64 | are available. 65 | 66 | Default configuration: 67 | ```yaml 68 | handlebars.enabled: true 69 | handlebars.prefix: classpath:templates/ 70 | handlebars.suffix: .hbs 71 | handlebars.cache: true 72 | handlebars.registerMessageHelper: true 73 | handlebars.failOnMissingFile: false 74 | handlebars.bindI18nToMessageSource: false 75 | handlebars.prettyPrint: false 76 | handlebars.infiniteLoops: false 77 | ``` 78 | NOTE: `handlebars-guava-cache` is used as template cache implementation. 79 | 80 | `resolver` configuration allows on/off available handlebars value resolvers. 81 | Here goes default configuration: 82 | ```yaml 83 | handlebars.resolver.javaBean: true 84 | handlebars.resolver.map: true 85 | handlebars.resolver.method: false 86 | handlebars.resolver.field: false 87 | ``` 88 | More information about value resolvers can be found on 89 | [Using the ValueResolver](https://github.com/jknack/handlebars.java#using-the-valueresolver). 90 | 91 | ### Custom cache template 92 | 93 | Set handlebars template cache by `@Bean` of type [TemplateCache](https://github.com/jknack/handlebars.java/blob/master/handlebars/src/main/java/com/github/jknack/handlebars/cache/TemplateCache.java). 94 | 95 | ### Custom template loader 96 | 97 | Set handlebars template loader by `@Bean` of type [TemplateLoader](https://github.com/jknack/handlebars.java/blob/master/handlebars/src/main/java/com/github/jknack/handlebars/io/TemplateLoader.java). 98 | 99 | ## License 100 | 101 | **handlebars-spring-boot-starter** is published under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0). 102 | -------------------------------------------------------------------------------- /src/main/java/pl/allegro/tech/boot/autoconfigure/handlebars/HandlebarsAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package pl.allegro.tech.boot.autoconfigure.handlebars; 2 | 3 | import com.github.jknack.handlebars.Template; 4 | import com.github.jknack.handlebars.cache.TemplateCache; 5 | import com.github.jknack.handlebars.guava.GuavaTemplateCache; 6 | import com.github.jknack.handlebars.io.TemplateLoader; 7 | import com.github.jknack.handlebars.io.TemplateSource; 8 | import com.github.jknack.handlebars.springmvc.HandlebarsViewResolver; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.boot.autoconfigure.AutoConfiguration; 11 | import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; 12 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 13 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 14 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; 15 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 16 | import org.springframework.context.annotation.Bean; 17 | import org.springframework.context.annotation.Configuration; 18 | 19 | import jakarta.annotation.PostConstruct; 20 | 21 | import static com.google.common.cache.CacheBuilder.newBuilder; 22 | 23 | @AutoConfiguration 24 | @ConditionalOnProperty(prefix = "handlebars", value = "enabled", havingValue = "true", matchIfMissing = true) 25 | @EnableConfigurationProperties(HandlebarsProperties.class) 26 | @ConditionalOnWebApplication 27 | public class HandlebarsAutoConfiguration { 28 | 29 | @Configuration 30 | protected static class HandlebarsViewResolverConfiguration { 31 | @Autowired 32 | private HandlebarsProperties handlebars; 33 | 34 | @Bean 35 | public HandlebarsViewResolver handlebarsViewResolver() { 36 | HandlebarsViewResolver handlebarsViewResolver = new HandlebarsViewResolver(); 37 | handlebars.applyToMvcViewResolver(handlebarsViewResolver); 38 | return handlebarsViewResolver; 39 | } 40 | } 41 | 42 | @Configuration 43 | protected static class HandlebarsCacheConfiguration { 44 | @Bean 45 | @ConditionalOnMissingBean 46 | public TemplateCache templateCache() { 47 | return new GuavaTemplateCache(newBuilder().build()); 48 | } 49 | } 50 | 51 | @Configuration 52 | protected static class HandlebarsCachingStrategyConfiguration { 53 | @Autowired 54 | private HandlebarsViewResolver handlebarsViewResolver; 55 | 56 | @Autowired 57 | private TemplateCache templateCacheInstance; 58 | 59 | @PostConstruct 60 | public void setCachingStrategy() { 61 | if (handlebarsViewResolver.isCache()) { 62 | handlebarsViewResolver.getHandlebars().with(templateCacheInstance); 63 | } 64 | } 65 | } 66 | 67 | @Configuration 68 | @ConditionalOnBean(TemplateLoader.class) 69 | protected static class HandlebarsTemplateLoaderConfiguration { 70 | @Autowired 71 | private HandlebarsViewResolver handlebarsViewResolver; 72 | 73 | @Autowired 74 | private TemplateLoader templateLoader; 75 | 76 | @PostConstruct 77 | public void setTemplateLoader() { 78 | handlebarsViewResolver.getHandlebars().with(templateLoader); 79 | } 80 | } 81 | 82 | @Configuration 83 | @ConditionalOnProperty("handlebars.prettyPrint") 84 | protected static class PrettyPrintConfiguration { 85 | @Autowired 86 | private HandlebarsViewResolver handlebarsViewResolver; 87 | 88 | @PostConstruct 89 | public void setPrettyPrint() { 90 | handlebarsViewResolver.getHandlebars().prettyPrint(true); 91 | } 92 | } 93 | 94 | @Configuration 95 | @ConditionalOnProperty("handlebars.infiniteLoops") 96 | protected static class InfiniteLoopsConfiguration { 97 | @Autowired 98 | private HandlebarsViewResolver handlebarsViewResolver; 99 | 100 | @PostConstruct 101 | public void setInfiniteLoops() { 102 | handlebarsViewResolver.getHandlebars().infiniteLoops(true); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/pl/allegro/tech/boot/autoconfigure/handlebars/HandlebarsHelpersAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package pl.allegro.tech.boot.autoconfigure.handlebars; 2 | 3 | import com.github.jknack.handlebars.helper.ext.AssignHelper; 4 | import com.github.jknack.handlebars.helper.ext.IncludeHelper; 5 | import com.github.jknack.handlebars.helper.ext.JodaHelper; 6 | import com.github.jknack.handlebars.helper.ext.NumberHelper; 7 | import com.github.jknack.handlebars.helper.StringHelpers; 8 | import com.github.jknack.handlebars.jackson.JacksonHelper; 9 | import com.github.jknack.handlebars.springmvc.HandlebarsViewResolver; 10 | import org.joda.time.format.DateTimeFormat; 11 | import org.springframework.beans.BeansException; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.beans.factory.config.BeanPostProcessor; 14 | import org.springframework.boot.autoconfigure.AutoConfiguration; 15 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 16 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; 17 | import org.springframework.context.annotation.Bean; 18 | import org.springframework.context.annotation.Configuration; 19 | 20 | import jakarta.annotation.PostConstruct; 21 | 22 | import static org.springframework.core.annotation.AnnotationUtils.findAnnotation; 23 | 24 | @AutoConfiguration 25 | @ConditionalOnClass(HandlebarsViewResolver.class) 26 | @ConditionalOnWebApplication 27 | public class HandlebarsHelpersAutoConfiguration { 28 | 29 | @Configuration 30 | @ConditionalOnClass(JacksonHelper.class) 31 | static class JsonHelperAutoConfiguration { 32 | 33 | @Autowired 34 | private HandlebarsViewResolver handlebarsViewResolver; 35 | 36 | @PostConstruct 37 | public void registerHelper() { 38 | handlebarsViewResolver.registerHelper("json", JacksonHelper.INSTANCE); 39 | } 40 | } 41 | 42 | @Configuration 43 | @ConditionalOnClass(AssignHelper.class) 44 | static class AssignHelperAutoConfiguration { 45 | 46 | @Autowired 47 | private HandlebarsViewResolver handlebarsViewResolver; 48 | 49 | @PostConstruct 50 | public void registerHelper() { 51 | handlebarsViewResolver.registerHelper("assign", AssignHelper.INSTANCE); 52 | } 53 | } 54 | 55 | @Configuration 56 | @ConditionalOnClass(IncludeHelper.class) 57 | static class IncludeHelperAutoConfiguration { 58 | 59 | @Autowired 60 | private HandlebarsViewResolver handlebarsViewResolver; 61 | 62 | @PostConstruct 63 | public void registerHelper() { 64 | handlebarsViewResolver.registerHelper("include", IncludeHelper.INSTANCE); 65 | } 66 | } 67 | 68 | @Configuration 69 | @ConditionalOnClass(NumberHelper.class) 70 | static class NumberHelpersAutoConfiguration { 71 | 72 | @Autowired 73 | private HandlebarsViewResolver handlebarsViewResolver; 74 | 75 | @PostConstruct 76 | public void registerHelpers() { 77 | NumberHelper.register(handlebarsViewResolver.getHandlebars()); 78 | } 79 | } 80 | 81 | @Configuration 82 | @ConditionalOnClass({JodaHelper.class, DateTimeFormat.class}) 83 | static class JodaHelpersAutoConfiguration { 84 | 85 | @Autowired 86 | private HandlebarsViewResolver handlebarsViewResolver; 87 | 88 | @PostConstruct 89 | public void registerHelpers() { 90 | handlebarsViewResolver.registerHelpers(JodaHelper.class); 91 | } 92 | } 93 | 94 | @Configuration 95 | @ConditionalOnClass(StringHelpers.class) 96 | static class StringHelpersAutoConfiguration { 97 | 98 | @Autowired 99 | private HandlebarsViewResolver handlebarsViewResolver; 100 | 101 | @PostConstruct 102 | public void registerHelpers() { 103 | StringHelpers.register(handlebarsViewResolver.getHandlebars()); 104 | } 105 | } 106 | 107 | @Bean 108 | public BeanPostProcessor handlebarsBeanPostProcessor(final HandlebarsViewResolver handlebarsViewResolver) { 109 | return new BeanPostProcessor() { 110 | @Override 111 | public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { 112 | return bean; 113 | } 114 | 115 | @Override 116 | public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { 117 | HandlebarsHelper annotation = findAnnotation(bean.getClass(), HandlebarsHelper.class); 118 | if (annotation != null) { 119 | handlebarsViewResolver.registerHelpers(bean); 120 | } 121 | return bean; 122 | } 123 | }; 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /src/test/groovy/pl/allegro/tech/boot/autoconfigure/handlebars/HandlebarsAutoConfigurationSpec.groovy: -------------------------------------------------------------------------------- 1 | package pl.allegro.tech.boot.autoconfigure.handlebars 2 | 3 | import static org.springframework.web.servlet.support.RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE 4 | 5 | import com.github.jknack.handlebars.guava.GuavaTemplateCache 6 | import com.github.jknack.handlebars.cache.HighConcurrencyTemplateCache 7 | import com.github.jknack.handlebars.cache.NullTemplateCache 8 | import com.github.jknack.handlebars.io.ClassPathTemplateLoader 9 | import com.github.jknack.handlebars.springmvc.HandlebarsViewResolver 10 | import com.github.jknack.handlebars.springmvc.SpringTemplateLoader 11 | import org.springframework.beans.factory.NoSuchBeanDefinitionException 12 | import org.springframework.context.annotation.Bean 13 | import org.springframework.mock.web.MockHttpServletRequest 14 | import org.springframework.mock.web.MockHttpServletResponse 15 | import org.springframework.mock.web.MockServletContext 16 | import org.springframework.web.context.support.AnnotationConfigWebApplicationContext 17 | import org.springframework.boot.test.util.TestPropertyValues; 18 | import spock.lang.Specification 19 | 20 | class HandlebarsAutoConfigurationSpec extends Specification { 21 | 22 | def context = new AnnotationConfigWebApplicationContext() 23 | 24 | def setup() { 25 | context.servletContext = new MockServletContext() 26 | } 27 | 28 | def cleanup() { 29 | context?.close() 30 | } 31 | 32 | def 'should configure handlebars'() { 33 | given: 34 | 'register and refresh context'() 35 | 36 | when: 37 | def resolver = context.getBean(HandlebarsViewResolver) 38 | 39 | then: 40 | resolver.handlebars.cache instanceof GuavaTemplateCache 41 | resolver.handlebars.loader instanceof SpringTemplateLoader 42 | resolver.helper('message') 43 | !resolver.failOnMissingFile 44 | !resolver.bindI18nToMessageSource 45 | } 46 | 47 | def 'not enabled handlebars'() { 48 | given: 49 | 'register and refresh context'('handlebars.enabled=false') 50 | 51 | when: 52 | context.getBean(HandlebarsViewResolver) 53 | 54 | then: 55 | thrown NoSuchBeanDefinitionException 56 | } 57 | 58 | def 'not enabled handlebars with wrong property'() { 59 | given: 60 | 'register and refresh context'('handlebars.enabled=') 61 | 62 | when: 63 | context.getBean(HandlebarsViewResolver) 64 | 65 | then: 66 | thrown NoSuchBeanDefinitionException 67 | } 68 | 69 | def 'enabled handlebars with property'() { 70 | given: 71 | 'register and refresh context'('handlebars.enabled=true') 72 | 73 | when: 74 | def resolver = context.getBean(HandlebarsViewResolver) 75 | 76 | then: 77 | resolver instanceof HandlebarsViewResolver 78 | } 79 | 80 | def 'enabled handlebars'() { 81 | given: 82 | 'register and refresh context'() 83 | 84 | when: 85 | def resolver = context.getBean(HandlebarsViewResolver) 86 | 87 | then: 88 | resolver instanceof HandlebarsViewResolver 89 | } 90 | 91 | def 'should configure handlebars without cache'() { 92 | given: 93 | 'register and refresh context'('handlebars.cache:false') 94 | 95 | when: 96 | def resolver = context.getBean(HandlebarsViewResolver) 97 | 98 | then: 99 | resolver.handlebars.cache instanceof NullTemplateCache 100 | } 101 | 102 | def 'should configure handlebars with custom template cache'() { 103 | given: 104 | context.register(CustomConfiguration) 105 | 'register and refresh context'() 106 | 107 | when: 108 | def resolver = context.getBean(HandlebarsViewResolver) 109 | 110 | then: 111 | resolver.handlebars.cache instanceof HighConcurrencyTemplateCache 112 | } 113 | 114 | def 'should configure handlebars with pretty print'() { 115 | given: 116 | 'register and refresh context'('handlebars.prettyPrint:true') 117 | 118 | when: 119 | def resolver = context.getBean(HandlebarsViewResolver) 120 | 121 | then: 122 | resolver.handlebars.prettyPrint 123 | } 124 | 125 | def 'should configure handlebars with infinite loops'() { 126 | given: 127 | 'register and refresh context'('handlebars.infiniteLoops:true') 128 | 129 | when: 130 | def resolver = context.getBean(HandlebarsViewResolver) 131 | 132 | then: 133 | resolver.handlebars.infiniteLoops 134 | } 135 | 136 | def 'should configure handlebars with custom template loader'() { 137 | given: 138 | context.register(CustomConfiguration) 139 | 'register and refresh context'() 140 | 141 | when: 142 | def resolver = context.getBean(HandlebarsViewResolver) 143 | 144 | then: 145 | resolver.handlebars.loader instanceof ClassPathTemplateLoader 146 | } 147 | 148 | def 'should resolve view'() { 149 | given: 150 | 'register and refresh context'() 151 | 152 | expect: 153 | render('hello').contentAsString == 'hello world' 154 | } 155 | 156 | def 'should resolve view from custom classpath'() { 157 | given: 158 | 'register and refresh context'('handlebars.prefix:classpath:views') 159 | 160 | expect: 161 | render('prefixed').contentAsString == 'prefixed body' 162 | } 163 | 164 | def 'should resolve view with custom suffix'() { 165 | given: 166 | 'register and refresh context'('handlebars.suffix:.html') 167 | 168 | expect: 169 | render('suffixed').contentAsString == 'suffixed body' 170 | } 171 | 172 | def 'register and refresh context'(String... env) { 173 | TestPropertyValues.of(env).applyTo(context) 174 | context.register(HandlebarsAutoConfiguration) 175 | context.refresh() 176 | } 177 | 178 | def render(String viewName) throws Exception { 179 | def resolver = context.getBean(HandlebarsViewResolver) 180 | def view = resolver.resolveViewName(viewName, Locale.UK) 181 | assert view 182 | def request = new MockHttpServletRequest() 183 | request.setAttribute(WEB_APPLICATION_CONTEXT_ATTRIBUTE, context) 184 | def response = new MockHttpServletResponse() 185 | view.render(null, request, response) 186 | response 187 | } 188 | } 189 | 190 | class CustomConfiguration { 191 | @Bean 192 | HighConcurrencyTemplateCache cache() { 193 | new HighConcurrencyTemplateCache() 194 | } 195 | 196 | @Bean 197 | ClassPathTemplateLoader loader() { 198 | new ClassPathTemplateLoader() 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /config/checkstyle/checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 168 | 170 | 171 | 172 | 173 | 174 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 185 | 186 | 187 | 188 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 147 | # shellcheck disable=SC3045 148 | MAX_FD=$( ulimit -H -n ) || 149 | warn "Could not query maximum file descriptor limit" 150 | esac 151 | case $MAX_FD in #( 152 | '' | soft) :;; #( 153 | *) 154 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 155 | # shellcheck disable=SC3045 156 | ulimit -n "$MAX_FD" || 157 | warn "Could not set maximum file descriptor limit to $MAX_FD" 158 | esac 159 | fi 160 | 161 | # Collect all arguments for the java command, stacking in reverse order: 162 | # * args from the command line 163 | # * the main class name 164 | # * -classpath 165 | # * -D...appname settings 166 | # * --module-path (only if needed) 167 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 168 | 169 | # For Cygwin or MSYS, switch paths to Windows format before running java 170 | if "$cygwin" || "$msys" ; then 171 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 172 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 173 | 174 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 175 | 176 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 177 | for arg do 178 | if 179 | case $arg in #( 180 | -*) false ;; # don't mess with options #( 181 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 182 | [ -e "$t" ] ;; #( 183 | *) false ;; 184 | esac 185 | then 186 | arg=$( cygpath --path --ignore --mixed "$arg" ) 187 | fi 188 | # Roll the args list around exactly as many times as the number of 189 | # args, so each arg winds up back in the position where it started, but 190 | # possibly modified. 191 | # 192 | # NB: a `for` loop captures its iteration list before it begins, so 193 | # changing the positional parameters here affects neither the number of 194 | # iterations, nor the values presented in `arg`. 195 | shift # remove old arg 196 | set -- "$@" "$arg" # push replacement arg 197 | done 198 | fi 199 | 200 | # Collect all arguments for the java command; 201 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 202 | # shell script including quotes and variable substitutions, so put them in 203 | # double quotes to make sure that they get re-expanded; and 204 | # * put everything else in single quotes, so that it's not re-expanded. 205 | 206 | set -- \ 207 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 208 | -classpath "$CLASSPATH" \ 209 | org.gradle.wrapper.GradleWrapperMain \ 210 | "$@" 211 | 212 | # Stop when "xargs" is not available. 213 | if ! command -v xargs >/dev/null 2>&1 214 | then 215 | die "xargs is not available" 216 | fi 217 | 218 | # Use "xargs" to parse quoted args. 219 | # 220 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 221 | # 222 | # In Bash we could simply go: 223 | # 224 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 225 | # set -- "${ARGS[@]}" "$@" 226 | # 227 | # but POSIX shell has neither arrays nor command substitution, so instead we 228 | # post-process each arg (as a line of input to sed) to backslash-escape any 229 | # character that might be a shell metacharacter, then use eval to reverse 230 | # that process (while maintaining the separation between arguments), and wrap 231 | # the whole thing up as a single "set" statement. 232 | # 233 | # This will of course break if any of these variables contains a newline or 234 | # an unmatched quote. 235 | # 236 | 237 | eval "set -- $( 238 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 239 | xargs -n1 | 240 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 241 | tr '\n' ' ' 242 | )" '"$@"' 243 | 244 | exec "$JAVACMD" "$@" 245 | -------------------------------------------------------------------------------- /config/pmd/pmd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 3 5 | 6 | 7 | 3 8 | 9 | 10 | 3 11 | 12 | 13 | 3 14 | 15 | 16 | 3 17 | 18 | 19 | 3 20 | 21 | 22 | 3 23 | 24 | 25 | 3 26 | 27 | 28 | 3 29 | 30 | 31 | 3 32 | 33 | 34 | 3 35 | 36 | 37 | 3 38 | 39 | 40 | 3 41 | 42 | 43 | 3 44 | 45 | 46 | 3 47 | 48 | 49 | 4 50 | 51 | 52 | 3 53 | 54 | 55 | 2 56 | 57 | 58 | 3 59 | 60 | 61 | 3 62 | 63 | 64 | 3 65 | 66 | 67 | 3 68 | 69 | 70 | 4 71 | 72 | 73 | 2 74 | 75 | 76 | 4 77 | 78 | 79 | 3 80 | 81 | 82 | 2 83 | 84 | 85 | 2 86 | 87 | 88 | 4 89 | 90 | 91 | 2 92 | 93 | 94 | 3 95 | 96 | 97 | 5 98 | 99 | 100 | 3 101 | 102 | 103 | 3 104 | 105 | 106 | 3 107 | 108 | 109 | 2 110 | 111 | 112 | 2 113 | 114 | 115 | 2 116 | 117 | 118 | 3 119 | 120 | 121 | 3 122 | 123 | 124 | 2 125 | 126 | 127 | 3 128 | 129 | 130 | 3 131 | 132 | 133 | 4 134 | 135 | 136 | 4 137 | 138 | 139 | 3 140 | 141 | 142 | 3 143 | 144 | 145 | 3 146 | 147 | 148 | 3 149 | 150 | 151 | 3 152 | 153 | 154 | 3 155 | 156 | 157 | 3 158 | 159 | 160 | 3 161 | 162 | 163 | 3 164 | 165 | 166 | 3 167 | 168 | 169 | 4 170 | 171 | 172 | 2 173 | 174 | 175 | 3 176 | 177 | 178 | 4 179 | 180 | 181 | 3 182 | 183 | 184 | 3 185 | 186 | 187 | 3 188 | 189 | 190 | 3 191 | 192 | 193 | 2 194 | 195 | 196 | 3 197 | 198 | 199 | 3 200 | 201 | 202 | 3 203 | 204 | 205 | 3 206 | 207 | 208 | 3 209 | 210 | 211 | 3 212 | 213 | 214 | 3 215 | 216 | 217 | 3 218 | 219 | 220 | 3 221 | 222 | 223 | 3 224 | 225 | 226 | 3 227 | 228 | 229 | 4 230 | 231 | 232 | 3 233 | 234 | 235 | 3 236 | 237 | 238 | 3 239 | 240 | 241 | 4 242 | 243 | 244 | 3 245 | 246 | 247 | 248 | 249 | 250 | 251 | 3 252 | 253 | 254 | 255 | 256 | 257 | 3 258 | 259 | 260 | 261 | 262 | 263 | 3 264 | 265 | 266 | 267 | 268 | 269 | 3 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | -------------------------------------------------------------------------------- /config/codenarc/StarterRuleSet-AllRulesByCategory.groovy: -------------------------------------------------------------------------------- 1 | ruleset { 2 | 3 | // rulesets/basic.xml 4 | AssertWithinFinallyBlock 5 | AssignmentInConditional 6 | BigDecimalInstantiation 7 | BitwiseOperatorInConditional 8 | BooleanGetBoolean 9 | BrokenNullCheck 10 | BrokenOddnessCheck 11 | ClassForName 12 | ComparisonOfTwoConstants 13 | ComparisonWithSelf 14 | ConstantAssertExpression 15 | ConstantIfExpression 16 | ConstantTernaryExpression 17 | DeadCode 18 | DoubleNegative 19 | DuplicateCaseStatement 20 | DuplicateMapKey 21 | DuplicateSetValue 22 | EmptyCatchBlock 23 | EmptyClass 24 | EmptyElseBlock 25 | EmptyFinallyBlock 26 | EmptyForStatement 27 | EmptyIfStatement 28 | EmptyInstanceInitializer 29 | EmptyMethod 30 | EmptyStaticInitializer 31 | EmptySwitchStatement 32 | EmptySynchronizedStatement 33 | EmptyTryBlock 34 | EmptyWhileStatement 35 | EqualsAndHashCode 36 | EqualsOverloaded 37 | ExplicitGarbageCollection 38 | ForLoopShouldBeWhileLoop 39 | HardCodedWindowsFileSeparator 40 | HardCodedWindowsRootDirectory 41 | IntegerGetInteger 42 | MultipleUnaryOperators 43 | RandomDoubleCoercedToZero 44 | RemoveAllOnSelf 45 | ReturnFromFinallyBlock 46 | ThrowExceptionFromFinallyBlock 47 | 48 | // rulesets/braces.xml 49 | ElseBlockBraces 50 | ForStatementBraces 51 | IfStatementBraces 52 | WhileStatementBraces 53 | 54 | // rulesets/concurrency.xml 55 | BusyWait 56 | DoubleCheckedLocking 57 | InconsistentPropertyLocking 58 | InconsistentPropertySynchronization 59 | NestedSynchronization 60 | StaticCalendarField 61 | StaticConnection 62 | StaticDateFormatField 63 | StaticMatcherField 64 | StaticSimpleDateFormatField 65 | SynchronizedMethod 66 | SynchronizedOnBoxedPrimitive 67 | SynchronizedOnGetClass 68 | SynchronizedOnReentrantLock 69 | SynchronizedOnString 70 | SynchronizedOnThis 71 | SynchronizedReadObjectMethod 72 | SystemRunFinalizersOnExit 73 | ThisReferenceEscapesConstructor 74 | ThreadGroup 75 | ThreadLocalNotStaticFinal 76 | ThreadYield 77 | UseOfNotifyMethod 78 | VolatileArrayField 79 | VolatileLongOrDoubleField 80 | WaitOutsideOfWhileLoop 81 | 82 | // rulesets/convention.xml 83 | ConfusingTernary 84 | CouldBeElvis 85 | HashtableIsObsolete 86 | IfStatementCouldBeTernary 87 | InvertedIfElse 88 | LongLiteralWithLowerCaseL 89 | NoDef 90 | ParameterReassignment 91 | TernaryCouldBeElvis 92 | VectorIsObsolete 93 | 94 | // rulesets/design.xml 95 | AbstractClassWithPublicConstructor 96 | AbstractClassWithoutAbstractMethod 97 | BooleanMethodReturnsNull 98 | BuilderMethodWithSideEffects 99 | CloneableWithoutClone 100 | CloseWithoutCloseable 101 | CompareToWithoutComparable 102 | ConstantsOnlyInterface 103 | EmptyMethodInAbstractClass 104 | FinalClassWithProtectedMember 105 | ImplementationAsType 106 | Instanceof 107 | LocaleSetDefault 108 | NestedForLoop 109 | PrivateFieldCouldBeFinal 110 | PublicInstanceField 111 | ReturnsNullInsteadOfEmptyArray 112 | ReturnsNullInsteadOfEmptyCollection 113 | SimpleDateFormatMissingLocale 114 | StatelessSingleton 115 | ToStringReturnsNull 116 | 117 | // rulesets/dry.xml 118 | DuplicateListLiteral 119 | DuplicateMapLiteral 120 | DuplicateNumberLiteral 121 | DuplicateStringLiteral 122 | 123 | // rulesets/enhanced.xml 124 | CloneWithoutCloneable 125 | JUnitAssertEqualsConstantActualValue 126 | UnsafeImplementationAsMap 127 | 128 | // rulesets/exceptions.xml 129 | CatchArrayIndexOutOfBoundsException 130 | CatchError 131 | CatchException 132 | CatchIllegalMonitorStateException 133 | CatchIndexOutOfBoundsException 134 | CatchNullPointerException 135 | CatchRuntimeException 136 | CatchThrowable 137 | ConfusingClassNamedException 138 | ExceptionExtendsError 139 | ExceptionExtendsThrowable 140 | ExceptionNotThrown 141 | MissingNewInThrowStatement 142 | ReturnNullFromCatchBlock 143 | SwallowThreadDeath 144 | ThrowError 145 | ThrowException 146 | ThrowNullPointerException 147 | ThrowRuntimeException 148 | ThrowThrowable 149 | 150 | // rulesets/formatting.xml 151 | BlankLineBeforePackage 152 | BracesForClass 153 | BracesForForLoop 154 | BracesForIfElse 155 | BracesForMethod 156 | BracesForTryCatchFinally 157 | ClassJavadoc 158 | ClosureStatementOnOpeningLineOfMultipleLineClosure 159 | ConsecutiveBlankLines 160 | FileEndsWithoutNewline 161 | LineLength 162 | MissingBlankLineAfterImports 163 | MissingBlankLineAfterPackage 164 | SpaceAfterCatch 165 | SpaceAfterClosingBrace 166 | SpaceAfterComma 167 | SpaceAfterFor 168 | SpaceAfterIf 169 | SpaceAfterOpeningBrace 170 | SpaceAfterSemicolon 171 | SpaceAfterSwitch 172 | SpaceAfterWhile 173 | SpaceAroundClosureArrow 174 | SpaceAroundMapEntryColon 175 | SpaceAroundOperator 176 | SpaceBeforeClosingBrace 177 | SpaceBeforeOpeningBrace 178 | TrailingWhitespace 179 | 180 | // rulesets/generic.xml 181 | IllegalClassMember 182 | IllegalClassReference 183 | IllegalPackageReference 184 | IllegalRegex 185 | IllegalString 186 | IllegalSubclass 187 | RequiredRegex 188 | RequiredString 189 | StatelessClass 190 | 191 | // rulesets/groovyism.xml 192 | AssignCollectionSort 193 | AssignCollectionUnique 194 | ClosureAsLastMethodParameter 195 | CollectAllIsDeprecated 196 | ConfusingMultipleReturns 197 | ExplicitArrayListInstantiation 198 | ExplicitCallToAndMethod 199 | ExplicitCallToCompareToMethod 200 | ExplicitCallToDivMethod 201 | ExplicitCallToEqualsMethod 202 | ExplicitCallToGetAtMethod 203 | ExplicitCallToLeftShiftMethod 204 | ExplicitCallToMinusMethod 205 | ExplicitCallToModMethod 206 | ExplicitCallToMultiplyMethod 207 | ExplicitCallToOrMethod 208 | ExplicitCallToPlusMethod 209 | ExplicitCallToPowerMethod 210 | ExplicitCallToRightShiftMethod 211 | ExplicitCallToXorMethod 212 | ExplicitHashMapInstantiation 213 | ExplicitHashSetInstantiation 214 | ExplicitLinkedHashMapInstantiation 215 | ExplicitLinkedListInstantiation 216 | ExplicitStackInstantiation 217 | ExplicitTreeSetInstantiation 218 | GStringAsMapKey 219 | GStringExpressionWithinString 220 | GetterMethodCouldBeProperty 221 | GroovyLangImmutable 222 | UseCollectMany 223 | UseCollectNested 224 | 225 | // rulesets/imports.xml 226 | DuplicateImport 227 | ImportFromSamePackage 228 | ImportFromSunPackages 229 | MisorderedStaticImports 230 | NoWildcardImports 231 | UnnecessaryGroovyImport 232 | UnusedImport 233 | 234 | // rulesets/jdbc.xml 235 | DirectConnectionManagement 236 | JdbcConnectionReference 237 | JdbcResultSetReference 238 | JdbcStatementReference 239 | 240 | // rulesets/junit.xml 241 | ChainedTest 242 | CoupledTestCase 243 | JUnitAssertAlwaysFails 244 | JUnitAssertAlwaysSucceeds 245 | JUnitFailWithoutMessage 246 | JUnitLostTest 247 | JUnitPublicField 248 | JUnitPublicNonTestMethod 249 | JUnitPublicProperty 250 | JUnitSetUpCallsSuper 251 | JUnitStyleAssertions 252 | JUnitTearDownCallsSuper 253 | JUnitTestMethodWithoutAssert 254 | JUnitUnnecessarySetUp 255 | JUnitUnnecessaryTearDown 256 | JUnitUnnecessaryThrowsException 257 | SpockIgnoreRestUsed 258 | UnnecessaryFail 259 | UseAssertEqualsInsteadOfAssertTrue 260 | UseAssertFalseInsteadOfNegation 261 | UseAssertNullInsteadOfAssertEquals 262 | UseAssertSameInsteadOfAssertTrue 263 | UseAssertTrueInsteadOfAssertEquals 264 | UseAssertTrueInsteadOfNegation 265 | 266 | // rulesets/logging.xml 267 | LoggerForDifferentClass 268 | LoggerWithWrongModifiers 269 | LoggingSwallowsStacktrace 270 | MultipleLoggers 271 | PrintStackTrace 272 | Println 273 | SystemErrPrint 274 | SystemOutPrint 275 | 276 | // rulesets/naming.xml 277 | AbstractClassName 278 | ClassName 279 | ClassNameSameAsFilename 280 | ConfusingMethodName 281 | FactoryMethodName 282 | FieldName 283 | InterfaceName 284 | MethodName 285 | ObjectOverrideMisspelledMethodName 286 | PackageName 287 | PackageNameMatchesFilePath 288 | ParameterName 289 | PropertyName 290 | VariableName 291 | 292 | // rulesets/security.xml 293 | FileCreateTempFile 294 | InsecureRandom 295 | JavaIoPackageAccess 296 | NonFinalPublicField 297 | NonFinalSubclassOfSensitiveInterface 298 | ObjectFinalize 299 | PublicFinalizeMethod 300 | SystemExit 301 | UnsafeArrayDeclaration 302 | 303 | // rulesets/serialization.xml 304 | EnumCustomSerializationIgnored 305 | SerialPersistentFields 306 | SerialVersionUID 307 | SerializableClassMustDefineSerialVersionUID 308 | 309 | // rulesets/size.xml 310 | AbcMetric // Requires the GMetrics jar 311 | ClassSize 312 | CrapMetric // Requires the GMetrics jar and a Cobertura coverage file 313 | CyclomaticComplexity // Requires the GMetrics jar 314 | MethodCount 315 | MethodSize 316 | NestedBlockDepth 317 | ParameterCount 318 | 319 | // rulesets/unnecessary.xml 320 | AddEmptyString 321 | ConsecutiveLiteralAppends 322 | ConsecutiveStringConcatenation 323 | UnnecessaryBigDecimalInstantiation 324 | UnnecessaryBigIntegerInstantiation 325 | UnnecessaryBooleanExpression 326 | UnnecessaryBooleanInstantiation 327 | UnnecessaryCallForLastElement 328 | UnnecessaryCallToSubstring 329 | UnnecessaryCast 330 | UnnecessaryCatchBlock 331 | UnnecessaryCollectCall 332 | UnnecessaryCollectionCall 333 | UnnecessaryConstructor 334 | UnnecessaryDefInFieldDeclaration 335 | UnnecessaryDefInMethodDeclaration 336 | UnnecessaryDefInVariableDeclaration 337 | UnnecessaryDotClass 338 | UnnecessaryDoubleInstantiation 339 | UnnecessaryElseStatement 340 | UnnecessaryFinalOnPrivateMethod 341 | UnnecessaryFloatInstantiation 342 | UnnecessaryGString 343 | UnnecessaryGetter 344 | UnnecessaryIfStatement 345 | UnnecessaryInstanceOfCheck 346 | UnnecessaryInstantiationToGetClass 347 | UnnecessaryIntegerInstantiation 348 | UnnecessaryLongInstantiation 349 | UnnecessaryModOne 350 | UnnecessaryNullCheck 351 | UnnecessaryNullCheckBeforeInstanceOf 352 | UnnecessaryObjectReferences 353 | UnnecessaryOverridingMethod 354 | UnnecessaryPackageReference 355 | UnnecessaryParenthesesForMethodCallWithClosure 356 | UnnecessaryPublicModifier 357 | UnnecessaryReturnKeyword 358 | UnnecessarySafeNavigationOperator 359 | UnnecessarySelfAssignment 360 | UnnecessarySemicolon 361 | UnnecessaryStringInstantiation 362 | UnnecessaryTernaryExpression 363 | UnnecessaryToString 364 | UnnecessaryTransientModifier 365 | 366 | // rulesets/unused.xml 367 | UnusedArray 368 | UnusedMethodParameter 369 | UnusedObject 370 | UnusedPrivateField 371 | UnusedPrivateMethod 372 | UnusedPrivateMethodParameter 373 | UnusedVariable 374 | 375 | 376 | } 377 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /config/findbugs/findbugs-includes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | --------------------------------------------------------------------------------