Hello, I was using jServer4, and the ClearCookies function was working perfectly. After updating to jServer5, however, the function no longer works. Does anyone have any suggestions on how to fix it?
The error is: java.lang.NoSuchFieldException: cookieHandler
The error is: java.lang.NoSuchFieldException: cookieHandler
ClearCookis - jServer4:
Sub ClearCookies
If HttpUtils2Service.hc.IsInitialized = False Then
HttpUtils2Service.Service_Create
End If
Log(HttpUtils2Service.hc.IsInitialized)
Dim jo As JavaObject = HttpUtils2Service.hc
Dim client As JavaObject = jo.GetField("client")
Dim jme As JavaObject = Me
Dim handler As Object = jme.RunMethod("getCookieHandler", Array(client.RunMethod("cookieJar", Null)))
Dim CookieManager As JavaObject = handler
CookieManager.RunMethodJO("getCookieStore", Null).RunMethod("removeAll", Null)
End Sub
#if JAVA
import java.lang.reflect.*;
public static Object getCookieHandler(Object o) throws Exception {
Field f = o.getClass().getDeclaredField("cookieHandler");
f.setAccessible(true);
return f.get(o);
}
#End If