#4 -- Enable caching
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 58s

This commit is contained in:
Anton Romanov 2025-02-28 21:56:32 +04:00
parent ec07ed36eb
commit ea87504e7b
2 changed files with 8 additions and 3 deletions

View File

@ -28,7 +28,7 @@ public class SecurityConfiguration {
log.debug("Security enabled"); log.debug("Security enabled");
http http
.headers(headers -> headers.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable)) .headers(headers -> headers.frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin))
.csrf(AbstractHttpConfigurer::disable) .csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(auth -> .authorizeHttpRequests(auth ->
auth.requestMatchers("/").permitAll() auth.requestMatchers("/").permitAll()

View File

@ -1,5 +1,6 @@
package ru.ulstu.fc.rule.controller; package ru.ulstu.fc.rule.controller;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
@ -64,14 +65,18 @@ public class FuzzyRuleController {
@ResponseBody @ResponseBody
@GetMapping("/getVariables/{projectId}") @GetMapping("/getVariables/{projectId}")
public List<Variable> getVariables(@PathVariable("projectId") Integer projectId) { public List<Variable> getVariables(@PathVariable("projectId") Integer projectId,
final HttpServletResponse response) {
response.addHeader("Cache-Control", "max-age=60, must-revalidate, no-transform");
//TODO: return DTO without terms //TODO: return DTO without terms
return variableService.getAllByProject(projectId); return variableService.getAllByProject(projectId);
} }
@ResponseBody @ResponseBody
@GetMapping("/getFuzzyTerms/{variableId}") @GetMapping("/getFuzzyTerms/{variableId}")
public List<FuzzyTerm> getTerms(@PathVariable("variableId") Integer variableId) { public List<FuzzyTerm> getTerms(@PathVariable("variableId") Integer variableId,
final HttpServletResponse response) {
response.addHeader("Cache-Control", "max-age=60, must-revalidate, no-transform");
return fuzzyTermService.getByVariableId(variableId); return fuzzyTermService.getByVariableId(variableId);
} }
} }