nitcorn $ HTCPCPAction :: SELF
Type of this instance, automatically specialized in every classnitcorn $ HTCPCPAction :: answer
Prepare aHttpResponse destined to the client in response to the request
			HttpResponse destined to the client in response to the request
			core :: Object :: class_factory
Implementation used byget_class to create the specific class.
			nitcorn :: Action :: defaultinit
nitcorn :: HTCPCPAction :: defaultinit
core :: Object :: defaultinit
core :: Object :: is_same_instance
Return true ifself and other are the same instance (i.e. same identity).
			core :: Object :: is_same_serialized
Isself the same as other in a serialization context?
			core :: Object :: is_same_type
Return true ifself and other have the same dynamic type.
			core :: Object :: output_class_name
Display class name on stdout (debug only).nitcorn :: Action :: prepare_respond_and_close
Full to arequest with sending the response and closing of the http_server
			
# Nitcorn Action used to answer requests.
class HTCPCPAction
	super Action
	# Brewing status.
	var brewing = false
	# Teapot status.
	var is_teapot = false
	redef fun answer(http_request, turi) do
		var message: String
		var method = http_request.method
		var response: HttpResponse
		if is_teapot then
			response = new HttpResponse(418)
			response.body = "I'm a teapot!\n"
			response.header["Content-Type"] = "text"
			return response
		end
		if method == "POST" or method == "BREW" then
			if brewing then
				message = "Pot Busy"
				response = new HttpResponse(400)
			else
				message = "Brewing a new pot of coffee\n"
				brewing = true
				response = new HttpResponse(200)
			end
		else if method == "WHEN" then
			if brewing then
				message = "Stopped adding milk, your coffee is ready!\n"
				brewing = false
				response = new HttpResponse(200)
			else
				message = "There is no coffee brewing!\n"
				response = new HttpResponse(405)
			end
		else if method == "PROPFIND" or method == "GET" then
			if brewing then
				message = "The pot is busy\n"
			else
				message = "The pot is ready to brew more coffee\n"
			end
			response = new HttpResponse(200)
		else
			message = "Unknown method: {method}"
			brewing = false
			response = new HttpResponse(405)
		end
		response.header["Content-Type"] = "text"
		response.body = message
		return response
	end
end
					lib/nitcorn/examples/src/htcpcp_server.nit:24,1--82,3