ninio-http/src/main/java/com/davfx/ninio/http/HttpRequest.java
public static ImmutableList<String> path(String path) {
		int i = path.indexOf(HttpSpecification.PARAMETERS_START);
		if (i < 0) {
			i = path.indexOf(HttpSpecification.HASH_SEPARATOR);
		} else {
			int j = path.indexOf(HttpSpecification.HASH_SEPARATOR);
			if ((j >= 0) && (j < i)) {
				i = j;
			}
		}
		
		if (i < 0) {
			i = path.length();
		}
		
		String p = path.substring(0, i);
		if (p.charAt(0) != HttpSpecification.PATH_SEPARATOR) {
			throw new IllegalArgumentException("Path must start with '" + HttpSpecification.PATH_SEPARATOR + "': " + p);
		}
		String s = p.substring(1);
		Deque<String> l = new LinkedList<>();
		for (String k : Splitter.on(HttpSpecification.PATH_SEPARATOR).splitToList(s)) {
			if (k.isEmpty()) {
				continue;
			}
			if (k.equals(".")) {
				continue;
			}
			if (k.equals("..")) {
				if (!l.isEmpty()) {
					l.removeLast();
				}
				continue;
			}
			l.add(k);
		}
		return ImmutableList.copyOf(l);
	}
public static ImmutableList<String> path(String path) {
		int i = path.indexOf(HttpSpecification.PARAMETERS_START);
		if (i < 0) {
			i = path.indexOf(HttpSpecification.HASH_SEPARATOR);
		} else {
			int j = path.indexOf(HttpSpecification.HASH_SEPARATOR);
			if ((j >= 0) && (j < i)) {
				i = j;
			}
		}
		
		if (i < 0) {
			i = path.length();
		}
		
		String p = path.substring(0, i);
		if (p.charAt(0) != HttpSpecification.PATH_SEPARATOR) {
			throw new IllegalArgumentException("Path must start with '" + HttpSpecification.PATH_SEPARATOR + "': " + p);
		}
		String s = p.substring(1);
		Deque<String> l = new LinkedList<>();
		for (String k : Splitter.on(HttpSpecification.PATH_SEPARATOR).splitToList(s)) {
			if (k.isEmpty()) {
				continue;
			}
			if (k.equals(".")) {
				continue;
			}
			if (k.equals("..")) {
				if (!l.isEmpty()) {
					l.removeLast();
				}
				continue;
			}
			l.add(k);
		}
		return ImmutableList.copyOf(l);
	}
/*%%
public static HttpRequest of(String url) {
return of(url, HttpMethod.GET, ImmutableMultimap.<String, String>of());
}
public static HttpRequest of(String url, HttpMethod method, ImmutableMultimap<String, String> headers) {
String protocol;
boolean secure;
int defaultPort;
if (url.startsWith(HttpSpecification.PROTOCOL)) {
protocol = HttpSpecification.PROTOCOL;
secure = false;
defaultPort = HttpSpecification.DEFAULT_PORT;
} else if (url.startsWith(HttpSpecification.SECURE_PROTOCOL)) {
protocol = HttpSpecification.SECURE_PROTOCOL;
secure = true;
defaultPort = HttpSpecification.DEFAULT_SECURE_PORT;
} else {
throw new IllegalArgumentException("URL must starts with " + HttpSpecification.PROTOCOL + " or " + HttpSpecification.SECURE_PROTOCOL);
}

int i = url.indexOf(HttpSpecification.PATH_SEPARATOR, protocol.length());
if (i < 0) {
String a = url.substring(protocol.length());
int k = a.indexOf(':');
Address address;
if (k < 0) {
address = Address.of(a, defaultPort);
} else {
String h = a.substring(0, k);
int p = Integer.parseInt(a.substring(k + 1));
address = Address.of(h, p);
}
return new HttpRequest(address, secure, method, String.valueOf(HttpSpecification.PATH_SEPARATOR), headers);
} else {
String a = url.substring(protocol.length(), i);
int k = a.indexOf(':');
Address address;
if (k < 0) {
address = Address.of(a, defaultPort);
} else {
String h = a.substring(0, k);
int p = Integer.parseInt(a.substring(k + 1));
address = Address.of(h, p);
}
return new HttpRequest(address, secure, method, url.substring(i), headers);
}
}