LambdaController.java 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.example.lambda.service.web;
  2. import com.example.lambda.service.web.entity.*;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.beans.factory.annotation.Value;
  5. import org.springframework.web.bind.annotation.GetMapping;
  6. import org.springframework.web.bind.annotation.PostMapping;
  7. import org.springframework.web.bind.annotation.RequestBody;
  8. import org.springframework.web.bind.annotation.RestController;
  9. @RestController
  10. public class LambdaController {
  11. @Value("${server.port}")
  12. private Integer port;
  13. @Autowired
  14. private LambdaService lambdaService;
  15. @GetMapping("/")
  16. public String check() {
  17. String status = lambdaService.interpreterStatus();
  18. return "Lambda Service listen at " + port + ", with " + status;
  19. }
  20. @GetMapping("/info")
  21. public ServiceInfo info() {
  22. return lambdaService.info();
  23. }
  24. @PostMapping("/pattern")
  25. public ServiceResponse pattern(@RequestBody PatternParam param) {
  26. System.out.println("pattern: " + param.getData().toString());
  27. ServiceResponse response = lambdaService.pattern(param);
  28. return response;
  29. }
  30. @PostMapping("/render")
  31. public ServiceResponse render(@RequestBody RenderParam param) {
  32. System.out.println("render: " + param.getData().toString());
  33. ServiceResponse response = lambdaService.render(param);
  34. return response;
  35. }
  36. }