diff options
author | knowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-09-21 07:29:47 +0000 |
---|---|---|
committer | knowcenter <knowcenter@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2007-09-21 07:29:47 +0000 |
commit | dfb07c7b429b7e06c6dcd44bdbb1f84fd53481e1 (patch) | |
tree | cf9d2f9ce23a5a9323ae4f1fa8abba45ecb6cdd6 /src/main/java/at/knowcenter/wag/egov | |
parent | 58f7580e531fea758e11e27e2097a65957a6235b (diff) | |
download | pdf-as-3-dfb07c7b429b7e06c6dcd44bdbb1f84fd53481e1.tar.gz pdf-as-3-dfb07c7b429b7e06c6dcd44bdbb1f84fd53481e1.tar.bz2 pdf-as-3-dfb07c7b429b7e06c6dcd44bdbb1f84fd53481e1.zip |
Erweiterte MIME-Types werden akzeptiert (nun auch application/..)
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@218 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov')
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java index 8d9e293..7b935de 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java @@ -20,6 +20,7 @@ package at.knowcenter.wag.egov.egiz.web.servlets; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -286,7 +287,9 @@ public class VerifyServlet extends HttpServlet throw new PDFDocumentException(250, "The document is empty."); //$NON-NLS-1$
}
- if (upload_fi.getContentType() != null && upload_fi.getContentType().startsWith("application/pdf"))
+
+ // TR: do not check MIME-type of incoming file - might vary depending on the browser used
+ if ((upload_fi.getContentType() != null ) && ((upload_fi.getContentType().startsWith("application/pdf") || upload_fi.getContentType().startsWith("application/x-download") )))
{
try
{
@@ -431,4 +434,16 @@ public class VerifyServlet extends HttpServlet return toreturn;
}
+ public boolean isPDF(byte[] data) {
+ final byte[] PDF_MAGIC_NUMBER = { (byte) 0x25, (byte) 0x50, (byte)
+ 0x44, (byte) 0x46 }; // %PDF
+ if (data == null || data.length < PDF_MAGIC_NUMBER.length) {
+ return false;
+ }
+ byte[] documentHeader = new byte[PDF_MAGIC_NUMBER.length];
+ System.arraycopy(data, 0, documentHeader, 0, documentHeader.length);
+ return Arrays.equals(documentHeader, PDF_MAGIC_NUMBER);
+ }
+
+
}
\ No newline at end of file |