public static function generateFromEnvironment() {

		// Get Content type
// 		list($contentType, $contentOptions)	= explodeList(';', $_SERVER['CONTENT_TYPE'], 2);
		$method = $_SERVER['REQUEST_METHOD'];
		
		if( !empty($_SERVER['CONTENT_TYPE']) ) {
			list($inputType) = explodeList(';', $_SERVER['CONTENT_TYPE'], 2);
			$inputType = trim($inputType);
		} else {
			$inputType = 'application/x-www-form-urlencoded';
		}
		
		// Get input
		$input	= null;
		if( $inputType === 'application/json' ) {
// 		if( isset($_SERVER['CONTENT_TYPE']) && strpos(, 'application/json')!==false ) {
			if( $method === HTTPRoute::METHOD_PUT || $method === HTTPRoute::METHOD_POST ) {
				$input = json_decode(file_get_contents('php://input'), true);
			}
			if( !$input ) {
				$input = array();
			}
//			if( $input === null ) {
//				throw new \Exception('malformedJSONBody', HTTP_BAD_REQUEST);
//			}
		} else {
			//application/x-www-form-urlencoded
			if( $method === HTTPRoute::METHOD_PUT ) {
				parse_str(file_get_contents("php://input"), $input);
			} else
			if( isset($_POST) ) {
				$input = $_POST;
			}
		}
		$request = new static($method, parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), $_GET);
		$request->setContent($input, $inputType)
			->setScheme(!empty($_SERVER['HTTPS']) ? 'https' : 'http')
			->setDomain($_SERVER['HTTP_HOST'])
			->setHeaders(getallheaders())
			->setCookies($_COOKIE)
			->setFiles($_FILES);
		return $request;
	}