Skip to content

Commit

Permalink
#12 move the index page inside the WEB-INF directory
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer committed Aug 14, 2015
1 parent 4e8c666 commit d537eb5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
16 changes: 16 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,22 @@
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
<systemProperties>
<spring.profiles.active>${spring.profiles.active}</spring.profiles.active>
<datasource.dialect>${datasource.dialect}</datasource.dialect>
<datasource.driver>${datasource.driver}</datasource.driver>
<datasource.url>${datasource.url}</datasource.url>
<datasource.username>${datasource.username}</datasource.username>
<datasource.password>${datasource.password}</datasource.password>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/io/lavagna/config/DataSourceConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public DataSource getDataSource(Environment env) throws URISyntaxException {
dataSource.setDriverClassName(env.getRequiredProperty("datasource.driver"));

if (env.containsProperty("datasource.url") && //
env.containsProperty("datasource.username") && //
env.containsProperty("datasource.password")) {
env.containsProperty("datasource.username")) {
urlAndCredentials(dataSource, env);
} else {
urlWithCredentials(dataSource, env);
Expand Down Expand Up @@ -96,7 +95,7 @@ private static String scheme(URI uri) {
private static void urlAndCredentials(org.apache.tomcat.jdbc.pool.DataSource dataSource, Environment env) {
dataSource.setUrl(env.getRequiredProperty("datasource.url"));
dataSource.setUsername(env.getRequiredProperty("datasource.username"));
dataSource.setPassword(env.getRequiredProperty("datasource.password"));
dataSource.setPassword(env.getProperty("datasource.password") != null ? env.getProperty("datasource.password") : "");
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public void handleIndex(HttpServletRequest request, HttpServletResponse response
if (contains(env.getActiveProfiles(), "dev") || indexCache.get() == null) {

ByteArrayOutputStream index = new ByteArrayOutputStream();
output("/index.html", context, index, new BeforeAfter());
output("/WEB-INF/views/index.html", context, index, new BeforeAfter());

Map<String, Object> data = new HashMap<>();
data.put("contextPath", request.getServletContext().getContextPath() + "/");
Expand Down
File renamed without changes.

0 comments on commit d537eb5

Please sign in to comment.