+htc add starting points for requests with a certain HTTP method
This commit is contained in:
parent
80f125f481
commit
0859c5cadc
3 changed files with 54 additions and 8 deletions
|
|
@ -44,9 +44,51 @@ public abstract class HttpRequest implements HttpMessage, HttpMessage.MessageTra
|
|||
public abstract HttpRequest withEntity(RequestEntity entity);
|
||||
|
||||
/**
|
||||
* Returns a default request to be changed using the `withX` methods.
|
||||
* Returns a default request to be modified using the `withX` methods.
|
||||
*/
|
||||
public static HttpRequest create() {
|
||||
return Accessors$.MODULE$.HttpRequest();
|
||||
return Accessors.HttpRequest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a default request to the specified URI to be modified using the `withX` methods.
|
||||
*/
|
||||
public static HttpRequest create(String uri) {
|
||||
return Accessors.HttpRequest(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* A default GET request to be modified using the `withX` methods.
|
||||
*/
|
||||
public static HttpRequest GET(String uri) {
|
||||
return create(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* A default POST request to be modified using the `withX` methods.
|
||||
*/
|
||||
public static HttpRequest POST(String uri) {
|
||||
return create(uri).withMethod(HttpMethods.POST);
|
||||
}
|
||||
|
||||
/**
|
||||
* A default PUT request to be modified using the `withX` methods.
|
||||
*/
|
||||
public static HttpRequest PUT(String uri) {
|
||||
return create(uri).withMethod(HttpMethods.PUT);
|
||||
}
|
||||
|
||||
/**
|
||||
* A default DELETE request to be modified using the `withX` methods.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,6 @@ public abstract class HttpResponse implements HttpMessage, HttpMessage.MessageTr
|
|||
* Returns a default response to be changed using the `withX` methods.
|
||||
*/
|
||||
public static HttpResponse create() {
|
||||
return Accessors$.MODULE$.HttpResponse();
|
||||
return Accessors.HttpResponse();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,12 +12,16 @@ import akka.stream.MaterializerSettings
|
|||
*
|
||||
* Accessors for constructors with default arguments to be used from the Java implementation
|
||||
*/
|
||||
private[http] object Accessors {
|
||||
object Accessors {
|
||||
/** INTERNAL API */
|
||||
private[http] def HttpRequest(): HttpRequest = model.HttpRequest()
|
||||
/** INTERNAL API */
|
||||
private[http] def HttpResponse(): HttpResponse = model.HttpResponse()
|
||||
def HttpRequest(): HttpRequest = model.HttpRequest()
|
||||
|
||||
/** INTERNAL API */
|
||||
private[http] def Uri(uri: model.Uri): Uri = JavaUri(uri)
|
||||
def HttpRequest(uri: String): HttpRequest = model.HttpRequest(uri = uri)
|
||||
|
||||
/** INTERNAL API */
|
||||
def HttpResponse(): HttpResponse = model.HttpResponse()
|
||||
|
||||
/** INTERNAL API */
|
||||
def Uri(uri: model.Uri): Uri = JavaUri(uri)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue