uCosminexus Application Server, Web Service Development Guide
![[Contents]](FIGURE/CONTENT.GIF)
![[Glossary]](FIGURE/GLOSS.GIF)
![[Index]](FIGURE/INDEX.GIF)
![[Back]](FIGURE/FRONT.GIF)
cookie(Cookie cookie) method
Description
This method sets a Cookie.
Syntax
public WebResource.Builder cookie(Cookie cookie)
Parameter
- cookie
- This is the Cookie to be specified.
Return value
The method returns a builder (WebResource.Builder object) to set up the WebResource object.
Notes
- A non-null value is added in the Cookie HTTP header. A null value is ignored and is not added in the Cookie HTTP header.
- The value returned by the toString() method of the Cookie object is set in the Cookie HTTP header. The JAX-RS engine does not validate the values returned by the toString() method. Specify the value according to the standard specifications.
- You can also use the following methods to add the value of the Cookie HTTP header:
- ClientRequest.Builder class
cookie(Cookie cookie) method
header(String name, Object value) method
- WebResource class
header(String name, Object value) method
- WebResource.Builder class
cookie(Cookie cookie) method
header(String name, Object value) method
The operation when no Cookie is added with these methods and the cookie(Cookie cookie) method is the same as the operation when the Cookie HTTP header is not added in the HttpURLConnection object before performing HTTP communication.
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.