Skip to content

Commit

Permalink
Fix path to ProxyController and URLShortenerController
Browse files Browse the repository at this point in the history
  • Loading branch information
pvannierop committed Dec 15, 2021
1 parent 4667275 commit 2315278
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 9 additions & 3 deletions portal/src/main/java/org/cbioportal/WebAppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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<URLShortenerResponse> urlShortener(@RequestParam String url) {

if (urlValidator.isValid(url)) {
Expand Down

0 comments on commit 2315278

Please sign in to comment.