Compartir a través de


HttpHeader Class

public class HttpHeader
extends Header

Represents a single header within an HTTP request or response.

This class encapsulates the name and value(s) of an HTTP header. If multiple values are associated with the same header name, they are stored in a single HttpHeader instance with values separated by commas.

It provides constructors to create an HttpHeader instance with a single value HttpHeader(String name, String value) or multiple values HttpHeader(String name, List<String> values).

This class is useful when you want to work with individual headers of an HTTP request or response.

Note: Header names are case-insensitive.

Constructor Summary

Constructor Description
HttpHeader(String name, String value)

Create an HttpHeader instance using the provided name and value.

HttpHeader(String name, List<String> values)

Create an HttpHeader instance using the provided name and values, resulting in a single HttpHeader instance with a single name and multiple values set within it.

Methods inherited from Header

Methods inherited from java.lang.Object

Constructor Details

HttpHeader

public HttpHeader(String name, String value)

Create an HttpHeader instance using the provided name and value.

Parameters:

name - the name
value - the value

HttpHeader

public HttpHeader(String name, List values)

Create an HttpHeader instance using the provided name and values, resulting in a single HttpHeader instance with a single name and multiple values set within it.

Parameters:

name - the name
values - the values

Applies to