diff --git a/src/main/java/gov/usgs/earthquake/nshmp/netcdf/www/ContextPathCookie.java b/src/main/java/gov/usgs/earthquake/nshmp/netcdf/www/ContextPathCookie.java deleted file mode 100644 index d8a87892662a5cc75c6d93399cb02dc9c8e5184a..0000000000000000000000000000000000000000 --- a/src/main/java/gov/usgs/earthquake/nshmp/netcdf/www/ContextPathCookie.java +++ /dev/null @@ -1,39 +0,0 @@ -package gov.usgs.earthquake.nshmp.netcdf.www; - -import java.time.Duration; - -import org.reactivestreams.Publisher; - -import io.micronaut.context.annotation.Requires; -import io.micronaut.context.annotation.Value; -import io.micronaut.core.async.publisher.Publishers; -import io.micronaut.http.HttpMethod; -import io.micronaut.http.HttpRequest; -import io.micronaut.http.MutableHttpResponse; -import io.micronaut.http.annotation.Filter; -import io.micronaut.http.cookie.Cookie; -import io.micronaut.http.filter.HttpServerFilter; -import io.micronaut.http.filter.ServerFilterChain; - -/** - * Add context path as a cookie for Swagger to use. - * - * @author U.S. Geological Survey - */ -@Requires(property = "micronaut.server.context-path") -@Filter(methods = { HttpMethod.GET, HttpMethod.HEAD }, - patterns = { "/**" }) -public class ContextPathCookie implements HttpServerFilter { - private final Cookie contextPathCookie; - - ContextPathCookie(@Value("${micronaut.server.context-path}") String contextPath) { - this.contextPathCookie = Cookie.of("contextPath", contextPath).maxAge(Duration.ofMinutes(2L)); - } - - @Override - public Publisher<MutableHttpResponse<?>> doFilter(HttpRequest<?> request, - ServerFilterChain chain) { - return Publishers.map(chain.proceed(request), response -> response.cookie(contextPathCookie)); - } - -} diff --git a/src/main/resources/swagger/index.js b/src/main/resources/swagger/index.js index f9288b53567722b966a326280bb6cf541549057b..1f6f9fb71809e62d37c5aad527fafd1fbda7482c 100644 --- a/src/main/resources/swagger/index.js +++ b/src/main/resources/swagger/index.js @@ -1,17 +1,6 @@ window.onload = function() { - const extract = function(v) { - return decodeURIComponent( - v.replace( - /(?:(?:^|.*;\s*)contextPath\s*\=\s*([^;]*).*$)|^.*$/, - '$1' - ) - ); - }; - - const contextPath = extract(document.cookie); - const ui = SwaggerUIBundle({ - url: `${contextPath}/swagger`, + url: `./swagger`, dom_id: '#swagger-ui', tagsSorter: 'alpha', presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],