Example usage for java.net CookieHandler getClass

List of usage examples for java.net CookieHandler getClass

Introduction

In this page you can find the example usage for java.net CookieHandler getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:no.eris.applet.AppletViewer.java

private void overrideCookieHandler(CookieManager manager) {
    manager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
    final CookieHandler handler = CookieHandler.getDefault();

    LOGGER.debug("CookieStore: size {}", manager.getCookieStore().getCookies().size());
    if (cookies != null) {
        for (UriAndCookie uriAndCookie : cookies) {
            URI uri = uriAndCookie.getUri();
            HttpCookie cookie = uriAndCookie.getCookie();
            LOGGER.debug("Adding cookies: <{}> value={} secure={}",
                    new Object[] { uri, cookie, cookie.getSecure() });
            manager.getCookieStore().add(uri, cookie);
        }//w w w .  ja  v  a 2s.c  o  m
    }
    LOGGER.debug("CookieStore: size {}", manager.getCookieStore().getCookies().size());
    LOGGER.debug("Overriding cookie handler: {}", (handler == null ? null : handler.getClass().getName()));
    // FIXME because we depend on the system-wide cookie manager, we probably cannot run multiple applets at the time
    // we also maybe have some security issues lurking here...
    // I could maybe partition the callers based on the ThreadGroup ?? 
    // FIXME theres also some cleanup to do somewhere
    CookieHandler.setDefault(new LoggingCookieHandler(manager));
}