Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lfoppiano committed Jan 10, 2025
1 parent d996f9d commit 3228dd4
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Response.Status;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
Expand Down Expand Up @@ -432,12 +432,10 @@ public Response processStatelessFulltextAssetDocument(final InputStream inputStr
response = Response.status(Status.NO_CONTENT).build();
} else {

response = Response.status(Status.OK).type("application/zip").build();

ByteArrayOutputStream ouputStream = new ByteArrayOutputStream();
ZipOutputStream out = new ZipOutputStream(ouputStream);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ZipOutputStream out = new ZipOutputStream(outputStream);
out.putNextEntry(new ZipEntry("tei.xml"));
out.write(retVal.getBytes(Charset.forName("UTF-8")));
out.write(retVal.getBytes(StandardCharsets.UTF_8));
// put now the assets, i.e. all the files under the asset path
File assetPathDir = new File(assetPath);
if (assetPathDir.exists()) {
Expand Down Expand Up @@ -469,7 +467,7 @@ public Response processStatelessFulltextAssetDocument(final InputStream inputStr
response = Response
.ok()
.type("application/zip")
.entity(ouputStream.toByteArray())
.entity(outputStream.toByteArray())
.header("Content-Disposition", "attachment; filename=\"result.zip\"")
.build();
out.close();
Expand Down

0 comments on commit 3228dd4

Please sign in to comment.