Developing an HTTP Function Using Java
This section describes how to develop an HTTP function using Java. For details about HTTP function, see Creating an HTTP Function.
Constraints
- HTTP functions can only use APIG or APIC triggers.
According to the forwarding protocol between FunctionGraph and APIG/APIC, a valid HTTP function response must contain body(String), statusCode(int), headers(Map), and isBase64Encoded(boolean). By default, the response is encoded using Base64. The default value of isBase64Encoded is true. The same applies to other frameworks. For details, see Base64 Decoding and Return Structure.
- By default, port 8000 is enabled for HTTP functions.
- Table 15 describes the context methods provided by FunctionGraph.
Example of Using Java to Develop an HTTP Function
Overview
Usually, you may build Spring Boot applications using SpringInitializr or IntelliJ IDEA. This chapter uses the Spring.io project in https://spring.io/guides/gs/rest-service/ as an example to deploy an HTTP function on FunctionGraph.
Procedure
This example describes how to use an existing Spring Boot project to build an HTTP function and deploy services on FunctionGraph.
For details, see Building an HTTP Function with Spring Boot.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot