PdfController.java 1.0 KB

1234567891011121314151617181920212223242526272829
  1. package pl.sudra.controller;
  2. import jakarta.servlet.http.HttpServletResponse;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.stereotype.Controller;
  5. import org.springframework.web.bind.annotation.PathVariable;
  6. import org.springframework.web.bind.annotation.RequestMapping;
  7. import org.springframework.web.bind.annotation.RequestMethod;
  8. import pl.sudra.service.AppUserService;
  9. import pl.sudra.service.PdfService;
  10. @Controller
  11. public class PdfController {
  12. private PdfService pdfService;
  13. private AppUserService appUserService;
  14. @Autowired
  15. public PdfController(PdfService pdfService, AppUserService appUserService) {
  16. this.pdfService = pdfService;
  17. this.appUserService = appUserService;
  18. }
  19. @RequestMapping(value = "/generatePdf-{appUserId}", method = RequestMethod.GET)
  20. public void generatePdf(@PathVariable Integer appUserId, HttpServletResponse response) {
  21. pdfService.generatePdf(appUserService.getAppUser(appUserId), response);
  22. }
  23. }