Package io.fluxcapacitor.javaclient.web
Interface WebRequestContext
- All Known Implementing Classes:
DefaultWebRequestContext
public interface WebRequestContext
Interface representing a context for handling web requests. It provides methods for accessing parameter values
from various sources such as path, query, form, headers, and cookies.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ParameterValue
getCookieParameter
(String name) Retrieves a parameter value from the cookie source using the specified parameter name.default ParameterValue
getFormParameter
(String name) Retrieves the value of a form parameter from the web request context.default ParameterValue
getHeaderParameter
(String name) Retrieves the value of a parameter from the HTTP request headers by its name.default ParameterValue
getParameter
(String name) Retrieves the value of a parameter from the web request.getParameter
(String name, WebParameterSource... sources) Retrieves the value of a specified parameter from the given sources in a web request.default ParameterValue
getPathParameter
(String name) Retrieves the value of a parameter from the path section of the web request.default ParameterValue
getQueryParameter
(String name) Retrieves the value of a query parameter from the web request.
-
Method Details
-
getParameter
Retrieves the value of a specified parameter from the given sources in a web request.- 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 emptyParameterValue
if the parameter is not found.
-
getParameter
Retrieves the value of a parameter from the web request. This method searches for the specified parameter in the default parameter sources: path, query, and form data.- Parameters:
name
- the name of the parameter to retrieve- Returns:
- the value of the parameter, wrapped in a
ParameterValue
, ornull
if the parameter is not found
-
getPathParameter
Retrieves the value of a parameter from the path section of the web request.- Parameters:
name
- the name of the parameter to retrieve from the path.- Returns:
- the
ParameterValue
associated with the specified parameter name, ornull
if the parameter is not present in the path.
-
getQueryParameter
Retrieves the value of a query parameter from the web request.- Parameters:
name
- the name of the query parameter to retrieve- Returns:
- the
ParameterValue
representing the value of the query parameter, ornull
if the parameter is not present
-
getHeaderParameter
Retrieves the value of a parameter from the HTTP request headers by its name.- Parameters:
name
- the name of the parameter to retrieve from the header- Returns:
- the value of the header parameter wrapped in a
ParameterValue
, ornull
if not found
-
getCookieParameter
Retrieves a parameter value from the cookie source using the specified parameter name.- Parameters:
name
- the name of the cookie parameter to retrieve- Returns:
- the value of the specified cookie parameter wrapped in a
ParameterValue
object
-
getFormParameter
Retrieves the value of a form parameter from the web request context.- Parameters:
name
- the name of the form parameter to retrieve.- Returns:
- the value of the form parameter as a
ParameterValue
, ornull
if the parameter is not present in the form source.
-