Spring Boot Webapp: no compression

Does not work on annotated methods other than @ResponseBody. Am I misunderstanding something? What could be the main reason?

Compression applied to the @ResponseBody method:

@RequestMapping(value = "/property/{id}/pano.xml", method = RequestMethod.GET, produces = MediaType.APPLICATION_XML_VALUE)
@ResponseBody
public String getPanoXml(@PathVariable("id") Property property) {
    return assetsProvider.loadUnderlyingObject(property.getPanoXml()).getObject();
}

gzipped

Compression does not apply to the non @ResponseBody method:

@RequestMapping(value = "/property/{id}", method = RequestMethod.GET)
public String get(Model model, @PathVariable Long id, Locale locale) throws NoSuchRequestHandlingMethodException {
    LocalizedProperty lp = repository.findProperty(id, locale.getLanguage());
    // TODO: replace with custom exception
    if (lp == null)
        throw new NoSuchRequestHandlingMethodException("get", PropertiesController.class);
    model.addAttribute(lp);

    return "property/show";
}

not gzipped

Lib and Config versions:

Spring Boot Version: 1.2.4.RELEASE
View Renderer: Thymeleaf

App config:

server:
  tomcat:
    compression: "1024"
    compressableMimeTypes: "application/json,application/xml,text/html,text/xml,text/plain"
+4
source share
1 answer

As Roman answered (in the comments to the question), corporate anti-virus software changed incoming traffic so that all answers were unpacked.

0
source

Source: https://habr.com/ru/post/1599084/


All Articles