Commit 9e41a3f2 authored by Matija Obreza's avatar Matija Obreza
Browse files

Tileserver CDN

parent 1ed8d5e3
...@@ -16,14 +16,15 @@ ...@@ -16,14 +16,15 @@
package org.genesys2.server.config; package org.genesys2.server.config;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Component;
/** /**
* This class provides application properties on JSP pages * This class provides application properties on JSP pages
*/ */
@Service("props") @Component("props")
public class ApplicationProps { public class ApplicationProps implements InitializingBean {
@Value("${paginator.default.pageSize}") @Value("${paginator.default.pageSize}")
private int defaulPaginatorPageSize; private int defaulPaginatorPageSize;
...@@ -37,6 +38,15 @@ public class ApplicationProps { ...@@ -37,6 +38,15 @@ public class ApplicationProps {
@Value("${default.admin.email}") @Value("${default.admin.email}")
private String defaultAdminEmail; private String defaultAdminEmail;
@Value("${tileserver.cdn}")
private String tileserverCdn;
@Value("${cdn.server}")
private String cdnServer;
@Value("${base.url}")
private String baseUrl;
public int getDefaulPaginatorPageSize() { public int getDefaulPaginatorPageSize() {
return defaulPaginatorPageSize; return defaulPaginatorPageSize;
} }
...@@ -56,4 +66,20 @@ public class ApplicationProps { ...@@ -56,4 +66,20 @@ public class ApplicationProps {
public void setDefaultAdminEmail(String defaultAdminEmail) { public void setDefaultAdminEmail(String defaultAdminEmail) {
this.defaultAdminEmail = defaultAdminEmail; this.defaultAdminEmail = defaultAdminEmail;
} }
public String getTileserverCdn() {
return tileserverCdn;
}
@Override
public void afterPropertiesSet() throws Exception {
}
public String getCdnServer() {
return this.cdnServer;
}
public String getBaseUrl() {
return baseUrl;
}
} }
...@@ -47,8 +47,10 @@ itpgrfa.easysmta.password= ...@@ -47,8 +47,10 @@ itpgrfa.easysmta.password=
google.analytics.account= google.analytics.account=
# CDN # CDN
cdn.base=/html cdn.server=https://s1.cdn.genesys-pgr.org
cdn.flags.url=${cdn.base}/flags cdn.base=${cdn.server}
cdn.flags.url=${cdn.base}/html/flags
# Content creation on startup # Content creation on startup
auto.createContent=false auto.createContent=false
...@@ -106,6 +108,11 @@ theme.defaultThemeName=dev ...@@ -106,6 +108,11 @@ theme.defaultThemeName=dev
scheduler.tokens.cleanup.hours=1 scheduler.tokens.cleanup.hours=1
# TileServer CDN
#tileserver.cdn='https://s1'
tileserver.cdn='https://s1.cdn.genesys-pgr.org','https://s2.cdn.genesys-pgr.org','https://s3.cdn.genesys-pgr.org','https://s4.cdn.genesys-pgr.org'
# TileServer Cache # TileServer Cache
cache.tileserver.max-size=1000 cache.tileserver.max-size=1000
cache.tileserver.time-to-live-seconds=300 cache.tileserver.time-to-live-seconds=300
......
...@@ -32,12 +32,11 @@ ...@@ -32,12 +32,11 @@
subdomains: ['1','2','3','4'], subdomains: ['1','2','3','4'],
opacity: 0.6 opacity: 0.6
}).addTo(map); }).addTo(map);
L.tileLayer("/explore/tile/{z}/{x}/{y}?filter=" + '${jsonFilter}', { L.tileLayer("{s}/explore/tile/{z}/{x}/{y}?filter=" + '${jsonFilter}', {
attribution: "Genesys", attribution: "Genesys",
styleId: 22677, styleId: 22677,
subdomains: ['1','2','3','4'] subdomains: [${props.tileserverCdn}]
}).addTo(map); }).addTo(map);
//.add(po.image().url("http://a.tile.openstreetmap.org/{Z}/{X}/{Y}.png"))
$("#selectArea").hide(); $("#selectArea").hide();
var filterJson=${jsonFilter}; var filterJson=${jsonFilter};
......
/**
* Copyright 2014 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.genesys2.server.test;
import static org.junit.Assert.assertTrue;
import org.genesys2.server.config.ApplicationProps;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = ApplicationPropsTest.Config.class, initializers = PropertyPlacholderInitializer.class)
public class ApplicationPropsTest {
@PropertySource({ "classpath:application.properties", "classpath:/spring/spring.properties" })
public static class Config {
@Bean
public ApplicationProps applicationProps() {
return new ApplicationProps();
}
}
@Autowired
private ApplicationProps applicationProps;
@Test
public void testCdn() {
assertTrue(applicationProps.getCdnServer() != null);
}
@Test
public void testTileserverCdn() {
assertTrue(applicationProps.getTileserverCdn() != null);
assertTrue(applicationProps.getTileserverCdn().startsWith("'"));
assertTrue(applicationProps.getTileserverCdn().endsWith("'"));
}
}
/**
* Copyright 2014 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.genesys2.server.test; package org.genesys2.server.test;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
......
#-------------------------------------------------------------------------------
# Copyright 2014 Global Crop Diversity Trust
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
#Paginator
paginator.default.pageSize=2
paginator.default.fastStep=3
paginator.default.maxPage=4
#Admin
default.admin.email=admin@example.com
build.name=${project.artifactId}-${buildNumber}
build.revision=${buildNumber}
...@@ -40,9 +40,13 @@ itpgrfa.easysmta.password= ...@@ -40,9 +40,13 @@ itpgrfa.easysmta.password=
google.analytics.account= google.analytics.account=
# CDN # CDN
cdn.base=http://cdn.sandbox.genesys-pgr.org cdn.server=https://s1.cdn.genesys-pgr.org
cdn.base=${cdn.server}/html
cdn.flags.url=${cdn.base}/flags cdn.flags.url=${cdn.base}/flags
# TileServer CDN
tileserver.cdn=''
# Content creation on startup # Content creation on startup
auto.createContent=false auto.createContent=false
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment