Package io.micronaut.http
Interface HttpRequestFactory
-
- All Known Implementing Classes:
SimpleHttpRequestFactory
public interface HttpRequestFactory
A factory interface forMutableHttpRequest
objects.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static HttpRequestFactory
INSTANCE
The defaultCookieFactory
instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T> MutableHttpRequest<T>
create(HttpMethod httpMethod, java.lang.String uri)
Create a newMutableHttpRequest
for the given method and URI.default <T> MutableHttpRequest<T>
create(HttpMethod httpMethod, java.lang.String uri, java.lang.String httpMethodName)
Allows to create request including non-standard http methods.<T> MutableHttpRequest<T>
delete(java.lang.String uri, T body)
Return aMutableHttpRequest
that executes anHttpMethod.DELETE
request for the given URI.<T> MutableHttpRequest<T>
get(java.lang.String uri)
Return aMutableHttpRequest
that executes anHttpMethod.GET
request for the given URI.<T> MutableHttpRequest<T>
head(java.lang.String uri)
Return aMutableHttpRequest
that executes anHttpMethod.HEAD
request for the given URI.<T> MutableHttpRequest<T>
options(java.lang.String uri)
Return aMutableHttpRequest
that executes anHttpMethod.OPTIONS
request for the given URI.<T> MutableHttpRequest<T>
patch(java.lang.String uri, T body)
Return aMutableHttpRequest
that executes anHttpMethod.PATCH
request for the given URI.<T> MutableHttpRequest<T>
post(java.lang.String uri, T body)
Return aMutableHttpRequest
that executes anHttpMethod.POST
request for the given URI.<T> MutableHttpRequest<T>
put(java.lang.String uri, T body)
Return aMutableHttpRequest
that executes anHttpMethod.PUT
request for the given URI.
-
-
-
Field Detail
-
INSTANCE
static final HttpRequestFactory INSTANCE
The defaultCookieFactory
instance.
-
-
Method Detail
-
get
<T> MutableHttpRequest<T> get(java.lang.String uri)
Return aMutableHttpRequest
that executes anHttpMethod.GET
request for the given URI.- Type Parameters:
T
- The Http request type- Parameters:
uri
- The URI- Returns:
- The
MutableHttpRequest
instance
-
post
<T> MutableHttpRequest<T> post(java.lang.String uri, T body)
Return aMutableHttpRequest
that executes anHttpMethod.POST
request for the given URI.- Type Parameters:
T
- The body type- Parameters:
uri
- The URIbody
- The body- Returns:
- The
MutableHttpRequest
instance
-
put
<T> MutableHttpRequest<T> put(java.lang.String uri, T body)
Return aMutableHttpRequest
that executes anHttpMethod.PUT
request for the given URI.- Type Parameters:
T
- The body type- Parameters:
uri
- The URIbody
- The body- Returns:
- The
MutableHttpRequest
instance
-
patch
<T> MutableHttpRequest<T> patch(java.lang.String uri, T body)
Return aMutableHttpRequest
that executes anHttpMethod.PATCH
request for the given URI.- Type Parameters:
T
- The body type- Parameters:
uri
- The URIbody
- The body- Returns:
- The
MutableHttpRequest
instance
-
head
<T> MutableHttpRequest<T> head(java.lang.String uri)
Return aMutableHttpRequest
that executes anHttpMethod.HEAD
request for the given URI.- Type Parameters:
T
- The Http request type- Parameters:
uri
- The URI- Returns:
- The
MutableHttpRequest
instance
-
options
<T> MutableHttpRequest<T> options(java.lang.String uri)
Return aMutableHttpRequest
that executes anHttpMethod.OPTIONS
request for the given URI.- Type Parameters:
T
- The Http request type- Parameters:
uri
- The URI- Returns:
- The
MutableHttpRequest
instance
-
delete
<T> MutableHttpRequest<T> delete(java.lang.String uri, T body)
Return aMutableHttpRequest
that executes anHttpMethod.DELETE
request for the given URI.- Type Parameters:
T
- The body type- Parameters:
uri
- The URIbody
- an optional body- Returns:
- The
MutableHttpRequest
instance
-
create
<T> MutableHttpRequest<T> create(HttpMethod httpMethod, java.lang.String uri)
Create a newMutableHttpRequest
for the given method and URI.- Type Parameters:
T
- The Http request type- Parameters:
httpMethod
- The methoduri
- The URI- Returns:
- The request
-
create
default <T> MutableHttpRequest<T> create(HttpMethod httpMethod, java.lang.String uri, java.lang.String httpMethodName)
Allows to create request including non-standard http methods.- Type Parameters:
T
- The http request type- Parameters:
httpMethod
- The methoduri
- The URIhttpMethodName
- Method name. For standard http method equals toEnum.name()
- Returns:
- The request
-
-