Class PanamaWasiHttpContext

java.lang.Object
ai.tegmentum.wasmtime4j.panama.wasi.http.PanamaWasiHttpContext
All Implemented Interfaces:
ai.tegmentum.wasmtime4j.wasi.http.WasiHttpContext, Closeable, AutoCloseable

public final class PanamaWasiHttpContext extends Object implements ai.tegmentum.wasmtime4j.wasi.http.WasiHttpContext
Panama implementation of WasiHttpContext.

This class wraps the native WASI HTTP context and provides HTTP capabilities to WebAssembly modules. It manages the lifecycle of the native context and ensures proper resource cleanup.

  • Constructor Details

    • PanamaWasiHttpContext

      public PanamaWasiHttpContext(ai.tegmentum.wasmtime4j.wasi.http.WasiHttpConfig config) throws ai.tegmentum.wasmtime4j.exception.WasmException
      Creates a new PanamaWasiHttpContext with the specified configuration.
      Parameters:
      config - the HTTP configuration
      Throws:
      ai.tegmentum.wasmtime4j.exception.WasmException - if the context cannot be created
      IllegalArgumentException - if config is null
  • Method Details

    • getConfig

      public ai.tegmentum.wasmtime4j.wasi.http.WasiHttpConfig getConfig()
      Specified by:
      getConfig in interface ai.tegmentum.wasmtime4j.wasi.http.WasiHttpContext
    • isValid

      public boolean isValid()
      Specified by:
      isValid in interface ai.tegmentum.wasmtime4j.wasi.http.WasiHttpContext
    • isHostAllowed

      public boolean isHostAllowed(String host)
      Specified by:
      isHostAllowed in interface ai.tegmentum.wasmtime4j.wasi.http.WasiHttpContext
    • getStats

      public ai.tegmentum.wasmtime4j.wasi.http.WasiHttpStats getStats()
      Specified by:
      getStats in interface ai.tegmentum.wasmtime4j.wasi.http.WasiHttpContext
    • resetStats

      public void resetStats()
      Specified by:
      resetStats in interface ai.tegmentum.wasmtime4j.wasi.http.WasiHttpContext
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface ai.tegmentum.wasmtime4j.wasi.http.WasiHttpContext
    • toString

      public String toString()
      Overrides:
      toString in class Object