Class DefaultWebRequestGateway
java.lang.Object
io.fluxzero.sdk.web.DefaultWebRequestGateway
- All Implemented Interfaces:
Namespaced<WebRequestGateway>, WebRequestGateway, HasLocalHandlers
Default implementation of the
WebRequestGateway interface that delegates requests to a configured
GenericGateway. This class acts as a bridge for handling outbound web requests using Fluxzero Runtime’s proxy
mechanism.
It supports sending web requests in both asynchronous (fire-and-forget, future-based) and synchronous (blocking) manners, utilizing the underlying delegate to process the actual interactions with the Fluxzero Runtime.
- See Also:
-
Field Summary
Fields inherited from interface WebRequestGateway
defaultSettings -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the resource scoped to the default namespace.forNamespace(String namespace) Creates and returns the resource scoped to the specified namespace.send(WebRequest request, WebRequestSettings settings) Sends the given web request using given request settings and returns a future that completes with the response.sendAndForget(Guarantee guarantee, WebRequest... requests) Sends one or more web requests without waiting for a response.sendAndWait(WebRequest request, WebRequestSettings settings) Sends the given web request using the specified request settings and waits for the response synchronously.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HasLocalHandlers
hasLocalHandlers, registerHandler, registerHandler, setSelfHandlerFilterMethods inherited from interface WebRequestGateway
close, send, sendAndWait
-
Constructor Details
-
DefaultWebRequestGateway
public DefaultWebRequestGateway()
-
-
Method Details
-
sendAndForget
Description copied from interface:WebRequestGatewaySends one or more web requests without waiting for a response.Use this for fire-and-forget scenarios (e.g., async webhook posts).
- Specified by:
sendAndForgetin interfaceWebRequestGateway- Parameters:
guarantee- indicates whether to wait until the request is sent or storedrequests- the web requests to send- Returns:
- a future that completes once the requests have been sent or stored
-
send
Description copied from interface:WebRequestGatewaySends the given web request using given request settings and returns a future that completes with the response.The request must have an absolute URL to be forwarded by the Fluxzero proxy.
- Specified by:
sendin interfaceWebRequestGateway- Parameters:
request- the web request to send- Returns:
- a future completed with the
WebResponse
-
sendAndWait
Description copied from interface:WebRequestGatewaySends the given web request using the specified request settings and waits for the response synchronously.This method blocks the calling thread until the request is completed or times out.
The request must have an absolute URL to be forwarded by the Fluxzero proxy.
- Specified by:
sendAndWaitin interfaceWebRequestGateway- Parameters:
request- the web request to sendsettings- configuration settings for this request (e.g., timeouts, accepted encodings)- Returns:
- the received
WebResponse
-
forDefaultNamespace
Description copied from interface:NamespacedReturns the resource scoped to the default namespace.- Specified by:
forDefaultNamespacein interfaceNamespaced<WebRequestGateway>- Returns:
- the resource which is associated with the default namespace
-
forNamespace
Description copied from interface:NamespacedCreates and returns the resource scoped to the specified namespace.- Specified by:
forNamespacein interfaceNamespaced<WebRequestGateway>- Parameters:
namespace- the namespace to which the returned resource is scoped- Returns:
- the resource associated with the specified namespace
-