HttpCookie SetCommentURL() Example

Started by VelMurugan, Dec 20, 2008, 11:12 PM

Previous topic - Next topic

VelMurugan

HttpCookie SetCommentURL() Example

Specifies a comment url that describes a cookie's purpose.

HttpCookieclass SetCommentURL() method example. This example shows you how to use SetCommentURL() method.This method Specifies a comment url that describes a cookie's purpose.

Here is the code:-

/*
* @Program that Specifies a comment url that describes a cookie's purpose.
* SetCommentURL.java
* Author:-RoseIndia Team
* Date:-25-Jun-2008
*/

import java.net.*;

public class SetCommentURL {
public static void main(String[] args) throws Exception {
        String name = "Name";
        String value = "ABC";
        HttpCookie hc = new HttpCookie(name, value);
        //comment url that describes a cookie's purpose.
        hc.setCommentURL("http://localhost:8084/ServletRequest/GetInputStream");
        // Returns the comment url describing the purpose of this cookie
       System.out.println("The comment url is :"+hc.getCommentURL());
    }
}


Output of the program:-

The comment url is :http://localhost:8084/ServletRequest/GetInputStream

Source : codingdiary