Added path mappings of endpoints.
package eu.fasten.analyzer.restapiplugin.mvn.api;
+import eu.fasten.analyzer.restapiplugin.mvn.RestApplication;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("/mvn/vulnerabilities")
public class VulnerabilityApi {
+ private final VulnerabilityApiService service;
+
+ public VulnerabilityApi(VulnerabilityApiService service){
+ this.service = service;
+ }
+
+ @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
+ ResponseEntity<String> getAllVulnerabilities(@RequestParam(required = false, defaultValue = "0") int offset,
+ @RequestParam(required = false, defaultValue = RestApplication.DEFAULT_PAGE_SIZE) int limit) {
+ return service.getAllVulnerabilities(offset, limit);
+ }
+
+ @GetMapping(value = "/{external_id}", produces = MediaType.APPLICATION_JSON_VALUE)
+ ResponseEntity<String > getVulnerabilities(@PathVariable("external_id") String externalId) {
+ return service.getVulnerabilities(externalId);
+ }
+
+ @GetMapping(value = "/{external_id}/purls", produces = MediaType.APPLICATION_JSON_VALUE)
+ ResponseEntity<String> getPurls(@RequestParam(required = false, defaultValue = "0") int offset,
+ @RequestParam(required = false, defaultValue = RestApplication.DEFAULT_PAGE_SIZE) int limit,
+ @PathVariable("external_id") String externalId) {
+ return service.getPurls(externalId, offset, limit);
+ }
+
+ @GetMapping(value = "/{external_id}/callables", produces = MediaType.APPLICATION_JSON_VALUE)
+ ResponseEntity<String> getVulnerableCallables(@RequestParam(required = false, defaultValue = "0") int offset,
+ @RequestParam(required = false, defaultValue = RestApplication.DEFAULT_PAGE_SIZE) int limit,
+ @PathVariable("external_id") String externalId) {
+ return service.getVulnerableCallables(externalId, offset, limit);
+ }
}
