@SuppressWarnings("deprecation")
	public void requestPOST(String firstLine) {
		String currentLine;
		int dataLength = 0;
		String boundary = "";
		DataOutputStream fileout = null;
		
		try {

			while (true) {
				currentLine = in.readLine();
				if (currentLine == null) {
					break;
				}
				//convert to lowercase, due to a bug in android http://code.google.com/p/android/issues/detail?id=6684
				if (currentLine.toLowerCase().indexOf("Content-Type: multipart/form-data".toLowerCase()) != -1) {
					boundary = currentLine.split("boundary=")[1];
					break;
				}
			}

			while (true) {
				currentLine = in.readLine();
				if (currentLine == null) {
					break;
				}
				if (currentLine.indexOf("--" + boundary) != -1) {
					String filename = in.readLine().split("filename=")[1]
							.replaceAll("\"", "");
					String[] filelist = filename.split("\\"
							+ System.getProperty("file.separator"));
					filename = filelist[filelist.length - 1];
					if (!filename.equals("redpinfile")) {
						Log
								.getLogger()
								.log(Level.FINE,
										"unauthorized client tried to upload map image");
						sendResponse(HTTP_NOT_FOUND);
					}

					break;
				}
			}

			while (true) {

				currentLine = in.readLine();
				if (currentLine == null) {
					break;
				}
				if (currentLine.indexOf("Content-Length:") != -1) {
					dataLength = Integer.parseInt(currentLine.split(" ")[1]);
					break;
				}
			}
			// skip CRLF
			in.readLine();
			String fileName = generateFilename();
			fileout = new DataOutputStream(new FileOutputStream(
					Configuration.ImageUploadPath + "/" + fileName));
			
			byte[] buf = new byte[BUFFER_SIZE];
			
			int l = dataLength;
			int bytesRead;
			while (((bytesRead = in.read(buf,0,Math.min(BUFFER_SIZE, l))) != -1) && (l != 0)) {
				fileout.write(buf, 0, bytesRead);
				l -= bytesRead;
			}
			
			in.readLine();
			currentLine = in.readLine();
			if (currentLine != null && currentLine.indexOf("--" + boundary + "--") != -1) {
				// everything ok
			}
			log.log(Level.FINER,
					"successful uploaded map image " + fileName);
			sendResponse(HTTP_OK, fileName, false);

		} catch (IOException e) {
			log.log(Level.WARNING, e.getMessage(), e);
		} finally {
			if (fileout != null) {
				try {
					fileout.close();
				} catch (IOException e) {}
			}
		}
	}