Обновить src/main/java/org/lanit/controllers/JSONController.java

This commit is contained in:
Шимченко 2025-09-12 06:01:49 +00:00
parent 34e6504871
commit e575a33e0e

View File

@ -1,15 +1,18 @@
package org.lanit.controllers;
import org.lanit.models.*;
import org.lanit.service.JsonProcessingService;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.io.IOException;
import java.time.Instant;
@RestController
import org.springframework.http.MediaType;
@Controller
public class JSONController {
private final JsonProcessingService processingService;
@ -20,7 +23,8 @@ public class JSONController {
this.objectMapper = objectMapper;
}
@GetMapping("/json")
@PostMapping(value = "/json", produces = "application/json", consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public ResponseEntity<?> handleJsonRequest(
@RequestParam("action") String action,
@RequestBody String jsonBody) throws IOException {