Package org.springframework.http

# Class HttpCookie

java.lang.Object
org.springframework.http.HttpCookie

Direct Known Subclasses:
  `ResponseCookie`

public class HttpCookie extends Object
Represents an HTTP cookie as a name-value pair consistent with the content of the "Cookie" request header. The `ResponseCookie` subclass has the additional attributes expected in the "Set-Cookie" response header.

Since:
  5.0
Author:
  Rossen Stoyanchev
See Also:
  - RFC 6265

## Constructor Summary

Constructors
Constructor
Description
`HttpCookie(String name, String value)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object other)`
`String`
`getName()`
Return the cookie name.
`String`
`getValue()`
Return the cookie value or an empty string (never `null`).
`int`
`hashCode()`
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### HttpCookie

public HttpCookie(String name, @Nullable String value)

## Method Details

### getName

public String getName()
Return the cookie name.

### getValue

public String getValue()
Return the cookie value or an empty string (never `null`).

### equals

public boolean equals(@Nullable Object other)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### toString

public String toString()

Overrides:
  `toString` in class `Object`