Help Center/ FunctionGraph/ Developer Guide/ Java/ Developing an HTTP Function Using Java
Updated on 2025-12-10 GMT+08:00

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.