HttpCookie GetPath() Example
Returns the path on the server to which the browser returns this cookie.
HttpCookieclass GetPath() method example. This example shows you how to use GetPath() method.This method
Returns the path on the server to which the browser returns this cookie.
Here is the code:-
/*
* @Program that Returns the path on the server to which the browser returns
this cookie.
* GetPath.java
* Author:-RoseIndia Team
* Date:-25-Jun-2008
*/
import java.net.*;
public class GetPath {
public static void main(String[] args) throws Exception {
String name = "Roseindia";
String value = "ABC";
HttpCookie hc = new HttpCookie(name, value);
hc.setPath("http://java.sun.com/javase/6/docs/api/");
//Returns the path on the server to which the browser returns this cookie.
System.out.println("Path to which browser returns this cookie is: "
+hc.getPath());
}
} |
Output of the program:-
| Path to which browser returns this cookie is: http://java.sun.com/javase/6/docs/api/ |
|