notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/service/ssp/SSPApi.java
@Override
    public <T> ResponseEntity<T> doRequest(SSPApiRequest<T> request) throws MalformedURLException, RestClientException {
        SSPToken token = getAuthenticationToken(false);

        request.setHeader(AUTHORIZATION, token.getTokenType() + " " + token.getAccessToken());

        URL url = getSSPUrl(request.getUrlFragment(), true);
        ResponseEntity<T> response = restTemplate.exchange(url.toExternalForm(),
                request.getMethod(),
                request.getRequestEntity(),
                request.getResponseClass(),
                request.getUriParameters());
        // if we get a 401, the token may have unexpectedly expired (eg. ssp server restart).
        // Clear it, get a new token and replay the request one time.
        if (response.getStatusCode() == HttpStatus.UNAUTHORIZED) {
            token = getAuthenticationToken(true);
            request.setHeader(AUTHORIZATION, token.getTokenType() + " " + token.getAccessToken());
            return restTemplate.exchange(url.toExternalForm(),
                    request.getMethod(),
                    request.getRequestEntity(),
                    request.getResponseClass(),
                    request.getUriParameters());
        }

        return response;
    }
@Override
    public <T> ResponseEntity<T> doRequest(SSPApiRequest<T> request) throws MalformedURLException, RestClientException {
        SSPToken token = getAuthenticationToken(false);

        request.setHeader(AUTHORIZATION, token.getTokenType() + " " + token.getAccessToken());

        URL url = getSSPUrl(request.getUrlFragment(), true);
        ResponseEntity<T> response = restTemplate.exchange(url.toExternalForm(),
                request.getMethod(),
                request.getRequestEntity(),
                request.getResponseClass(),
                request.getUriParameters());
        // if we get a 401, the token may have unexpectedly expired (eg. ssp server restart).
        // Clear it, get a new token and replay the request one time.
        if (response.getStatusCode() == HttpStatus.UNAUTHORIZED) {
            token = getAuthenticationToken(true);
            request.setHeader(AUTHORIZATION, token.getTokenType() + " " + token.getAccessToken());
            return restTemplate.exchange(url.toExternalForm(),
                    request.getMethod(),
                    request.getRequestEntity(),
                    request.getResponseClass(),
                    request.getUriParameters());
        }

        return response;
    }
@ Override public < T > ResponseEntity < T > doRequest ( SSPApiRequest < T > request ) throws MalformedURLException , RestClientException { SSPToken token = getAuthenticationToken ( false ) ; request . setHeader ( AUTHORIZATION , token . getTokenType ( ) + " " + token . getAccessToken ( ) ) ; URL url = getSSPUrl ( request . getUrlFragment ( ) , true ) ; ResponseEntity < T > response = restTemplate . exchange ( url . toExternalForm ( ) , request . getMethod ( ) , request . getRequestEntity ( ) , request . getResponseClass ( ) , request . getUriParameters ( ) ) ; // if we get a 401, the token may have unexpectedly expired (eg. ssp server restart). // Clear it, get a new token and replay the request one time. if ( response . getStatusCode ( ) == HttpStatus . UNAUTHORIZED ) { token = getAuthenticationToken ( true ) ; request . setHeader ( AUTHORIZATION , token . getTokenType ( ) + " " + token . getAccessToken ( ) ) ; return restTemplate . exchange ( url . toExternalForm ( ) , request . getMethod ( ) , request . getRequestEntity ( ) , request . getResponseClass ( ) , request . getUriParameters ( ) ) ; } return response ; }
{@inheritDoc}
{