Example usage for org.springframework.http MediaType APPLICATION_OCTET_STREAM_VALUE

List of usage examples for org.springframework.http MediaType APPLICATION_OCTET_STREAM_VALUE

Introduction

In this page you can find the example usage for org.springframework.http MediaType APPLICATION_OCTET_STREAM_VALUE.

Prototype

String APPLICATION_OCTET_STREAM_VALUE

To view the source code for org.springframework.http MediaType APPLICATION_OCTET_STREAM_VALUE.

Click Source Link

Document

A String equivalent of MediaType#APPLICATION_OCTET_STREAM .

Usage

From source file:com.jasperreports.report.controller.ReportServiceController.java

@RequestMapping(value = "/deptBudget/{exportType}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE, method = RequestMethod.GET)
@WMAccessVisibility(value = AccessSpecifier.APP_ONLY)
public Downloadable deptBudgetGenerator(@PathVariable(value = "exportType") ExportType exportType,
        @RequestParam(value = "reportTitle", required = true) String reportTitle,
        @RequestParam(value = "noOfEmployees", required = true) Integer noOfEmployees,
        @RequestParam(value = "orderClause", required = true) String orderClause) {
    return reportServiceService.deptBudgetGenerator(exportType, reportTitle, noOfEmployees, orderClause);
}

From source file:org.bonitasoft.web.designer.controller.utils.HttpFile.java

public static void writeFileInResponseForDownload(HttpServletResponse response, Path filePath)
        throws IOException {
    if (!isExistingFilePath(response, filePath)) {
        response.sendError(HttpServletResponse.SC_NOT_FOUND);
        return;/*w  w  w.ja  va  2s  . c om*/
    }
    writeFileInResponse(response, filePath, MediaType.APPLICATION_OCTET_STREAM_VALUE, "attachment");
}

From source file:org.openwms.core.configuration.api.ConfigurationController.java

@GetMapping(produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public Flux<AbstractPreference> findAllReactive() {
    return Flux.fromIterable(configurationService.findAll()).log();
}

From source file:org.leandreck.endpoints.case1.NoJsonMultiple.java

@RequestMapping(value = "/int", method = GET, produces = { MediaType.IMAGE_PNG_VALUE,
        MediaType.APPLICATION_ATOM_XML_VALUE, MediaType.APPLICATION_OCTET_STREAM_VALUE })
public @ResponseBody int getInt() {
    return 1;/*from  w  w w  . j  a  v a  2 s  .  com*/
}

From source file:org.kawakicchi.bookshelf.interfaces.page.PageController.java

@ResponseBody
@RequestMapping(value = "/{pageSeq:^[0-9]+$}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public Resource file2(@PathVariable("pageSeq") Long pageSeq) {

    InputStream stream = contentStorage.get("photo/" + pageSeq);

    return new InputStreamResource(stream);
}

From source file:com.w3ma.m3u8web.controller.DownloadPlaylistController.java

@RequestMapping(value = "/playlist", method = RequestMethod.GET, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public ResponseEntity<ByteArrayResource> getPlaylist(final HttpServletResponse response) throws IOException {
    logger.debug("getPlaylist called");
    final HttpHeaders headers = new HttpHeaders();
    response.setHeader("Content-Disposition", "attachment; filename=playlist.m3u");
    return new ResponseEntity<>(
            new ByteArrayResource(playlistGeneratorService.getPlaylistByteArrayOutputStream().toByteArray()),
            headers, HttpStatus.OK);//from   ww  w.j  a va 2 s  .co  m
}

From source file:net.gbmb.collector.WrappingApplicationRunner.java

@RequestMapping(value = "/test/final/{cid}", method = RequestMethod.GET, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public byte[] getFinal(@PathVariable("cid") String cid) throws IOException {
    // ensure there is no queued content
    pushListenerWorker.wake();//ww  w  .  ja v  a 2  s . c o m
    // retrieve content
    try {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        IOUtils.copy(finalStorage.get(cid), bos);
        IOUtils.closeQuietly(bos);
        return bos.toByteArray();
    } catch (IOException e) {
        e.printStackTrace();
        throw e;
    } catch (RuntimeException e) {
        e.printStackTrace();
        throw e;
    }
}

From source file:com.jasperreports.report.controller.ReportServiceController.java

@RequestMapping(value = "/empVacation/{exportType}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE, method = RequestMethod.GET)
@WMAccessVisibility(value = AccessSpecifier.APP_ONLY)
public Downloadable empVacationGenerator(@PathVariable(value = "exportType") ExportType exportType,
        @RequestParam(value = "reportTitle", required = true) String reportTitle,
        @RequestParam(value = "empID", required = true) Integer empID,
        @RequestParam(value = "orderClause", required = true) String orderClause) {
    return reportServiceService.empVacationGenerator(exportType, reportTitle, empID, orderClause);
}

From source file:pw.spn.mptg.controller.ProjectTemplateController.java

@PostMapping(produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public ResponseEntity<byte[]> generate(@ModelAttribute PomTemplate pomTemplate) {
    HttpHeaders headers = new HttpHeaders();
    headers.add(HttpHeaders.CONTENT_DISPOSITION,
            String.format(CONTENT_DISPOSITION_VALUE, pomTemplate.getArtifactId()));
    ResponseEntity<byte[]> responseEntity = new ResponseEntity<byte[]>(
            projectService.generateProjectAndZip(pomTemplate), headers, HttpStatus.OK);
    return responseEntity;
}

From source file:bg.vitkinov.edu.services.ImageService.java

@RequestMapping(value = "/img", method = { RequestMethod.POST }, produces = { MediaType.IMAGE_PNG_VALUE,
        MediaType.IMAGE_GIF_VALUE, MediaType.IMAGE_JPEG_VALUE, MediaType.APPLICATION_OCTET_STREAM_VALUE })
public byte[] convertToInlineTextImage(@RequestHeader(value = "Accept") String acceptType,
        @RequestParam String text, @RequestParam(required = false, defaultValue = "false") String base64,
        @RequestParam(required = false, defaultValue = "Arial-14") String font,
        @RequestParam(required = false, defaultValue = "black") String foreColor,
        @RequestParam(required = false) String backColor) {
    logger.info(acceptType);//from ww  w .  j a v a2s. c o m
    logger.info("Text: " + text);
    return convert(Boolean.valueOf(base64) ? new String(Base64.getDecoder().decode(text)) : text,
            new TextToGraphicsConverter(createGraphicsProperties(font, foreColor, backColor)),
            GraphicsType.value(acceptType));
}