Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

How to set Cookies in HTMLPane

$
0
0
We are trying to set Cookies into HTMLPane

1. Please find the example in java.net.* API Setting a cookie value in a request:

Values must be set prior to calling the connect method (http://www.hccp.org/java-net-cookie-...tting_values):

a. Values must be set prior to calling the connect method:

URL myUrl = new URL("http://www.hccp.org/cookieTest.jsp");
URLConnection urlConn = myUrl.openConnection();

b. Create a cookie string:

String myCookie = "userId=igbrown";

c. Add the cookie to a request:
Using the setRequestProperty(String name, String value); method,
we will add a property named "Cookie",
passing the cookie string created in the previous step as the property value.

urlConn.setRequestProperty("Cookie", myCookie);

d. Send the cookie to the server:
To send the cookie, simply call connect() on the URLConnection for which we have added the cookie property:

urlConn.connect()

Please let us know how to set in SmartGWT HTMLPane
HTMLPane eWebHtmlPane = new HTMLPane();
eWebHtmlPane.setContentsType(ContentsType.PAGE);
eWebHtmlPane.setContentsURL(WebPageURL);

Viewing all articles
Browse latest Browse all 4756

Trending Articles