Class HttpHeaders
java.lang.Object
com.bobocode.bring.web.servlet.http.HttpHeaders
The HttpHeaders class represents a collection of HTTP headers.
It provides methods to manage and retrieve header information.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumeration containing common HTTP header names. -
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructs a new HttpHeaders object with an empty header map and initializes the list of header names. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the value of a specific header.Retrieves a list of all available header names.Retrieves the header name-value pairs.Retrieves a list of all header names.void
Sets a single header with a specific value.void
Sets a single header with multiple values, comma-separated.private String
toCommaDelimitedString
(List<String> headerValues) Converts a list of header values to a comma-separated string.
-
Field Details
-
headers
Map to store header name-value pairs. -
headersNameList
List containing all header names as strings.
-
-
Constructor Details
-
HttpHeaders
public HttpHeaders()Constructs a new HttpHeaders object with an empty header map and initializes the list of header names.
-
-
Method Details
-
getHeaders
Retrieves the header name-value pairs.- Returns:
- A map containing header name-value pairs.
-
getHeadersNameList
Retrieves a list of all header names.- Returns:
- A list containing all header names.
-
set
Sets a single header with a specific value.- Parameters:
headerName
- The name of the header to set.headerValue
- The value of the header.
-
set
Sets a single header with multiple values, comma-separated.- Parameters:
headerName
- The name of the header to set.headerValues
- A list of values for the header.
-
get
Retrieves the value of a specific header.- Parameters:
headerName
- The name of the header to retrieve.- Returns:
- The value of the specified header.
-
getAllHeadersNames
Retrieves a list of all available header names.- Returns:
- A list containing all available header names.
-
toCommaDelimitedString
Converts a list of header values to a comma-separated string.- Parameters:
headerValues
- A list of header values.- Returns:
- A comma-separated string containing all header values.
-