Search in sources :

Example 1 with JsonExportWriter

use of io.apiman.manager.api.exportimport.json.JsonExportWriter in project apiman by apiman.

the class SystemResourceImpl method exportData.

/**
 * @see ISystemResource#exportData()
 */
@Override
public Response exportData() {
    final IApimanLogger exportLogger = ApimanLoggerFactory.getLogger(IExportWriter.class);
    StreamingOutput stream = new StreamingOutput() {

        @Override
        public void write(OutputStream os) throws IOException, WebApplicationException {
            IExportWriter writer = new JsonExportWriter(os, exportLogger);
            exporter.init(writer);
            exporter.export();
            os.flush();
        }
    };
    return Response.ok(stream, MediaType.APPLICATION_JSON).header("Content-Disposition", // $NON-NLS-1$ //$NON-NLS-2$
    "attachment; filename=api-manager-export.json").build();
}
Also used : JsonExportWriter(io.apiman.manager.api.exportimport.json.JsonExportWriter) IExportWriter(io.apiman.manager.api.exportimport.write.IExportWriter) OutputStream(java.io.OutputStream) StreamingOutput(javax.ws.rs.core.StreamingOutput) IApimanLogger(io.apiman.common.logging.IApimanLogger)

Aggregations

IApimanLogger (io.apiman.common.logging.IApimanLogger)1 JsonExportWriter (io.apiman.manager.api.exportimport.json.JsonExportWriter)1 IExportWriter (io.apiman.manager.api.exportimport.write.IExportWriter)1 OutputStream (java.io.OutputStream)1 StreamingOutput (javax.ws.rs.core.StreamingOutput)1