public void sendResponse(int code, String fileName, boolean isFile) {
		String status = "";
		String contentLength = "";
		String contentType = "";

		String responseBody = "";

		FileInputStream fileInput;
		DataInputStream fileReader = null;

		if (code == HTTP_OK) {
			status = "HTTP/1.1 200 OK" + CRLF;
		}

		if (code == HTTP_NOT_FOUND) {
			status = "HTTP/1.1 404 Not Found" + CRLF;
		}

		if (isFile) {

			try {
				fileInput = new FileInputStream(Configuration.ImageUploadPath
						+ "/" + fileName);
				fileReader = new DataInputStream(fileInput);
				int available = fileInput.available();
				contentLength = "Content-Length: " + available + CRLF;
				contentType = "Content-Type: application/octet-stream" + CRLF;
			} catch (FileNotFoundException e) {
				log.log(Level.WARNING, e.getMessage(), e);
			} catch (IOException e) {
				log.log(Level.WARNING, e.getMessage(), e);
			}
		} else {
			if (fileName != null) {
				responseBody = "http://{HOST}:{PORT}/" + fileName;
			}
			contentType = "Content-Type: text/plain" + CRLF;
			contentLength = "Content-Length: " + responseBody.length() + CRLF;
		}

		try {
			out.write(toByte(status));
			out.write(toByte(contentType));
			out.write(toByte(contentLength));
			out.write(toByte("Connection: close" + CRLF));
			out.write(toByte(CRLF));

			if (isFile) {
				byte[] buffer = new byte[1024];
				int bytesRead;
				while ((bytesRead = fileReader.read(buffer)) != -1) {
					out.write(buffer, 0, bytesRead);
				}

			} else {
				out.write(toByte(responseBody));
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (fileReader != null) {
				try {
					fileReader.close();
				} catch (IOException e) {
				}
			}
		}

	}