package com.kodcu.controller;

import com.kodcu.other.Current;
import com.kodcu.service.DirectoryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * Created by usta on 31.12.2014.
 */
@Controller
public class EpubController {

    private Logger logger = LoggerFactory.getLogger(ImageController.class);

    @Autowired
    private Current current;

    @Autowired
    private DirectoryService directoryService;

    private Path path;

    @RequestMapping(value = {"/epub/viewer"}, method = RequestMethod.GET)
    public String epubHtml(@RequestParam(value = "path") String path) {
        this.path = Paths.get(path);
        return "redirect:/epub.html";
    }

    @RequestMapping(value = {"**.epub", "**.epub3"}, method = RequestMethod.GET)
    @ResponseBody
    public ResponseEntity<byte[]> epub3(HttpServletRequest request) {

        byte[] temp = new byte[]{};

        try {
            temp = Files.readAllBytes(path);
        } catch (Exception e) {
            logger.info(e.getMessage(), e);
        }

        return new ResponseEntity<>(temp, HttpStatus.OK);
    }

}

@@ -77,89 +77,65 @@
 dcu.
-service.DirectoryService;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory
+other.IOHelper;%0Aimport com.kodcu.service.DirectoryService
 ;%0Aim
@@ -635,36 +635,8 @@
 st;%0A
-import java.nio.file.Files;%0A
 impo
@@ -776,85 +776,8 @@
  %7B%0A%0A
-    private Logger logger = LoggerFactory.getLogger(ImageController.class);%0A%0A
     
@@ -1301,17 +1301,16 @@
 uest) %7B%0A
-%0A
         
@@ -1327,168 +1327,36 @@
 p = 
-new byte%5B%5D%7B%7D;%0A%0A        try %7B%0A            temp = Files.readAllBytes(path);%0A        %7D catch (Exception e) %7B%0A            logger.info(e.getMessage(), e);%0A        %7D%0A
+IOHelper.readAllBytes(path);
 %0A   

Update the EpubController class