X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FGetImagePage.java;fp=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FGetImagePage.java;h=0000000000000000000000000000000000000000;hb=de7568a82eb4150bf6d2b0553841b7b69f84c968;hp=ec38d0acf1102dec1cc53bee93f0d05fb82f75b4;hpb=9acbc5bdec4ccb752e0856a501568b0bb6161579;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/web/GetImagePage.java b/src/main/java/net/pterodactylus/sone/web/GetImagePage.java
deleted file mode 100644
index ec38d0a..0000000
--- a/src/main/java/net/pterodactylus/sone/web/GetImagePage.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Sone - GetImagePage.java - Copyright © 2011â2016 David Roden
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package net.pterodactylus.sone.web;
-
-import java.io.IOException;
-import java.net.URI;
-
-import net.pterodactylus.sone.data.TemporaryImage;
-import net.pterodactylus.sone.web.page.FreenetPage;
-import net.pterodactylus.sone.web.page.FreenetRequest;
-import net.pterodactylus.util.web.Response;
-
-/**
- * Page that delivers a {@link TemporaryImage} to the browser.
- *
- * @author David âBombeâ Roden
- */
-public class GetImagePage implements FreenetPage {
-
- /** The Sone web interface. */
- private final WebInterface webInterface;
-
- /**
- * Creates a new âget imageâ page.
- *
- * @param webInterface
- * The Sone web interface
- */
- public GetImagePage(WebInterface webInterface) {
- this.webInterface = webInterface;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPath() {
- return "getImage.html";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isPrefixPage() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Response handleRequest(FreenetRequest request, Response response) throws IOException {
- String imageId = request.getHttpRequest().getParam("image");
- TemporaryImage temporaryImage = webInterface.getCore().getTemporaryImage(imageId);
- if (temporaryImage == null) {
- return response.setStatusCode(404).setStatusText("Not found.").setContentType("text/html; charset=utf-8");
- }
- String contentType= temporaryImage.getMimeType();
- return response.setStatusCode(200).setStatusText("OK").setContentType(contentType).addHeader("Content-Disposition", "attachment; filename=" + temporaryImage.getId() + "." + contentType.substring(contentType.lastIndexOf('/') + 1)).write(temporaryImage.getImageData());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isLinkExcepted(URI link) {
- return false;
- }
-
-}