Javatpoint Logo
Javatpoint Logo

Java HttpCookie getPath() Method

The getPath() method of HttpCookie class is used to return the path on the server for which the browser return the cookie. The cookie will be visible to all the sub paths on the given server.

Syntax

Parameter

N.A.

Return

The above method is used to return a string which specifies the path which contains the servlet name. For e.g. - /catalog

Example 1

Test it Now

Output:

The path is given as: 189.144.22.5/user/index.html

Example 2

Test it Now

Output:

The first path is given as: 189.144.22.5/user/index1.html
The second path is given as: 145.132.19.6/client/index2.html

Example 3

Test it Now

Output:

The path is given as: null





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA