diff --git a/src/main/java/de/rwth/idsg/steve/web/controller/AboutSettingsController.java b/src/main/java/de/rwth/idsg/steve/web/controller/AboutSettingsController.java index 5c9214e6b..9d31b84b8 100644 --- a/src/main/java/de/rwth/idsg/steve/web/controller/AboutSettingsController.java +++ b/src/main/java/de/rwth/idsg/steve/web/controller/AboutSettingsController.java @@ -23,7 +23,7 @@ import de.rwth.idsg.steve.repository.SettingsRepository; import de.rwth.idsg.steve.service.MailService; import de.rwth.idsg.steve.service.ReleaseCheckService; -import de.rwth.idsg.steve.web.dto.EndpointInfo; +import de.rwth.idsg.steve.web.dto.WebEndpointInfo; import de.rwth.idsg.steve.web.dto.SettingsForm; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; @@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import static de.rwth.idsg.steve.SteveConfiguration.CONFIG; @@ -66,14 +67,18 @@ public class AboutSettingsController { // ------------------------------------------------------------------------- @RequestMapping(value = ABOUT_PATH, method = RequestMethod.GET) - public String getAbout(Model model) { + public String getAbout(HttpServletRequest request, Model model) { + WebEndpointInfo info = new WebEndpointInfo(); + info.getOcppSoap().setUrlPrefix("http", request.getServerName()); + info.getOcppWebSocket().setUrlPrefix("ws", request.getServerName()); + model.addAttribute("version", CONFIG.getSteveVersion()); model.addAttribute("db", genericRepository.getDBVersion()); model.addAttribute("logFile", logController.getLogFilePath()); model.addAttribute("systemTime", DateTime.now()); model.addAttribute("systemTimeZone", DateTimeZone.getDefault()); model.addAttribute("releaseReport", releaseCheckService.check()); - model.addAttribute("endpointInfo", EndpointInfo.INSTANCE); + model.addAttribute("endpointInfo", info); return "about"; } diff --git a/src/main/java/de/rwth/idsg/steve/web/dto/WebEndpointInfo.java b/src/main/java/de/rwth/idsg/steve/web/dto/WebEndpointInfo.java new file mode 100644 index 000000000..7ffcbf58d --- /dev/null +++ b/src/main/java/de/rwth/idsg/steve/web/dto/WebEndpointInfo.java @@ -0,0 +1,47 @@ +/* + * SteVe - SteckdosenVerwaltung - https://github.com/RWTH-i5-IDSG/steve + * Copyright (C) 2013-2022 RWTH Aachen University - Information Systems - Intelligent Distributed Systems Group (IDSG). + * All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package de.rwth.idsg.steve.web.dto; + +import lombok.Getter; + +/** + * @author Michael Heimpold + */ +@Getter +public final class WebEndpointInfo { + private final ItemsWithInfo ocppSoap = new ItemsWithInfo("SOAP endpoint for OCPP", "/services/CentralSystemService"); + private final ItemsWithInfo ocppWebSocket = new ItemsWithInfo("WebSocket/JSON endpoint for OCPP", "/websocket/CentralSystemService/(chargeBoxId)"); + + @Getter + public static class ItemsWithInfo { + private final String info; + private final String path; + private String url; + + private ItemsWithInfo(String info, String path) { + this.info = info; + this.path = path; + this.url = ""; + } + + public synchronized void setUrlPrefix(String scheme, String serverName) { + this.url = scheme + "://" + serverName + path; + } + } +} diff --git a/src/main/resources/webapp/WEB-INF/views/about.jsp b/src/main/resources/webapp/WEB-INF/views/about.jsp index 7f4e3ede4..7bbf7c556 100644 --- a/src/main/resources/webapp/WEB-INF/views/about.jsp +++ b/src/main/resources/webapp/WEB-INF/views/about.jsp @@ -40,10 +40,10 @@ - + - +
${endpointInfo.ocppSoap.info}:${i}
${endpointInfo.ocppSoap.url}
${endpointInfo.ocppWebSocket.info}:${i}
${endpointInfo.ocppWebSocket.url}