Skip to content

Commit bc660c8

Browse files
committed
Get the root URL of the request instead of from the config
1 parent fa9ef6e commit bc660c8

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/DeepLinkModule/javasource/deeplink/implementation/handler/DeeplinkHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ else if(DeeplinkHandler.SSOHandler != null) {
100100
ResponseHandler.serve404(response);
101101
}
102102
else {
103-
ResponseHandler.serveIndex(response, deepLinkConfigurationObject.getIndexPage());
103+
ResponseHandler.serveIndex(request, response, deepLinkConfigurationObject.getIndexPage());
104104
}
105105
}
106106
}

src/DeepLinkModule/javasource/deeplink/implementation/handler/ResponseHandler.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static void serve404(IMxRuntimeResponse response) throws IOException {
2525
response.setStatus(IMxRuntimeResponse.NOT_FOUND);
2626
}
2727

28-
public static void serveIndex(IMxRuntimeResponse response, String indexpage) {
28+
public static void serveIndex(IMxRuntimeRequest request, IMxRuntimeResponse response, String indexpage) {
2929
response.setStatus(IMxRuntimeResponse.SEE_OTHER);
3030

3131
String location = null;
@@ -38,7 +38,7 @@ public static void serveIndex(IMxRuntimeResponse response, String indexpage) {
3838
location = INDEXPAGE;
3939
}
4040

41-
location = getRootUrl() + ensureStartingSlash(location);
41+
location = getRootUrl(request) + ensureStartingSlash(location);
4242

4343
if (LOG.isTraceEnabled()) {
4444
LOG.trace("Redirecting to index location: " + location);
@@ -78,7 +78,7 @@ public static void serveSSOHandler(IMxRuntimeRequest request, IMxRuntimeResponse
7878
java.nio.charset.StandardCharsets.UTF_8.toString());
7979
}
8080

81-
redirectLocation = getRootUrl() + ensureStartingSlash(redirectLocation);
81+
redirectLocation = getRootUrl(request) + ensureStartingSlash(redirectLocation);
8282

8383
response.setStatus(IMxRuntimeResponse.SEE_OTHER);
8484
response.addHeader("location", redirectLocation);
@@ -135,11 +135,11 @@ public static void serveLogin(IMxRuntimeRequest request, IMxRuntimeResponse resp
135135

136136
if (continuationURL != null && continuationURL.length() > 0) {
137137
loginLocation += URLEncoder.encode(continuationURL, java.nio.charset.StandardCharsets.UTF_8.toString());
138-
}
138+
}
139139
}
140140

141141
if (!loginLocation.startsWith("http")) {
142-
loginLocation = getRootUrl() + ensureStartingSlash(loginLocation);
142+
loginLocation = getRootUrl(request) + ensureStartingSlash(loginLocation);
143143
}
144144

145145
response.setStatus(IMxRuntimeResponse.SEE_OTHER);
@@ -168,10 +168,10 @@ private static String ensureNoStartingSlash(String s) {
168168
return s;
169169
}
170170

171-
private static String getRootUrl()
171+
private static String getRootUrl(IMxRuntimeRequest request)
172172
{
173-
String url = Core.getConfiguration().getApplicationRootUrl();
174-
String path = ensureStartingSlash(URI.create(url).getPath());
173+
String url = request.getRootUrl();
174+
String path = ensureStartingSlash(java.net.URI.create(url).getPath());
175175
if(path.endsWith("/"))
176176
return path.substring(0, path.length() - 1);
177177
return path;

0 commit comments

Comments
 (0)