diff --git a/portal/src/main/java/org/cbioportal/WebAppConfig.java b/portal/src/main/java/org/cbioportal/WebAppConfig.java index 23ff797092e..1315c1191bb 100644 --- a/portal/src/main/java/org/cbioportal/WebAppConfig.java +++ b/portal/src/main/java/org/cbioportal/WebAppConfig.java @@ -3,10 +3,13 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +// TODO Consider creating separate DispatcherServlets as in the original web.xml +// See: https://stackoverflow.com/a/30686733/11651683 @Configuration -@EnableAspectJAutoProxy // TODO no idea what this does; is this logging aspect still usefull? +@EnableAspectJAutoProxy // TODO no idea what this does; is this logging aspect still useful? public class WebAppConfig implements WebMvcConfigurer { @Override @@ -18,10 +21,13 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) registry .addResourceHandler("/reactapp/**").addResourceLocations("classpath:/reactapp/") .setCachePeriod(3000); - // TODO remove? registry - .addResourceHandler("/webapp/**").addResourceLocations("classpath:/webapp/") + .addResourceHandler("/js/**").addResourceLocations("classpath:/js/") .setCachePeriod(3000); } + @Override + public void addViewControllers(ViewControllerRegistry registry) { + registry.addRedirectViewController("/api", "/swagger-ui.html"); + } } diff --git a/web/src/main/java/org/cbioportal/url_shortener/URLShortenerController.java b/web/src/main/java/org/cbioportal/url_shortener/URLShortenerController.java index d266cedd7ce..00804ca9769 100644 --- a/web/src/main/java/org/cbioportal/url_shortener/URLShortenerController.java +++ b/web/src/main/java/org/cbioportal/url_shortener/URLShortenerController.java @@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +// TODO Consider creating separate DispatcherServlets as in the original web.xml +// See: https://stackoverflow.com/a/30686733/11651683 @RestController public class URLShortenerController { @@ -21,7 +23,7 @@ public class URLShortenerController { private Bitly bitly ; private UrlValidator urlValidator = new UrlValidator(); - @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) + @RequestMapping(path = "/api/url-shortener", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity urlShortener(@RequestParam String url) { if (urlValidator.isValid(url)) {