forked from Qortal/qortal
Updated node management UI (was previously "bundled ui")
Fix root path redirects for node management UI and API documentation servlets.
This commit is contained in:
parent
f4022dd243
commit
a4f2cf50b0
@ -86,7 +86,8 @@ public class ApiService {
|
|||||||
swaggerUIServlet.setInitParameter("pathInfoOnly", "true");
|
swaggerUIServlet.setInitParameter("pathInfoOnly", "true");
|
||||||
context.addServlet(swaggerUIServlet, "/api-documentation/*");
|
context.addServlet(swaggerUIServlet, "/api-documentation/*");
|
||||||
|
|
||||||
rewriteHandler.addRule(new RedirectPatternRule("/api-documentation", "/api-documentation/index.html")); // redirect to swagger ui start page
|
rewriteHandler.addRule(new RedirectPatternRule("", "/api-documentation/")); // redirect to Swagger UI start page
|
||||||
|
rewriteHandler.addRule(new RedirectPatternRule("/api-documentation", "/api-documentation/")); // redirect to Swagger UI start page
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: replace singleton pattern by dependency injection?
|
// XXX: replace singleton pattern by dependency injection?
|
||||||
|
@ -224,12 +224,12 @@ public class Controller extends Thread {
|
|||||||
LOGGER.info("Starting auto-update");
|
LOGGER.info("Starting auto-update");
|
||||||
AutoUpdate.getInstance().start();
|
AutoUpdate.getInstance().start();
|
||||||
|
|
||||||
LOGGER.info("Starting bundled UI on port " + Settings.getInstance().getUiPort());
|
LOGGER.info("Starting node management UI on port " + Settings.getInstance().getUiPort());
|
||||||
try {
|
try {
|
||||||
UiService uiService = UiService.getInstance();
|
UiService uiService = UiService.getInstance();
|
||||||
uiService.start();
|
uiService.start();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Unable to start bundled UI", e);
|
LOGGER.error("Unable to start node management UI", e);
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ public class Controller extends Thread {
|
|||||||
if (!isStopping) {
|
if (!isStopping) {
|
||||||
isStopping = true;
|
isStopping = true;
|
||||||
|
|
||||||
LOGGER.info("Shutting down bundled UI");
|
LOGGER.info("Shutting down node management UI");
|
||||||
UiService.getInstance().stop();
|
UiService.getInstance().stop();
|
||||||
|
|
||||||
LOGGER.info("Shutting down auto-update");
|
LOGGER.info("Shutting down auto-update");
|
||||||
|
@ -36,7 +36,7 @@ public class Settings {
|
|||||||
// Settings, and other config files
|
// Settings, and other config files
|
||||||
private String userPath;
|
private String userPath;
|
||||||
|
|
||||||
// Bundled UI related
|
// Node management UI
|
||||||
private boolean uiEnabled = true;
|
private boolean uiEnabled = true;
|
||||||
private int uiPort = 9080;
|
private int uiPort = 9080;
|
||||||
private String[] uiWhitelist = new String[] {
|
private String[] uiWhitelist = new String[] {
|
||||||
|
@ -16,7 +16,7 @@ public class UiService {
|
|||||||
private final Server server;
|
private final Server server;
|
||||||
|
|
||||||
public UiService() {
|
public UiService() {
|
||||||
// Create bundled UI server
|
// Create node management UI server
|
||||||
this.server = new Server(Settings.getInstance().getUiPort());
|
this.server = new Server(Settings.getInstance().getUiPort());
|
||||||
|
|
||||||
// IP address based access control
|
// IP address based access control
|
||||||
@ -42,15 +42,15 @@ public class UiService {
|
|||||||
corsFilterHolder.setInitParameter(CrossOriginFilter.CHAIN_PREFLIGHT_PARAM, "false");
|
corsFilterHolder.setInitParameter(CrossOriginFilter.CHAIN_PREFLIGHT_PARAM, "false");
|
||||||
context.addFilter(corsFilterHolder, "/*", null);
|
context.addFilter(corsFilterHolder, "/*", null);
|
||||||
|
|
||||||
// Bundled-UI static content servlet
|
// Node management UI static content servlet
|
||||||
ServletHolder uiServlet = new ServletHolder("bundled-ui", DefaultServlet.class);
|
ServletHolder uiServlet = new ServletHolder("node-management-ui", DefaultServlet.class);
|
||||||
ClassLoader loader = this.getClass().getClassLoader();
|
ClassLoader loader = this.getClass().getClassLoader();
|
||||||
uiServlet.setInitParameter("resourceBase", loader.getResource("bundled-ui/").toString());
|
uiServlet.setInitParameter("resourceBase", loader.getResource("node-management-ui/").toString());
|
||||||
uiServlet.setInitParameter("dirAllowed", "true");
|
uiServlet.setInitParameter("dirAllowed", "true");
|
||||||
uiServlet.setInitParameter("pathInfoOnly", "true");
|
uiServlet.setInitParameter("pathInfoOnly", "true");
|
||||||
context.addServlet(uiServlet, "/*");
|
context.addServlet(uiServlet, "/*");
|
||||||
|
|
||||||
rewriteHandler.addRule(new RedirectPatternRule("", "/home.html")); // redirect to bundled UI start page
|
rewriteHandler.addRule(new RedirectPatternRule("", "/peer.html")); // node management UI start page
|
||||||
}
|
}
|
||||||
|
|
||||||
private static UiService instance;
|
private static UiService instance;
|
||||||
@ -69,7 +69,7 @@ public class UiService {
|
|||||||
server.start();
|
server.start();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Failed to start
|
// Failed to start
|
||||||
throw new RuntimeException("Failed to start bundled UI", e);
|
throw new RuntimeException("Failed to start node management UI", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user