Example usage for org.springframework.boot.cli.command.init ProjectGenerationResponse setContent

List of usage examples for org.springframework.boot.cli.command.init ProjectGenerationResponse setContent

Introduction

In this page you can find the example usage for org.springframework.boot.cli.command.init ProjectGenerationResponse setContent.

Prototype

void setContent(byte[] content) 

Source Link

Usage

From source file:org.springframework.boot.cli.command.init.InitializrService.java

private ProjectGenerationResponse createResponse(CloseableHttpResponse httpResponse, HttpEntity httpEntity)
        throws IOException {
    ProjectGenerationResponse response = new ProjectGenerationResponse(ContentType.getOrDefault(httpEntity));
    response.setContent(FileCopyUtils.copyToByteArray(httpEntity.getContent()));
    String fileName = extractFileName(httpResponse.getFirstHeader("Content-Disposition"));
    if (fileName != null) {
        response.setFileName(fileName);/* w  ww.  ja  v  a 2  s  . com*/
    }
    return response;
}