> For the complete documentation index, see [llms.txt](https://docs.servoy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.servoy.com/reference/servoyextensions/server-plugins/http/cookie.md).

# Cookie

## Overview

The `Cookie` class provides Servoy developers with methods for performing basic cookie operations. It allows retrieving details about cookies, including their name, value, domain, path, and secure attribute.

## Functionality

This class offers methods to access essential properties of a cookie. Developers can retrieve the cookie’s domain, name, and path to understand its scope and access the value stored within the cookie. Additionally, it provides the ability to check whether the cookie is marked as secure, ensuring that it is transmitted over secure protocols.

## Methods Summarized

| Type                                                       | Name                      | Summary                              |
| ---------------------------------------------------------- | ------------------------- | ------------------------------------ |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [getDomain()](#getdomain) | Returns the cookie domain.           |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [getName()](#getname)     | Returns the cookie name.             |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [getPath()](#getpath)     | Returns the cookie path.             |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) | [getSecure()](#getsecure) | Returns the cookie secure attribute. |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [getValue()](#getvalue)   | Returns the cookie value.            |

## Methods Detailed

### getDomain()

Returns the cookie domain.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) the value of the cookie, or an empty string if the cookie is null.

**Sample**

```js
var cookie = client.getCookie('cookieName')
var domain = cookie.getDomain();
```

### getName()

Returns the cookie name.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) the name of the cookie, or an empty string if the cookie is null.

**Sample**

```js
var cookie = client.getCookie('cookieName')
var name = cookie.getName();
```

### getPath()

Returns the cookie path.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) the path of the cookie, or an empty string if the cookie is null.

**Sample**

```js
var cookie = client.getCookie('cookieName')
var path = cookie.getPath();
```

### getSecure()

Returns the cookie secure attribute.

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) true if the cookie is marked as secure, false otherwise or if the cookie is null.

**Sample**

```js
var cookie = client.getCookie('cookieName')
var path = cookie.getSecure();
```

### getValue()

Returns the cookie value.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) the value of the cookie, or an empty string if the cookie is null.

**Sample**

```js
var cookie = client.getCookie('cookieName')
var value = cookie.getValue();
```

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.servoy.com/reference/servoyextensions/server-plugins/http/cookie.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
