HttpTrigger Interface
public interface HttpTrigger
HttpTrigger(name = "req", methods = {HttpMethod.GET, HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) final HttpRequestMessage<Optional<String>> request) { String name = request.getBody().orElseGet(() -> request.getQueryParameters().get("name")); return name == null ? "Please pass a name on the query string or in the request body" : "Hello " + name; }
Method Summary
Modifier and Type | Method and Description |
---|---|
Authorization |
authLevel()
Determines what keys, if any, need to be present on the request in order to invoke the function. The authorization level can be one of the following values:
For more information, see the documentation about authorization keys. |
String |
dataType()
Defines how Functions runtime should treat the parameter value. Possible values are:
|
Http |
methods()
An array of the HTTP methods to which the function responds. If not specified, the function responds to all HTTP methods. |
String |
name()
The variable name used in function code for the request or request body. |
String |
route()
BindingName("id") int id, final ExecutionContext context ) { .... context.getLogger().info("We have " + category + " with id " + id); .... } For more details on the route syntax, refer to the online documentation. |
Method Details
authLevel
public AuthorizationLevel authLevel() default AuthorizationLevel.FUNCTION
Determines what keys, if any, need to be present on the request in order to invoke the function. The authorization level can be one of the following values:
<li>
<p>
<b>anonymous</b>: No API key is required. </p>
</li>
<li>
<p>
<b>function</b>: A function-specific API key is required. This is the default value if none is provided. </p>
</li>
<li>
<p>
<b>admin</b>: The master key is required. </p>
</li>
For more information, see the documentation about authorization keys.
Returns:
dataType
public String dataType() default ""
Defines how Functions runtime should treat the parameter value. Possible values are:
<li>
<p>"": get the value as a string, and try to deserialize to actual parameter type like POJO </p>
</li>
<li>
<p>string: always get the value as a string </p>
</li>
<li>
<p>binary: get the value as a binary data, and try to deserialize to actual parameter type byte[] </p>
</li>
Returns:
methods
public HttpMethod [] methods() default
An array of the HTTP methods to which the function responds. If not specified, the function responds to all HTTP methods.
Returns:
name
public String name()
The variable name used in function code for the request or request body.
Returns:
route
public String route() default ""
BindingName("id") int id, final ExecutionContext context ) { .... context.getLogger().info("We have " + category + " with id " + id); .... }
For more details on the route syntax, refer to the online documentation.
Returns:
Applies to
Azure SDK for Java
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기