=doc #18657 Doc host and path directives

* also including docs of RequestVals.matchAndExtractHost
  and RequestVals.matchAndExtractHost
* and add Host.create factory methods
* add missing HttpRequest PATCH and OPTIONS
* change to val in matchAndExtractHost for
  fail fast exception
This commit is contained in:
Patrik Nordwall 2015-10-07 12:07:26 +02:00
parent 5753cd6074
commit 3081893bfd
20 changed files with 519 additions and 2 deletions

View file

@ -86,11 +86,25 @@ public abstract class HttpRequest implements HttpMessage, HttpMessage.MessageTra
public static HttpRequest DELETE(String uri) {
return create(uri).withMethod(HttpMethods.DELETE);
}
/**
* A default HEAD request to be modified using the `withX` methods.
*/
public static HttpRequest HEAD(String uri) {
return create(uri).withMethod(HttpMethods.HEAD);
}
/**
* A default PATCH request to be modified using the `withX` methods.
*/
public static HttpRequest PATCH(String uri) {
return create(uri).withMethod(HttpMethods.PATCH);
}
/**
* A default OPTIONS request to be modified using the `withX` methods.
*/
public static HttpRequest OPTIONS(String uri) {
return create(uri).withMethod(HttpMethods.OPTIONS);
}
}

View file

@ -4,7 +4,22 @@
package akka.http.javadsl.model.headers;
import java.net.InetSocketAddress;
public abstract class Host extends akka.http.scaladsl.model.HttpHeader {
public static Host create(InetSocketAddress address) {
return akka.http.scaladsl.model.headers.Host.apply(address);
}
public static Host create(String host) {
return akka.http.scaladsl.model.headers.Host.apply(host);
}
public static Host create(String host, int port) {
return akka.http.scaladsl.model.headers.Host.apply(host, port);
}
public abstract akka.http.javadsl.model.Host host();
public abstract int port();
}