Class DefaultWebRequestContext

java.lang.Object
io.fluxzero.sdk.web.DefaultWebRequestContext
All Implemented Interfaces:
WebRequestContext

public class DefaultWebRequestContext extends Object implements WebRequestContext
Default implementation of WebRequestContext for Fluxzero web request messages.

This context exposes the request path, origin, and parameter sources needed by web handler resolution without depending on an external HTTP router implementation.

  • Method Details

    • getCurrentWebRequestContext

      public static DefaultWebRequestContext getCurrentWebRequestContext()
      Returns the current DefaultWebRequestContext from the active DeserializingMessage, or null if no such message is available.
    • getWebRequestContext

      public static DefaultWebRequestContext getWebRequestContext(DeserializingMessage message)
      Creates or retrieves a DefaultWebRequestContext from the given DeserializingMessage.
    • pathMap

      public Map<String,String> pathMap()
      Returns the route parameter values currently bound to this request.
    • getMetadata

      public io.fluxzero.common.api.Metadata getMetadata()
      Returns the request message metadata.
    • getUri

      public URI getUri()
      Returns the parsed request URI.
    • getPathMap

      public Map<String,String> getPathMap()
      Returns the route parameter map, equivalent to pathMap().
    • getQueryParameters

      public Map<String, List<String>> getQueryParameters()
      Returns parsed query parameter values grouped by name.
    • getCookieMap

      public Map<String,String> getCookieMap()
      Returns request cookie values indexed by cookie name.
    • getFormParameters

      public Map<String, List<String>> getFormParameters()
      Returns parsed form parameter values grouped by name, parsing the body on demand.
    • getFormParts

      public Map<String, List<WebFormPart>> getFormParts()
      Returns parsed multipart form parts grouped by name, parsing the body on demand.
    • getJsonBody

      public com.fasterxml.jackson.databind.JsonNode getJsonBody()
      Returns the JSON representation of the request body, parsing it on demand.
    • setPathMap

      public DefaultWebRequestContext setPathMap(Map<String,String> pathMap)
      Replaces route parameter bindings with a copy of the supplied map and returns this context.
    • getParameter

      public ParameterValue getParameter(String name, WebParameterSource... sources)
      Description copied from interface: WebRequestContext
      Retrieves the value of a specified parameter from the given sources in a web request.
      Specified by:
      getParameter in interface WebRequestContext
      Parameters:
      name - the name of the parameter to retrieve. Must not be null.
      sources - the sources to look for the parameter, such as PATH, QUERY, HEADER, COOKIE, or FORM. If no sources are provided, the method may default to a predefined set of sources.
      Returns:
      the ParameterValue associated with the specified parameter name and sources, or an empty ParameterValue if the parameter is not found.
    • matches

      public boolean matches(String urlPattern)
      Returns whether the request path matches the supplied route pattern.
    • matchesAny

      public boolean matchesAny(Collection<String> urlPatterns)
      Returns whether the request path matches any supplied route pattern.