-
-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #486 from juliensadaoui/jhipster-6.10.4
Sync with JHipster 6.10.4
- Loading branch information
Showing
85 changed files
with
16,503 additions
and
9,805 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = { | ||
'{,src/**/}*.{md,json,ts,css,scss,yml}': ['prettier --write', 'git add'] | ||
'{,src/**/}*.{json,md,yml,ts,css,scss}': ['prettier --write', 'git add'] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
version: '2' | ||
services: | ||
jhipsterregistry-sonar: | ||
image: sonarqube:8.2-community | ||
image: sonarqube:8.3.1-community | ||
ports: | ||
- 9001:9000 | ||
- 9092:9092 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/io/github/jhipster/registry/config/StaticResourcesWebConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package io.github.jhipster.registry.config; | ||
|
||
import io.github.jhipster.config.JHipsterConstants; | ||
import io.github.jhipster.config.JHipsterProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.http.CacheControl; | ||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration; | ||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
@Configuration | ||
@Profile({JHipsterConstants.SPRING_PROFILE_PRODUCTION}) | ||
public class StaticResourcesWebConfiguration implements WebMvcConfigurer { | ||
|
||
protected static final String[] RESOURCE_LOCATIONS = new String[]{"classpath:/static/app/", "classpath:/static/content/", "classpath:/static/i18n/"}; | ||
protected static final String[] RESOURCE_PATHS = new String[]{"/app/*", "/content/*", "/i18n/*"}; | ||
|
||
private final JHipsterProperties jhipsterProperties; | ||
|
||
public StaticResourcesWebConfiguration(JHipsterProperties jHipsterProperties) { | ||
this.jhipsterProperties = jHipsterProperties; | ||
} | ||
|
||
@Override | ||
public void addResourceHandlers(ResourceHandlerRegistry registry) { | ||
ResourceHandlerRegistration resourceHandlerRegistration = appendResourceHandler(registry); | ||
initializeResourceHandler(resourceHandlerRegistration); | ||
} | ||
|
||
protected ResourceHandlerRegistration appendResourceHandler(ResourceHandlerRegistry registry) { | ||
return registry.addResourceHandler(RESOURCE_PATHS); | ||
} | ||
|
||
protected void initializeResourceHandler(ResourceHandlerRegistration resourceHandlerRegistration) { | ||
resourceHandlerRegistration.addResourceLocations(RESOURCE_LOCATIONS).setCacheControl(getCacheControl()); | ||
} | ||
|
||
protected CacheControl getCacheControl() { | ||
return CacheControl.maxAge(getJHipsterHttpCacheProperty(), TimeUnit.DAYS).cachePublic(); | ||
} | ||
|
||
private int getJHipsterHttpCacheProperty() { | ||
return jhipsterProperties.getHttp().getCache().getTimeToLiveInDays(); | ||
} | ||
|
||
} |
Oops, something went wrong.