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

Tileserver CDN

parent 1ed8d5e3
......@@ -16,14 +16,15 @@
package org.genesys2.server.config;
import org.springframework.beans.factory.InitializingBean;
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
*/
@Service("props")
public class ApplicationProps {
@Component("props")
public class ApplicationProps implements InitializingBean {
@Value("${paginator.default.pageSize}")
private int defaulPaginatorPageSize;
......@@ -37,6 +38,15 @@ public class ApplicationProps {
@Value("${default.admin.email}")
private String defaultAdminEmail;
@Value("${tileserver.cdn}")
private String tileserverCdn;
@Value("${cdn.server}")
private String cdnServer;
@Value("${base.url}")
private String baseUrl;
public int getDefaulPaginatorPageSize() {
return defaulPaginatorPageSize;
}
......@@ -56,4 +66,20 @@ public class ApplicationProps {
public void setDefaultAdminEmail(String 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=
google.analytics.account=
# CDN
cdn.base=/html
cdn.flags.url=${cdn.base}/flags
cdn.server=https://s1.cdn.genesys-pgr.org
cdn.base=${cdn.server}
cdn.flags.url=${cdn.base}/html/flags
# Content creation on startup
auto.createContent=false
......@@ -106,6 +108,11 @@ theme.defaultThemeName=dev
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
cache.tileserver.max-size=1000
cache.tileserver.time-to-live-seconds=300
......
......@@ -32,12 +32,11 @@
subdomains: ['1','2','3','4'],
opacity: 0.6
}).addTo(map);
L.tileLayer("/explore/tile/{z}/{x}/{y}?filter=" + '${jsonFilter}', {
L.tileLayer("{s}/explore/tile/{z}/{x}/{y}?filter=" + '${jsonFilter}', {
attribution: "Genesys",
styleId: 22677,
subdomains: ['1','2','3','4']
subdomains: [${props.tileserverCdn}]
}).addTo(map);
//.add(po.image().url("http://a.tile.openstreetmap.org/{Z}/{X}/{Y}.png"))
$("#selectArea").hide();
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;
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=
google.analytics.account=
# 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
# TileServer CDN
tileserver.cdn=''
# Content creation on startup
auto.createContent=false
......
Markdown is supported
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