Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Harrycheng1992 opened this issue Mar 4, 2023 · 0 comments
Open

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

Harrycheng1992 opened this issue Mar 4, 2023 · 0 comments

Comments

@Harrycheng1992
Copy link

Harrycheng1992 commented Mar 4, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant