public void write(OutputStream outputStream, File requestResource) {

		switch (this.httpStatusCode) {
		case -1:
			Log.warn("HTTP -1 write output from cache");
			break;
		case 200:
			Log.info("HTTP success 200 - OK");
			break;
		case 403:
			Log.info("HTTP error 403 - Forbidden");
			break;
		case 404:
			Log.info("HTTP error 404 - Page Not Found");
			break;
		case 500:
			Log.info("HTTP error 500 - Internal Server Error");
			break;
		default:
			Log.fatal("Invalid http status code: " + this.httpStatusCode);
			break;
		}

		try {
			File bodyFile = generateBody(requestResource);
			byte[] body = getByteArray(bodyFile);

			long bodySize;
			// output length of interpreted script / normal files are different
			if (isInterpretedFile(requestResource) == null) {
				bodySize = bodyFile.length();
			} else {
				bodySize = body.length;
			}

			byte[] header = getByteArray(generateHeader(bodySize,
					requestResource));

			HttpCache.getInstance().put(requestResource, header, body);

			outputStream.write(header);
			outputStream.write(body);
		} catch (final IOException ex) {
			Log.error("Can not write response / output stream! ", ex);
			failOver(outputStream);
		} catch (URISyntaxException e) {
			Log.error("Can't read resource from JAR file.", e);
			failOver(outputStream);
		}
	}