-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathHttpRequestMessage.java
82 lines (72 loc) · 3.13 KB
/
HttpRequestMessage.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
package com.microsoft.azure.functions;
import java.net.URI;
import java.util.Map;
/**
* An HttpRequestMessage instance is provided to Azure functions that use
* {https://github.com/Azure/azure-functions-java-library/blob/dev/src/main/java/com/microsoft/azure/functions/annotation/HttpTrigger.java HTTP Triggers}. For an example of how
* to use the http functionality of Azure Functions, refer to the example in the
* {https://github.com/Azure/azure-functions-java-library/blob/dev/src/main/java/com/microsoft/azure/functions/annotation/HttpTrigger.java}
*
* {https://github.com/Azure/azure-functions-java-library/blob/dev/src/main/java/com/microsoft/azure/functions/annotation/HttpTrigger.java}
* @see HttpResponseMessage
* @param <T> The type of the body content that is expected to be received as part of this HTTP
* request.
* @since 1.0.0
*/
public interface HttpRequestMessage<T> {
/**
* Returns the URI that was called that resulted in this HTTP request being submitted.
*
* @return the URI that was called that resulted in this HTTP request being submitted.
*/
URI getUri();
/**
* Returns the HTTP method name as Enum
*
* @return type of HttpMethod
*/
HttpMethod getHttpMethod();
/**
* Returns a map of headers that were contained within this HTTP request.
*
* @return a map of headers that were contained within this HTTP request.
*/
Map<String, String> getHeaders();
/**
* Returns a map of query parameters that were included with this HTTP request.
*
* @return a map of query parameters that were included with this HTTP request.
*/
Map<String, String> getQueryParameters();
/**
* Returns any body content that was included with this HTTP request.
*
* @return any body content that was included with this HTTP request.
*/
T getBody();
/**
* Returns a {@link HttpResponseMessage.Builder} instance to build a HttpResponseMessage with
* standard HTTP status code and no response body.
*
* @param status The HTTP status code to return to the caller of the function.
* @return An {@link HttpResponseMessage.Builder} instance containing the provided status and
* empty body.
* @param <R> The type of the body object that will be sent as a part of the HTTP Response
*/
<R> HttpResponseMessage.Builder<R> createResponseBuilder(HttpStatus status);
/**
* Returns a {@link HttpResponseMessage.Builder} instance to build a HttpResponseMessage with
* custome HTTP status code and no response body.
*
* @param status The HTTP status code to return to the caller of the function.
* @return An {@link HttpResponseMessage.Builder} instance containing the provided status and
* empty body.
* @param <R> The type of the body object that will be sent as a part of the HTTP Response
*/
<R> HttpResponseMessage.Builder<R> createResponseBuilder(HttpStatusType status);
}