RED-7962 Changed response type to "text/plain; charset=utf-8"
- Fixup of previous commit - Use "text/plain; charset=utf-8" instead of "application/octet-stream" as response type for rule files as they are actually text files.
This commit is contained in:
parent
93ff601b44
commit
4c4e1ced91
@ -198,14 +198,14 @@ public class DossierTemplateControllerV2 implements DossierTemplateResource {
|
||||
}
|
||||
|
||||
|
||||
private ResponseEntity<InputStreamResource> downloadRules(String dossierTemplateId, RuleFileType ruleFileType) {
|
||||
private ResponseEntity<?> downloadRules(String dossierTemplateId, RuleFileType ruleFileType) {
|
||||
|
||||
var ruleEntity = rulesPersistenceService.getRules(dossierTemplateId, ruleFileType);
|
||||
|
||||
var data = ruleEntity.getValue().getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
httpHeaders.setContentType(MediaType.APPLICATION_OCTET_STREAM);
|
||||
httpHeaders.setContentType(MediaType.TEXT_PLAIN);
|
||||
|
||||
httpHeaders.add("Content-Disposition", "attachment" + "; filename*=utf-8''" + StringEncodingUtils.urlEncode(ruleFileType.name().toLowerCase() + RULES_DOWNLOAD_FILE_NAME_SUFFIX));
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import com.iqser.red.service.persistence.service.v2.api.external.model.RulesVali
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
@ -76,10 +77,10 @@ public interface DossierTemplateResource {
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@Operation(summary = "Returns file containing the currently used entity rules.")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.")
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = MediaType.TEXT_PLAIN_VALUE + "; charset=utf-8")),
|
||||
@ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE))
|
||||
})
|
||||
@GetMapping(value = PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE + ENTITY_RULES_PATH, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
@GetMapping(value = PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE + ENTITY_RULES_PATH)
|
||||
ResponseEntity<?> downloadEntityRules(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId);
|
||||
|
||||
|
||||
@ -100,10 +101,10 @@ public interface DossierTemplateResource {
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
@Operation(summary = "Returns file containing the currently used component rules.")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.")
|
||||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = MediaType.TEXT_PLAIN_VALUE + "; charset=utf-8")),
|
||||
@ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE))
|
||||
})
|
||||
@GetMapping(value = PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE + COMPONENT_RULES_PATH, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
@GetMapping(value = PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE + COMPONENT_RULES_PATH)
|
||||
ResponseEntity<?> downloadComponentRules(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId);
|
||||
|
||||
@Operation(summary = "Get the file attribute definitions of a DossierTemplate.", description = "None")
|
||||
|
||||
@ -129,10 +129,9 @@ paths:
|
||||
type: string
|
||||
example: attachment; filename*=utf-8''entity-rules.drl
|
||||
content:
|
||||
application/octet-stream:
|
||||
text/plain; charset=utf-8:
|
||||
schema:
|
||||
type: string
|
||||
format: binary
|
||||
description: |
|
||||
Successfully downloaded the requested rules file.
|
||||
"400":
|
||||
@ -211,10 +210,9 @@ paths:
|
||||
type: string
|
||||
example: attachment; filename*=utf-8''component-rules.drl
|
||||
content:
|
||||
application/octet-stream:
|
||||
text/plain; charset=utf-8:
|
||||
schema:
|
||||
type: string
|
||||
format: binary
|
||||
description: |
|
||||
Successfully downloaded the requested rules file.
|
||||
"400":
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user