Annotation Interface HttpTrigger


@Retention(SOURCE) @Target(METHOD) public @interface HttpTrigger
Declares that a function should be exposed via an HTTP endpoint.

This annotation provides HTTP metadata such as method, path, summary, and operation ID, which can be used by code generators to configure API gateways or HTTP routing (e.g., AWS API Gateway, GCP Cloud Functions, Azure HTTP Triggers).

It is typically used in combination with Function to describe the HTTP-facing contract of a function.

Example


 @Function(name = "hello")
 @HttpTrigger(
     method = "GET",
     path = "/hello/{name}",
     summary = "Says hello",
     description = "Returns a greeting using the given name",
     operationId = "sayHello"
 )
 public String handleRequest(@PathParam("name") String name) {
     return "Hello, " + name + "!";
 }
 

Code generators may use this information to:

  • Generate OpenAPI documentation
  • Configure routing rules in serverless platforms
  • Generate client SDKs
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Constants representing attribute names of HttpTrigger.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    A longer, detailed description of the operation.
    The HTTP method to use (e.g., "GET", "POST").
    A unique identifier for the operation.
    The HTTP path to which the function is bound (e.g., "/hello/{name}").
    A short summary of the operation.
  • Element Details

    • summary

      String summary
      A short summary of the operation.

      Typically used in generated documentation.

      Returns:
      summary string
      Default:
      ""
    • description

      String description
      A longer, detailed description of the operation.

      Useful for API documentation or developer portals.

      Returns:
      description string
      Default:
      ""
    • operationId

      String operationId
      A unique identifier for the operation.

      This may be used for client SDK generation or route mapping.

      Returns:
      operation ID
      Default:
      ""
    • path

      String path
      The HTTP path to which the function is bound (e.g., "/hello/{name}").

      Supports path parameters enclosed in braces.

      Returns:
      endpoint path
      Default:
      ""
    • method

      String method
      The HTTP method to use (e.g., "GET", "POST").
      Returns:
      HTTP method
      Default:
      ""