Class StaticSiteService
- java.lang.Object
-
- com.linecorp.armeria.server.composition.AbstractCompositeService<com.linecorp.armeria.common.HttpRequest,com.linecorp.armeria.common.HttpResponse>
-
- org.curioswitch.common.server.framework.staticsite.StaticSiteService
-
- All Implemented Interfaces:
com.linecorp.armeria.server.Service<com.linecorp.armeria.common.HttpRequest,com.linecorp.armeria.common.HttpResponse>
public class StaticSiteService extends com.linecorp.armeria.server.composition.AbstractCompositeService<com.linecorp.armeria.common.HttpRequest,com.linecorp.armeria.common.HttpResponse>
AService
which serves a singlepage static site (SPA). All requests to the static path (e.g., "/static/") will be resolved to a file in the classpath, "sw.js", used to register service workers, will also be resolved to itself in the classpath, and all other requests will resolve to "index.html" in the classpath for handling by the SPA.The static site will automatically serve precompressed files if they are found, using the conventions specified in
HttpFileServiceBuilder.serveCompressedFiles
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StaticSiteService
of(java.lang.String staticPath, java.lang.String classpathRoot)
Creates a newStaticSiteService
.-
Methods inherited from class com.linecorp.armeria.server.composition.AbstractCompositeService
findService, serve, serviceAdded, serviceAt, services
-
-
-
-
Method Detail
-
of
public static StaticSiteService of(java.lang.String staticPath, java.lang.String classpathRoot)
Creates a newStaticSiteService
.- Parameters:
staticPath
- the URL path from which static resources will be served, e.g., "/static".classpathRoot
- the root directory in the classpath to serve resources from.
-
-