RED-7962 Changed response type to "text/plain; charset=utf-8" #236
@ -141,11 +141,11 @@ public class RulesController implements RulesResource {
|
||||
public ResponseEntity<?> downloadFile(@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId,
|
||||
@PathVariable(RULE_FILE_TYPE_PARAMETER_NAME) RuleFileType ruleFileType) {
|
||||
|
||||
byte[] data = download(dossierTemplateId).getRules().getBytes(StandardCharsets.UTF_8);
|
||||
byte[] data = download(dossierTemplateId, ruleFileType).getRules().getBytes(StandardCharsets.UTF_8);
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
httpHeaders.setContentType(MediaType.TEXT_PLAIN);
|
||||
|
||||
httpHeaders.add("Content-Disposition", "attachment; filename*=utf-8\"" + ruleFileType.name() + "_" + DOWNLOAD_FILE_NAME + "\"");
|
||||
httpHeaders.add("Content-Disposition", "attachment; filename*=utf-8''" + ruleFileType.name() + "_" + DOWNLOAD_FILE_NAME);
|
||||
InputStream is = new ByteArrayInputStream(data);
|
||||
|
||||
return new ResponseEntity<>(new InputStreamResource(is), httpHeaders, HttpStatus.OK);
|
||||
|
||||
@ -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;
|
||||
@ -79,7 +80,7 @@ public interface DossierTemplateResource {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.")
|
||||
})
|
||||
@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);
|
||||
|
||||
|
||||
@ -103,7 +104,7 @@ public interface DossierTemplateResource {
|
||||
@ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.")
|
||||
})
|
||||
@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