// Path: fetcher/src/main/java/com/readium/r2_streamer/fetcher/EpubFetcher.java
// public class EpubFetcher implements Fetcher {
//     private final String TAG = "EpubFetcher";
//     public Container container;
//     public EpubPublication publication;
//     private String rootFileDirectory;
// 
//     public EpubFetcher(Container container, EpubPublication publication) throws EpubFetcherException {
//         this.container = container;
//         this.publication = publication;
// 
//         String rootPath = publication.internalData.get("rootfile");
//         if (rootPath != null) {
//             this.rootFileDirectory = rootPath;
//         } else {
//             throw new EpubFetcherException("No rootFile in internalData, unable to get path to publication");
//         }
//     }
// 
//     @Override
//     public String getData(String path) throws EpubFetcherException {
//         String data = container.rawData(path);
//         if (data == null) {
//             System.out.println(TAG + " file is missing " + path);
//             throw new EpubFetcherException(path + " file is missing");
//         }
//         return data;
//     }
// 
//     @Override
//     public int getDataSize(String path) throws EpubFetcherException {
//         int dataSize = container.rawDataSize(path);
//         if (dataSize == 0) {
//             System.out.println(TAG + " file is missing " + path);
//             throw new EpubFetcherException(path + "file is missing");
//         }
//         return dataSize;
//     }
// 
//     @Override
//     public InputStream getDataInputStream(String path) throws EpubFetcherException {
//         InputStream dataInputStream = container.rawDataInputStream(path);
//         if (dataInputStream == null) {
//             System.out.println(TAG + " file is missing " + path);
//             throw new EpubFetcherException(path + "file is missing");
//         }
//         return dataInputStream;
//     }
// }
// 
// Path: server/src/main/java/com/readium/r2_streamer/server/ResponseStatus.java
// public class ResponseStatus {
//     public static final String SUCCESS_RESPONSE = "{\"success\":true}";
//     public static final String FAILURE_RESPONSE = "{\"success\":false}";
// }


import com.readium.r2_streamer.fetcher.EpubFetcher;
import com.readium.r2_streamer.server.ResponseStatus;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.Map;
import fi.iki.elonen.NanoHTTPD;
import fi.iki.elonen.router.RouterNanoHTTPD;
package com.readium.r2_streamer.server.handler;

//import android.util.Log;




/**
 * Created by mahavir on 3/2/17.
 */

public class ManifestHandler extends RouterNanoHTTPD.DefaultHandler {
    private static final String TAG = "ManifestHandler";
    private NanoHTTPD.Response response;

    @Override
    public String getMimeType() {
        return "application/webpub+json";
    }

    @Override
    public String getText() {
// Path: fetcher/src/main/java/com/readium/r2_streamer/fetcher/EpubFetcher.java
// public class EpubFetcher implements Fetcher {
//     private final String TAG = "EpubFetcher";
//     public Container container;
//     public EpubPublication publication;
//     private String rootFileDirectory;
// 
//     public EpubFetcher(Container container, EpubPublication publication) throws EpubFetcherException {
//         this.container = container;
//         this.publication = publication;
// 
//         String rootPath = publication.internalData.get("rootfile");
//         if (rootPath != null) {
//             this.rootFileDirectory = rootPath;
//         } else {
//             throw new EpubFetcherException("No rootFile in internalData, unable to get path to publication");
//         }
//     }
// 
//     @Override
//     public String getData(String path) throws EpubFetcherException {
//         String data = container.rawData(path);
//         if (data == null) {
//             System.out.println(TAG + " file is missing " + path);
//             throw new EpubFetcherException(path + " file is missing");
//         }
//         return data;
//     }
// 
//     @Override
//     public int getDataSize(String path) throws EpubFetcherException {
//         int dataSize = container.rawDataSize(path);
//         if (dataSize == 0) {
//             System.out.println(TAG + " file is missing " + path);
//             throw new EpubFetcherException(path + "file is missing");
//         }
//         return dataSize;
//     }
// 
//     @Override
//     public InputStream getDataInputStream(String path) throws EpubFetcherException {
//         InputStream dataInputStream = container.rawDataInputStream(path);
//         if (dataInputStream == null) {
//             System.out.println(TAG + " file is missing " + path);
//             throw new EpubFetcherException(path + "file is missing");
//         }
//         return dataInputStream;
//     }
// }
// 
// Path: server/src/main/java/com/readium/r2_streamer/server/ResponseStatus.java
// public class ResponseStatus {
//     public static final String SUCCESS_RESPONSE = "{\"success\":true}";
//     public static final String FAILURE_RESPONSE = "{\"success\":false}";
// }


// Path: server/src/main/java/com/readium/r2_streamer/server/handler/ManifestHandler.java
import com.readium.r2_streamer.fetcher.EpubFetcher;
import com.readium.r2_streamer.server.ResponseStatus;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.Map;
import fi.iki.elonen.NanoHTTPD;
import fi.iki.elonen.router.RouterNanoHTTPD;

package com.readium.r2_streamer.server.handler;

//import android.util.Log;




/**
 * Created by mahavir on 3/2/17.
 */

public class ManifestHandler extends RouterNanoHTTPD.DefaultHandler {
    private static final String TAG = "ManifestHandler";
    private NanoHTTPD.Response response;

    @Override
    public String getMimeType() {
        return "application/webpub+json";
    }

    @Override
    public String getText() {
        return ResponseStatus.FAILURE_RESPONSE;