T157 static content and table generated. Added css to table

This commit is contained in:
2021-01-28 17:28:01 +01:00
parent 1a4340b92e
commit 0c993f7886
4 changed files with 84 additions and 42 deletions

View File

@@ -123,6 +123,36 @@ public class KlausMvcController {
return "mock";
}
@GetMapping({"/mock/json", "/mock/json/{uuid}"})
@ResponseBody
public List<MockedMessageDto> getJsonList(final MockedMessageDto mockedMessageDto, final Model model,
@PathVariable(required = false) UUID uuid){
if(uuid == null) uuid = UUID.randomUUID();
List<MockedMessageDto> messages = klausService.getAllMockedResponses(uuid);
if(!(messages.size() > 0)) {
Map<String, String> headers = new HashMap<>();
headers.put("Keep-Alive", "timeout=60");
headers.put("Connection", "keep-alive");
headers.put("Date", LocalDateTime.now().toString());
MockedMessageDto msg = MockedMessageDto.builder()
.clientUUID(uuid)
.mockedResponseId(1)
.mediaType(MediaType.APPLICATION_XML_VALUE)
.messageBody("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<note>\n" +
" <to>Tove</to>\n" +
" <from>Jani</from>\n" +
" <heading>Reminder</heading>\n" +
" <body>Don't forget me this weekend!</body>\n" +
"</note>")
.httpHeaders(headers)
.httpStatus(200)
.build();
messages.add(msg);
}
return messages;
}
@SneakyThrows
@ModelAttribute("localhost")
public String localhost() {