public HttpResponse makeResponse(HttpRequest request, String rootDirectory, File file) {
		// Handling PUT request here
		
		boolean preexists = false;
		if (file.exists()) {
			preexists = true;
		}
		
		HttpResponse response = null;
		if (file.getParentFile().exists() || file.getParentFile().mkdirs()) {
			BufferedWriter writer = null;
			try {
				writer = new BufferedWriter( new FileWriter(file));
				writer.write( request.getBody());
			} catch (IOException e) {
				response  = HttpResponseFactory.create500InternalServerError(Protocol.CLOSE);
			} finally {
				if (writer != null) {
					try {
						writer.close();
					} catch (IOException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				}
			}
		} else {
			response = HttpResponseFactory.create500InternalServerError(Protocol.CLOSE);
		}
		
		// if nothing has gone wrong so far... 
		if (response == null) {
			if (preexists) {
				// Lets create 204 No Content response
				response = HttpResponseFactory.create204NoContent(Protocol.CLOSE);
			} else {
				// Lets create 201 Created response
				response = HttpResponseFactory.create201Created(null, Protocol.CLOSE);
			}
		}
		return response;
	}