Skip to content

Error message META-INF/container.xml When use my own url  #69

@Harrycheng1992

Description

@Harrycheng1992

When I use url from my controller. The reader can't run anyway.

Anyone can help?

Error message:
error

controller:
When I use url from my controller. The reader can't run anyway.

Anyone can help?

controller:
@GetMapping("/epub/ebook/{id}")
public ResponseEntity<byte[]> getEPUB(@PathVariable Integer id) throws IOException{
String filePath = "C:\epub\1010490076.epub";
File file = new File(filePath);
if (file.exists()) {
}
FileInputStream fileInputStream = new FileInputStream(file);
byte[] fileByte = fileInputStream.readAllBytes();
fileInputStream.close();
HttpHeaders header = new HttpHeaders();
header.add(HttpHeaders.CONTENT_TYPE, "application/epub+zip");
header.setContentDisposition(ContentDisposition.attachment().filename("xxxx.epub", StandardCharsets.UTF_8).build());
return new ResponseEntity<>(fileByte, header, HttpStatus.OK);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions