This commit is contained in:
Anthony Stirling 2024-01-04 23:04:15 +00:00
parent 770b61bb7a
commit 6c963e1b6c
2 changed files with 13 additions and 13 deletions

View file

@ -1,26 +1,27 @@
package stirling.software.SPDF.controller.web;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.oas.annotations.Hidden;
import stirling.software.SPDF.model.ApplicationProperties;
import stirling.software.SPDF.model.Dependency;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;
import java.util.Map;
@Controller
public class HomeWebController {
@ -30,7 +31,7 @@ public class HomeWebController {
model.addAttribute("currentPage", "about");
return "about";
}
@GetMapping("/licenses")
@Hidden
public String licensesForm(Model model) {
@ -39,14 +40,14 @@ public class HomeWebController {
try {
String json = new String(Files.readAllBytes(resource.getFile().toPath()));
ObjectMapper mapper = new ObjectMapper();
Map<String, List<Dependency>> data = mapper.readValue(json, new TypeReference<Map<String, List<Dependency>>>() {});
Map<String, List<Dependency>> data =
mapper.readValue(json, new TypeReference<Map<String, List<Dependency>>>() {});
model.addAttribute("dependencies", data.get("dependencies"));
} catch (IOException e) {
e.printStackTrace();
}
return "licenses";
}
@GetMapping("/")
public String home(Model model) {

View file

@ -9,5 +9,4 @@ public class Dependency {
private String moduleVersion;
private String moduleLicense;
private String moduleLicenseUrl;
}