Example usage for java.net CookieHandler toString

List of usage examples for java.net CookieHandler toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.blackducksoftware.integration.hub.rest.RestConnection.java

public void handleRequest(final ClientResource resource) throws BDRestException {
    final boolean debugLogging = isDebugLogging();
    if (debugLogging) {
        logMessage(LogLevel.TRACE, "Resource : " + resource.toString());
        logRestletRequestOrResponse(resource.getRequest());
    }/*from  www.j  a va 2s  . c  om*/

    final CookieHandler originalCookieHandler = CookieHandler.getDefault();
    try {
        if (originalCookieHandler != null) {
            if (debugLogging) {
                logMessage(LogLevel.TRACE, "Setting Cookie Handler to NULL");
            }
            CookieHandler.setDefault(null);
        }
        resource.handle();
    } catch (final ResourceException e) {
        throw new BDRestException("Problem connecting to the Hub server provided.", e, resource);
    } finally {
        if (originalCookieHandler != null) {
            if (debugLogging) {
                logMessage(LogLevel.TRACE,
                        "Setting Original Cookie Handler : " + originalCookieHandler.toString());
            }
            CookieHandler.setDefault(originalCookieHandler);
        }
    }

    if (debugLogging) {
        logRestletRequestOrResponse(resource.getResponse());
        logMessage(LogLevel.TRACE, "Status Code : " + resource.getResponse().getStatus().getCode());
    }
}