Class NextDashboardRouteProvider
java.lang.Object
com.kingsrook.qqq.middleware.javalin.routeproviders.NextDashboardRouteProvider
- All Implemented Interfaces:
QJavalinRouteProviderInterface
public final class NextDashboardRouteProvider
extends Object
implements QJavalinRouteProviderInterface
Serves the QQQ Next dashboard (qqq-frontend-next static export) from the
classpath at the server root.
The export prerenders each dynamic route once, with the placeholder
directory name "_" (for example app/_/_/index.html for /app/{table}/{id}).
A request path is resolved one segment at a time, preferring an exact file or
directory and otherwise the placeholder directory; directories serve their
index.html. The same rule serves the router payload files (*.txt) that Next
fetches during client-side navigation.
Requests are only handled after no other route matched (via the shared
SpaNotFoundHandlerRegistry), so API endpoints, including their own 404
responses, and path-scoped SPAs are never shadowed.
Every response carries the NextDashboardSecurityHeaders; HTML documents also
get a Content-Security-Policy whose script-src lists the SHA-256 hash of each
inline script in that document (the export's router payload bootstrap), so
no other inline script can run (QRun-IO/qqq#695).
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionServe the dashboard packaged under the default classpath folder.NextDashboardRouteProvider(String resourceRoot) Serve a static export found under the given classpath folder. -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptJavalinConfig(io.javalin.config.JavalinConfig config) Register the root fallback that serves the export.The headers currently sent (after the instance additions and customizer).inlineScriptHashes(String html) CSP hash sources ('sha256-...') of the inline scripts in an HTML document.static booleanWhether the default Next dashboard export is on the classpath.Resolve a request path to an exported file, or null when there is none.voidsetQInstance(QInstance qInstance) For initial setup when server boots, set the qInstance - but also, e.g., for development, to do a hot-swap.Adjust the security headers (for example extra CSP sources, or allowing the dashboard to be framed).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.kingsrook.qqq.middleware.javalin.QJavalinRouteProviderInterface
acceptJavalinService, getJavalinEndpointGroup
-
Field Details
-
DEFAULT_RESOURCE_ROOT
- See Also:
-
PLACEHOLDER_SEGMENT
- See Also:
-
QUICKSIGHT_FRAME_SOURCE
///////////////////////////////////////////////////////////////////////- See Also:
-
-
Constructor Details
-
NextDashboardRouteProvider
public NextDashboardRouteProvider()Serve the dashboard packaged under the default classpath folder. -
NextDashboardRouteProvider
Serve a static export found under the given classpath folder.- Parameters:
resourceRoot- classpath folder, without leading or trailing slash
-
-
Method Details
-
withSecurityHeadersCustomizer
public NextDashboardRouteProvider withSecurityHeadersCustomizer(Consumer<NextDashboardSecurityHeaders> customizer) Adjust the security headers (for example extra CSP sources, or allowing the dashboard to be framed). The customizer receives the defaults with the instance's identity provider, QuickSight, customComponent and configured analytics origins already added, and runs again whenever the QInstance is set or hot-swapped.- Parameters:
customizer- changes the headers in place, or null for the defaults- Returns:
- this
-
getSecurityHeaders
The headers currently sent (after the instance additions and customizer). -
isAvailable
public static boolean isAvailable()Whether the default Next dashboard export is on the classpath. -
setQInstance
Description copied from interface:QJavalinRouteProviderInterfaceFor initial setup when server boots, set the qInstance - but also, e.g., for development, to do a hot-swap.- Specified by:
setQInstancein interfaceQJavalinRouteProviderInterface
-
inlineScriptHashes
CSP hash sources ('sha256-...') of the inline scripts in an HTML document. Line breaks are normalized first, as the HTML parser does before hashing.- Parameters:
html- the document- Returns:
- one source per distinct inline script, in document order
-
acceptJavalinConfig
public void acceptJavalinConfig(io.javalin.config.JavalinConfig config) Register the root fallback that serves the export.- Specified by:
acceptJavalinConfigin interfaceQJavalinRouteProviderInterface
-
resolve
-