// /story/luid/chapter/para <-- text/image
// /story/luid/cover <-- image
// /story/luid/metadata <-- json
+ // /story/luid/json <-- json, whole chapter (no images)
private Response getStoryPart(String uri, List<String> whitelist) {
String[] cover = uri.split("/");
int off = 2;
// 1-based (0 = desc)
int chapter = 0;
if (chapterStr != null && !"cover".equals(chapterStr)
- && !"metadata".equals(chapterStr)) {
+ && !"metadata".equals(chapterStr) && !"json".equals(chapterStr)) {
try {
chapter = Integer.parseInt(chapterStr);
if (chapter < 0) {
JSONObject json = JsonIO.toJson(meta);
mimeType = "application/json";
in = new ByteArrayInputStream(json.toString().getBytes());
+ } else if ("json".equals(chapterStr)) {
+ Story story = story(luid, whitelist);
+ JSONObject json = JsonIO.toJson(story);
+ mimeType = "application/json";
+ in = new ByteArrayInputStream(json.toString().getBytes());
} else {
Story story = story(luid, whitelist);
if (story != null) {