use of javax.ws.rs.core.StreamingOutput in project pentaho-platform by pentaho.
the class FileService method systemBackup.
public DownloadFileWrapper systemBackup(String userAgent) throws IOException, ExportException {
if (doCanAdminister()) {
String originalFileName;
String encodedFileName;
originalFileName = "SystemBackup.zip";
encodedFileName = makeEncodedFileName(originalFileName);
StreamingOutput streamingOutput = getBackupStream();
final String attachment = HttpMimeTypeListener.buildContentDispositionValue(originalFileName, true);
return new DownloadFileWrapper(streamingOutput, attachment, encodedFileName);
} else {
throw new SecurityException();
}
}
use of javax.ws.rs.core.StreamingOutput in project pentaho-platform by pentaho.
the class FileService method getBackupStream.
private StreamingOutput getBackupStream() throws IOException, ExportException {
File zipFile = getBackupExporter().performExport();
final FileInputStream inputStream = new FileInputStream(zipFile);
return new StreamingOutput() {
@Override
public void write(OutputStream output) throws IOException {
IOUtils.copy(inputStream, output);
}
};
}
use of javax.ws.rs.core.StreamingOutput in project syncope by apache.
the class RoleServiceImpl method getConsoleLayoutInfo.
@Override
public Response getConsoleLayoutInfo(final String key) {
String template = logic.getConsoleLayoutInfo(key);
StreamingOutput sout = (os) -> os.write(template.getBytes());
return Response.ok(sout).type(MediaType.APPLICATION_JSON_TYPE).build();
}
use of javax.ws.rs.core.StreamingOutput in project syncope by apache.
the class MailTemplateServiceImpl method getFormat.
@Override
public Response getFormat(final String key, final MailTemplateFormat format) {
String template = logic.getFormat(key, format);
StreamingOutput sout = (os) -> os.write(template.getBytes());
return Response.ok(sout).type(format.getMediaType()).build();
}
use of javax.ws.rs.core.StreamingOutput in project ANNIS by korpling.
the class QueryServiceImpl method findRaw.
private StreamingOutput findRaw(final QueryData data, final String rawCorpusNames, final String query) throws IOException {
return new StreamingOutput() {
@Override
public void write(OutputStream output) throws IOException, WebApplicationException {
long start = new Date().getTime();
queryDao.find(data, output);
long end = new Date().getTime();
logQuery("FIND", query, splitCorpusNamesFromRaw(rawCorpusNames), end - start);
}
};
}
Aggregations