Skip to content

Commit 411b8b8

Browse files
committed
bugfix: add context path to EndpointInfo (#1846)
1 parent 8a7baac commit 411b8b8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/main/java/de/rwth/idsg/steve/web/controller/AboutSettingsController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,15 @@ public class AboutSettingsController {
7272
@RequestMapping(value = ABOUT_PATH, method = RequestMethod.GET)
7373
public String getAbout(Model model, @RequestHeader(HttpHeaders.HOST) String host, HttpServletRequest request) {
7474
String scheme = request.getScheme();
75+
String contextPath = request.getContextPath();
7576

7677
model.addAttribute("version", steveProperties.getVersion());
7778
model.addAttribute("db", genericRepository.getDBVersion());
7879
model.addAttribute("logFile", logController.getLogFilePath());
7980
model.addAttribute("systemTime", DateTime.now());
8081
model.addAttribute("systemTimeZone", DateTimeZone.getDefault());
8182
model.addAttribute("releaseReport", releaseCheckService.check());
82-
model.addAttribute("endpointInfo", EndpointInfo.fromRequest(scheme, host));
83+
model.addAttribute("endpointInfo", EndpointInfo.fromRequest(scheme, host, contextPath));
8384
return "about";
8485
}
8586

src/main/java/de/rwth/idsg/steve/web/dto/EndpointInfo.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ public class EndpointInfo {
3535
private final String ocppSoap;
3636
private final String ocppWebSocket;
3737

38-
public static EndpointInfo fromRequest(String httpScheme, String host) {
38+
public static EndpointInfo fromRequest(String httpScheme, String host, String contextPath) {
3939
String webSocketScheme = httpScheme.equals("https") ? "wss" : "ws";
4040

4141
return EndpointInfo.builder()
42-
.ocppSoap(httpScheme + "://" + host + "/services/CentralSystemService")
43-
.ocppWebSocket(webSocketScheme + "://" + host + "/websocket/CentralSystemService/(chargeBoxId)")
42+
.ocppSoap(httpScheme + "://" + host + contextPath + "/services/CentralSystemService")
43+
.ocppWebSocket(webSocketScheme + "://" + host + contextPath + "/websocket/CentralSystemService/(chargeBoxId)")
4444
.build();
4545
}
4646
}

0 commit comments

Comments
 (0)