Example usage for org.apache.http.client UserTokenHandler UserTokenHandler

List of usage examples for org.apache.http.client UserTokenHandler UserTokenHandler

Introduction

In this page you can find the example usage for org.apache.http.client UserTokenHandler UserTokenHandler.

Prototype

UserTokenHandler

Source Link

Usage

From source file:org.apache.olingo.samples.client.core.http.StatefulHttpClientFactory.java

@Override
public DefaultHttpClient create(final HttpMethod method, final URI uri) {
    final DefaultHttpClient httpClient = super.create(method, uri);

    httpClient.setUserTokenHandler(new UserTokenHandler() {

        @Override//from ww w .j a  v  a 2s.  c om
        public Object getUserToken(final HttpContext context) {
            return context.getAttribute("my-token");
        }

    });

    return httpClient;
}