Static Content
This tutorial demonstrates serving static assets — HTML, CSS, JavaScript, images — for a single-page application alongside OfficeFloor REST endpoints.
The two halves of a modern web application sit in separate locations on the classpath:
| Location | Purpose |
|---|---|
officefloor/rest/ |
REST endpoint YAML files (the API) |
PUBLIC/ |
Static assets served directly (the SPA) |
No routing configuration is needed. OfficeFloor serves any path under PUBLIC/ as a static file, and routes everything else through the REST endpoint declarations.
/PUBLIC
Place static files anywhere on the classpath under a directory named PUBLIC. Any file found at PUBLIC/{path} is served at GET /{path}. The root path / maps to PUBLIC/index.html.
This gives flexibility in how the SPA build output is packaged:
- Copy the SPA build artefacts into
src/main/resources/PUBLIC/and they are bundled into the application jar. - Place them in a separate jar on the runtime classpath — useful when the frontend and backend are built independently.
- Mount them via any other classpath mechanism.
Testing
@RegisterExtension
public MockWoofServerExtension server = new MockWoofServerExtension();
@Test
public void indexPage() throws Exception {
MockHttpResponse response = this.server.send(MockHttpServer.mockRequest("/"));
response.assertResponse(200, "<html><body>Hello World</body></html>");
}
Next
Return to the migration guide.

