HttpCookie SetPortlist() Example

Specify the portlist of the cookie


HttpCookieclass SetPortlist() method example. This example shows you how to use SetPortlist() method.This method Specify the portlist of the cookie, which restricts the port(s) to which a cookie may be sent back in a Cookie header.

Here is the code:-
/* 
 * @Program that Specify the portlist of the cookie
 * SetPortlist.java 
 * Author:-RoseIndia Team
 * Date:-25-Jun-2008
 */

import java.net.*;

public class SetPortlist {
public static void main(String[] argsthrows Exception {
        String name = "Roseindia";
        String value = "ABC";
        HttpCookie hc = new HttpCookie(name, value);
         //Return the port list attribute of the cookie
        System.out.println("Port list is: "+hc.getPortlist());
        //Specify the portlist of the cookie
        hc.setPortlist("8080");
        System.out.println("Port list is: "+hc.getPortlist());
    }

}

Output of the program:-
 Port list is: null
Port list is: 8080

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US