diff --git a/src/org/forkalsrud/album/web/AlbumServlet.java b/src/org/forkalsrud/album/web/AlbumServlet.java index f4f9bd3..a45de0d 100644 --- a/src/org/forkalsrud/album/web/AlbumServlet.java +++ b/src/org/forkalsrud/album/web/AlbumServlet.java @@ -31,6 +31,7 @@ import com.drew.metadata.MetadataException; public class AlbumServlet extends HttpServlet { + String basePath = "/home/erik/Photos/Wedding"; EntryDao dao; @Override @@ -45,24 +46,14 @@ public class AlbumServlet public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { - String path = req.getPathTranslated(); - + String pathInfo = req.getPathInfo(); String page = null; - if (path.endsWith(".photo")) { - path = path.substring(0, path.length() - ".photo".length()); + if (pathInfo.endsWith(".photo")) { + pathInfo = pathInfo.substring(0, pathInfo.length() - ".photo".length()); page = "photo"; } - File file = new File(path); - if (file == null) { - res.setStatus(HttpServletResponse.SC_NOT_FOUND); - return; - } - - if (!file.exists()) { - res.setStatus(HttpServletResponse.SC_NOT_FOUND); - return; - } - + File file = new File(basePath + pathInfo); + System.out.println("path=" + file); if (!file.canRead()) { res.setStatus(HttpServletResponse.SC_FORBIDDEN); return; @@ -90,7 +81,6 @@ public class AlbumServlet throw new RuntimeException("sadness", e); } } else if ("photo".equals(page)) { - try { Entry e = dao.readFile(file); req.setAttribute("entry", e); @@ -150,7 +140,7 @@ public class AlbumServlet } BufferedImage img = reader.read(0, param); - // Recalculate scale after subsampling was applied + // Recalculate scale after sub-sampling was applied double scale; AffineTransform xform; if (entry.getOrientation() == 6) {