aboutsummaryrefslogtreecommitdiff
path: root/id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java
diff options
context:
space:
mode:
authormcentner <mcentner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-08-08 07:25:32 +0000
committermcentner <mcentner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-08-08 07:25:32 +0000
commit43e57a42832ea8b4ceb0317f3c9028a4174ffa7b (patch)
treef5ed9074b8d7b89b2dd5b22d326f63be103e7551 /id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java
parent10889e9dea2cc2f70b475e6ff7af37fdba1621d9 (diff)
downloadmoa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.tar.gz
moa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.tar.bz2
moa-id-spss-43e57a42832ea8b4ceb0317f3c9028a4174ffa7b.zip
Adapted project directory structure to suit the new maven based build process.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@909 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java')
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java68
1 files changed, 0 insertions, 68 deletions
diff --git a/id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java b/id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java
deleted file mode 100644
index 035c47eb9..000000000
--- a/id.server/src/at/gv/egovernment/moa/id/util/HTTPUtils.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package at.gv.egovernment.moa.id.util;
-
-/**
- * HTTP Utilities
- *
- * @author Rudolf Schamberger
- * @version $Id$
- */
-
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-import org.apache.regexp.RE;
-import org.apache.regexp.RESyntaxException;
-
-/**
- *
- * @author Rudolf Schamberger
- *
- */
-public class HTTPUtils {
-
- /**
- * Utility used to obtainin correct encoded HTTP content.
- * Reads a given Content adressed by HTTP-URL into String.
- * Content encoding is considered by using the Content-Type HTTP header charset value.
- * @param URL HTTP URL to read from.
- * @return String representation of content
- * @throws IOException on data-reading problems
- */
- public static String readHttpURL(String URL)
- throws IOException {
-
- URL url = new URL(URL);
- HttpURLConnection conn = (HttpURLConnection)url.openConnection();
- conn.setRequestMethod("GET");
- String contentType = conn.getContentType();
- RE regExp = null;
- try {
- regExp = new RE("(;.*charset=)(\"*)(.*[^\"])");
- } catch (RESyntaxException e) {
- //RESyntaxException is not possible = expr. is costant
- }
- boolean charsetSupplied = regExp.match(contentType);
- String encoding = "ISO-8859-1"; //default HTTP encoding
- if (charsetSupplied) {
- encoding = regExp.getParen(3);
- }
- InputStream instream = new BufferedInputStream(conn.getInputStream());
- InputStreamReader isr = new InputStreamReader(instream, encoding);
- Reader in = new BufferedReader(isr);
- int ch;
- StringBuffer buffer = new StringBuffer();
- while ((ch = in.read()) > -1) {
- buffer.append((char)ch);
- }
- in.close();
- conn.disconnect();
- return buffer.toString();
- }
-
-}