Home  >  Article  >  Java  >  How to get cookies in java

How to get cookies in java

王林
王林Original
2020-05-21 16:33:525705browse

How to get cookies in java

Cookie concept: A small piece of text information sent by the cookie server to the browser.

We can call the request.getCookies() method to obtain an array of javax.servlet.http.Cookie objects, then traverse the array, and finally use the getName() method and getValue() method to obtain The name and value of each cookie.

(Recommended video tutorial: java video)

The specific code is:

How to get cookies in java

However, This method can only obtain cookies in its own domain, that is, cookies in the localhost domain, and cannot obtain cookies in other domains.

Recommended tutorial: Getting started with java development

The above is the detailed content of How to get cookies in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn