protected Headers getHeaders(Request request)
    {
        Headers.Builder headers = new Headers.Builder();
        MultiMap resolvedHeaders = null;
        if(headerFactory != null)
            resolvedHeaders = headerFactory.getHeaders();

        if(hasEntries(resolvedHeaders))
            resolvedHeaders = resolvedHeaders.merge(request.getHeaders());
        else
            resolvedHeaders = request.getHeaders();

        if(authorizationFactory != null)
        {
            MultiMap authEntries = authorizationFactory.getHeaders();
            if(hasEntries(authEntries))
                resolvedHeaders = resolvedHeaders.merge(authEntries);
        }

        if(resolvedHeaders.getFirst("user-agent") == null)
            headers.add("user-agent",userAgent);

        if(resolvedHeaders.getFirst(CLIENT_VERSION_HEADER_NAME) == null)
            headers.add(CLIENT_VERSION_HEADER_NAME,getClientVersion());

        for (Map.Entry<String, List<String>> entry : resolvedHeaders.entries())
        {
            for (String value : entry.getValue())
            {
                headers.add(entry.getKey(), value);
            }
        }
        return headers.build();
    }
protected Headers getHeaders ( Request request ) { Headers . Builder headers = new Headers . Builder ( ) ; MultiMap resolvedHeaders = null ; if ( headerFactory != null ) resolvedHeaders = headerFactory . getHeaders ( ) ; if ( hasEntries ( resolvedHeaders ) ) resolvedHeaders = resolvedHeaders . merge ( request . getHeaders ( ) ) ; else resolvedHeaders = request . getHeaders ( ) ; if ( authorizationFactory != null ) { MultiMap authEntries = authorizationFactory . getHeaders ( ) ; if ( hasEntries ( authEntries ) ) resolvedHeaders = resolvedHeaders . merge ( authEntries ) ; } if ( resolvedHeaders . getFirst ( "user-agent" ) == null ) headers . add ( "user-agent" , userAgent ) ; if ( resolvedHeaders . getFirst ( CLIENT_VERSION_HEADER_NAME ) == null ) headers . add ( CLIENT_VERSION_HEADER_NAME , getClientVersion ( ) ) ; for ( Map . Entry < String , List < String > > entry : resolvedHeaders . entries ( ) ) { for ( String value : entry . getValue ( ) ) { headers . add ( entry . getKey ( ) , value ) ; } } return headers . build ( ) ; }
Return the headers for the supplied request
@param request The data service request
@return The headers