@@ -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