Skip to content

Commit

Permalink
Merge pull request #177 from xenit-eu/ALFREDAPI-520_mvc-branch-fix
Browse files Browse the repository at this point in the history
Alfredapi 520 mvc branch fix
  • Loading branch information
WimCrols authored Jun 22, 2023
2 parents aadf099 + 5c41c83 commit 2390801
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Alfred API - Changelog

## 4.0.1 (yyyy-mm-dd)
## 4.0.2 (yyyy-mm-dd)

### Added

### Changed


### Fixed
* [ALFREDAPI-520](https://xenitsupport.jira.com/browse/ALFREDAPI-520): Enforce encoding on bulk json responses to guarantee clean text

### Removed


## 4.0.1 (unreleased)

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import eu.xenit.apix.rest.v1.bulk.request.BulkRequest;
import eu.xenit.apix.rest.v1.bulk.request.IntermediateRequest;
import eu.xenit.apix.rest.v1.bulk.response.IntermediateResponse;
import java.nio.charset.StandardCharsets;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.ServiceRegistry;
import org.slf4j.Logger;
Expand Down Expand Up @@ -69,6 +70,12 @@ public ResponseEntity<List<BulkSubResult>> bulk(@RequestBody final BulkRequest[]
final IntermediateRequest intermediateRequest = new IntermediateRequest(wsReq, bulkHttpServletRequest);

final IntermediateResponse intermediateResponse = new IntermediateResponse();
// ALFREDAPI-520: Due to the bulk script circumventing the spring framework config
// through the alfresco-mvc dispatcher servlet, the encoding of the response can be mangled.
// Setting it here avoids this issue.
// This is not considered breaking since the original implementation did not have a mechanism for the client
// to request certain encodings.
intermediateResponse.setCharacterEncoding(StandardCharsets.UTF_8.toString());
final WebScriptServletResponse webScriptServletResponse = new WebScriptServletResponse(wsReq.getRuntime(),
intermediateResponse);

Expand Down

0 comments on commit 2390801

Please sign in to comment.