Code example for HttpUriRequest

Methods: setHeader

    private void configureRequest(HttpUriRequest req) {
        if (httpUserAgent != null) {
            req.setHeader(HTTP.USER_AGENT, httpUserAgent);
    private String getAuthToken() throws AppEngineAuthenticationException {
        // get an authentication token from the AccountManager: 
        // this call is asynchronous, as the user may not respond immediately 
        final AccountManagerFuture<Bundle> futureBundle = accountManager.getAuthToken(account,
            "ah", true, null, null); 
        final Bundle authBundle;
        try { 
            authBundle = futureBundle.getResult();
        } catch (OperationCanceledException e) {
            throw new AppEngineAuthenticationException(AUTHENTICATION_UNAVAILABLE, e);
        } catch (AuthenticatorException e) {
Connect your IDE to all the code out there  Get Codota for Java