Example usage for org.apache.commons.httpclient HttpState clearCookies

List of usage examples for org.apache.commons.httpclient HttpState clearCookies

Introduction

In this page you can find the example usage for org.apache.commons.httpclient HttpState clearCookies.

Prototype

public void clearCookies()

Source Link

Usage

From source file:org.exist.xquery.modules.httpclient.ClearFunction.java

public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
    if (isCalledAs("clear-all")) {
        context.setXQueryContextVar(HTTP_MODULE_PERSISTENT_STATE, null);
    } else {/*from  w  w  w. ja v  a2 s .c o m*/
        HttpState state = (HttpState) context.getXQueryContextVar(HTTP_MODULE_PERSISTENT_STATE);

        if (state != null) {
            if (isCalledAs("clear-persistent-cookies")) {
                state.clearCookies();
            } else if (isCalledAs("clear-persistent-credentials")) {
                state.clearCredentials();
            } else if (isCalledAs("clear-persistent-proxy-credentials")) {
                state.clearProxyCredentials();
            }
        }
    }

    return (Sequence.EMPTY_SEQUENCE);
}

From source file:org.nuxeo.ecm.core.opencmis.impl.client.sso.CasClient.java

public void restoreClientContext() {
    HttpClient client = HttpURLInstaller.INSTANCE.getClient();
    HttpState state = client.getState();
    state.clearCookies();
    for (Cookie cookie : cookies) {
        state.addCookie(cookie);//from w w w  . j  a  va2s. co  m
    }
}