diff --git a/rest/src/main/java/org/n52/javaps/rest/ApiController.java b/rest/src/main/java/org/n52/javaps/rest/ApiController.java index 26afb233..b2ee99e3 100644 --- a/rest/src/main/java/org/n52/javaps/rest/ApiController.java +++ b/rest/src/main/java/org/n52/javaps/rest/ApiController.java @@ -16,12 +16,28 @@ */ package org.n52.javaps.rest; +import java.net.URI; + +import org.n52.faroe.Validation; +import org.n52.faroe.annotation.Configurable; +import org.n52.faroe.annotation.Setting; +import org.n52.javaps.rest.settings.RestSettingsConstants; import org.springframework.stereotype.Controller; @Controller +@Configurable public class ApiController implements Api { + + private URI apiURI; + + @Setting(RestSettingsConstants.API_URI) + public void setDescription(URI apiURI) { + Validation.notNull("apiURI", apiURI); + this.apiURI = apiURI; + } + @Override public String api() { - return "redirect:https://app.swaggerhub.com/apis/geoprocessing/WPS/1.0-draft"; + return "redirect:" + apiURI; } } diff --git a/rest/src/main/java/org/n52/javaps/rest/LandingPageApiImpl.java b/rest/src/main/java/org/n52/javaps/rest/LandingPageApiImpl.java index 6b59f34d..82a79f02 100644 --- a/rest/src/main/java/org/n52/javaps/rest/LandingPageApiImpl.java +++ b/rest/src/main/java/org/n52/javaps/rest/LandingPageApiImpl.java @@ -16,26 +16,29 @@ */ package org.n52.javaps.rest; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + import org.n52.faroe.Validation; import org.n52.faroe.annotation.Configurable; import org.n52.faroe.annotation.Setting; import org.n52.iceland.service.ServiceSettings; -import org.n52.javaps.rest.model.Link; import org.n52.javaps.rest.model.LandingPage; +import org.n52.javaps.rest.model.Link; +import org.n52.javaps.rest.settings.RestSettingsConstants; import org.springframework.stereotype.Controller; -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - /** - * Home redirection to swagger api documentation + * Landing page */ @Controller @Configurable public class LandingPageApiImpl implements LandingPageApi { private String serviceURL; + private String title; + private String description; @Setting(ServiceSettings.SERVICE_URL) public void setServiceURL(URI serviceURL) { @@ -47,12 +50,20 @@ public void setServiceURL(URI serviceURL) { this.serviceURL = url.replace("/service", BASE_URL); } - @Override - public LandingPage landingPage() { + @Setting(RestSettingsConstants.TITLE) + public void setTitle(String title) { + Validation.notNull("title", title); + this.title = title; + } - String title = "52°North draft OGC API - Processes"; + @Setting(RestSettingsConstants.DESCRIPTION) + public void setDescription(String description) { + Validation.notNull("description", description); + this.description = description; + } - String description = "52°North draft OGC API - Processes, powered by javaPS"; + @Override + public LandingPage landingPage() { List links = new ArrayList<>(); diff --git a/rest/src/main/java/org/n52/javaps/rest/settings/RestSettingsConstants.java b/rest/src/main/java/org/n52/javaps/rest/settings/RestSettingsConstants.java index bce32480..b4b97433 100644 --- a/rest/src/main/java/org/n52/javaps/rest/settings/RestSettingsConstants.java +++ b/rest/src/main/java/org/n52/javaps/rest/settings/RestSettingsConstants.java @@ -19,5 +19,8 @@ public class RestSettingsConstants { public static final String ENABLE_JOB_LIST_EXTENSION = "rest.enable.joblist.extension"; + public static final String TITLE = "rest.title"; + public static final String DESCRIPTION = "rest.description"; + public static final String API_URI = "rest.api.uri"; } diff --git a/webapp/src/main/resources/settings/settings-rest.xml b/webapp/src/main/resources/settings/settings-rest.xml index 887a6cf1..2138505d 100644 --- a/webapp/src/main/resources/settings/settings-rest.xml +++ b/webapp/src/main/resources/settings/settings-rest.xml @@ -35,4 +35,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/webapp/src/main/webapp/WEB-INF/config/configuration.json b/webapp/src/main/webapp/WEB-INF/config/configuration.json index 0dc92456..0ac843bf 100644 --- a/webapp/src/main/webapp/WEB-INF/config/configuration.json +++ b/webapp/src/main/webapp/WEB-INF/config/configuration.json @@ -161,6 +161,18 @@ "rest.enable.joblist.extension" : { "type" : "boolean", "value" : false + }, + "rest.title" : { + "type" : "string", + "value" : "52\u00B0North draft OGC API - Processes" + }, + "rest.description" : { + "type" : "string", + "value" : "52\u00B0North draft OGC API - Processes, powered by javaPS" + }, + "rest.api.uri" : { + "type" : "uri", + "value" : "https://app.swaggerhub.com/apiproxy/schema/file/apis/geoprocessing/WPS/1.0-draft.4?format=json" } } } \ No newline at end of file