Skip to content

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

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);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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