Skip to content

Commit

Permalink
Improve Turtle+Excel output
Browse files Browse the repository at this point in the history
  • Loading branch information
tfrancart committed Jan 23, 2025
1 parent be7fa73 commit 1c25759
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ private void serialize(
// Zip name file
String filename = sourceName+"-"+"shacl"+"_"+dateString;

// Create Zip File
response.setContentType("application/zip");
response.setHeader("Content-Disposition", "inline; filename=\""+filename+"."+"zip"+"\"");

// Create Zip OutputStream
ZipOutputStream zipOutput = new ZipOutputStream(response.getOutputStream());

// serialize in Excel
Expand All @@ -372,15 +375,13 @@ private void serialize(
ByteArrayOutputStream baosTurtle = new ByteArrayOutputStream();
RDFDataMgr.write(baosTurtle, dataModel, l);

zipOutput.putNextEntry(new ZipEntry(filename+"."+l.getFileExtensions().get(0)));
zipOutput.putNextEntry(new ZipEntry(filename+".ttl"));
zipOutput.write(baosTurtle.toByteArray());
zipOutput.closeEntry();
//
zipOutput.finish();

// Output
response.setContentType("application/zip");
response.setHeader("Content-Disposition", "inline; filename=\""+filename+"."+"zip"+"\"");
response.getOutputStream().flush();
zipOutput.close();
}
Expand Down

0 comments on commit 1c25759

Please sign in to comment.