class AppLogController {

    @RequestMapping(value = "/logs/{fileName:.+}", method = {RequestMethod.GET, RequestMethod.POST})
    public ResponseEntity<String> getLogFileContent(@PathVariable("fileName") final String fileName,
            @RequestParam(value = "source", defaultValue = "false") final boolean source,
            @RequestHeader(value = "User-Agent", defaultValue = "") final String userAgent) {
        String body = logFileProvider.getLogContent(fileName);
        body = convertLineBreaksIfOnWindows(body, userAgent);
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.TEXT_PLAIN);
        if (!source) {
            headers.set(CONTENT_DISPOSITION, String.format(ATTACHMENT_TEMPLATE, fileName));
        }
        ResponseEntity<String> responseEntity = new ResponseEntity<String>(body, headers, HttpStatus.OK);
        return responseEntity;
    }

}