HttpCookie GetSecure() Example

Returns true if the browser is sending cookies only over a secure protocol,


HttpCookieclass GetSecure() method example. This example shows you how to use GetSecure() method.This method Returns true if the browser is sending cookies only over a secure protocol,

Here is the code:-
/* 
 * @Program that Returns true if the browser is sending cookies only over a 
    secure protocol
 * GetSecure.java 
 * Author:-RoseIndia Team
 * Date:-25-Jun-2008
 */

import java.net.*;

public class GetSecure {

    public static void main(String[] argsthrows Exception {
        String name = "Roseindia";
        String value = "ABC";
        HttpCookie hc = new HttpCookie(name, value);
        hc.setSecure(true);
        // Returns true if the browser is sending cookies only over a secure protocol
        System.out.println("Browser is sending cookies: "+hc.getSecure());
    }
}

Output of the program:-
 Browser is sending cookies: true

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

HOME | COPYRIGHT | CONTACT US