Skip to content

Commit 2da4e06

Browse files
authored
Fix API Guide (#512)
* Serve the API guide on a specific path * Remove unused images
1 parent c94f72d commit 2da4e06

File tree

8 files changed

+11
-0
lines changed

8 files changed

+11
-0
lines changed
-65.2 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
-21.5 KB
Binary file not shown.
-47.8 KB
Binary file not shown.
-12.2 KB
Binary file not shown.
-7.19 KB
Binary file not shown.

klass-api/src/main/java/no/ssb/klass/api/config/WebConfiguration.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
import no.ssb.klass.api.util.RestConstants;
44

55
import org.springframework.context.annotation.Configuration;
6+
import org.springframework.http.CacheControl;
67
import org.springframework.http.MediaType;
78
import org.springframework.web.accept.HeaderContentNegotiationStrategy;
89
import org.springframework.web.accept.PathExtensionContentNegotiationStrategy;
910
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
1011
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
12+
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
1113
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
1214

15+
import java.time.Duration;
1316
import java.util.List;
1417
import java.util.Map;
1518

@@ -26,6 +29,14 @@
2629
@Configuration
2730
public class WebConfiguration implements WebMvcConfigurer {
2831

32+
/** Explicitly configure serving the API guide at this path */
33+
@Override
34+
public void addResourceHandlers(ResourceHandlerRegistry registry) {
35+
registry.addResourceHandler(RestConstants.CONTEXT_AND_VERSION_V1 + "/api-guide.html")
36+
.addResourceLocations("classpath:/static/")
37+
.setCacheControl(CacheControl.maxAge(Duration.ofDays(7)));
38+
}
39+
2940
@Override
3041
public void configurePathMatch(PathMatchConfigurer configurer) {
3142
configurer.setUseSuffixPatternMatch(true);

0 commit comments

Comments
 (0)