src/main/java/org/edgegallery/appstore/infrastructure/util/AppUtil.java
public boolean isImageExist(String url, String token) {
        HttpHeaders headers = new HttpHeaders();
        headers.set("access_token", token);
        HttpEntity<String> request = new HttpEntity<>(headers);
        LOGGER.info("get images status from fileSystem, url: {}", url);
        try {
            RestTemplate restTemplate = new RestTemplate();
            ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, request, String.class);
            LOGGER.info("get image from file system status: {}", response.getStatusCode());
            return HttpStatus.OK.equals(response.getStatusCode());
        } catch (RestClientException  e) {
            LOGGER.error("get image from file system exception, Url is {}, exception {}", url, e.getMessage());
            throw new AppException("get image from file system exception.", ResponseConst.RET_IMAGE_NOT_EXIST, url);
        }
    }
/**
     * get image status by imageUrl from fileSystem.
     *
     * @param url download url
     * @param token token
     * @return boolean
     */
get image status by imageUrl from fileSystem.
@param url download url
@param token token
@return boolean
get image status by imageUrl from fileSystem . @param url download url @param token token @return boolean
public boolean isImageExist(String url, String token) {
        HttpHeaders headers = new HttpHeaders();
        headers.set("access_token", token);
        HttpEntity<String> request = new HttpEntity<>(headers);
        LOGGER.info("get images status from fileSystem, url: {}", url);
        try {
            RestTemplate restTemplate = new RestTemplate();
            ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, request, String.class);
            LOGGER.info("get image from file system status: {}", response.getStatusCode());
            return HttpStatus.OK.equals(response.getStatusCode());
        } catch (RestClientException  e) {
            LOGGER.error("get image from file system exception, Url is {}, exception {}", url, e.getMessage());
            throw new AppException("get image from file system exception.", ResponseConst.RET_IMAGE_NOT_EXIST, url);
        }
    }
public boolean isImageExist ( String url , String token ) { HttpHeaders headers = new HttpHeaders ( ) ; headers . set ( "access_token" , token ) ; HttpEntity < String > request = new HttpEntity < > ( headers ) ; LOGGER . info ( "get images status from fileSystem, url: {}" , url ) ; try { RestTemplate restTemplate = new RestTemplate ( ) ; ResponseEntity < String > response = restTemplate . exchange ( url , HttpMethod . GET , request , String . class ) ; LOGGER . info ( "get image from file system status: {}" , response . getStatusCode ( ) ) ; return HttpStatus . OK . equals ( response . getStatusCode ( ) ) ; } catch ( RestClientException e ) { LOGGER . error ( "get image from file system exception, Url is {}, exception {}" , url , e . getMessage ( ) ) ; throw new AppException ( "get image from file system exception." , ResponseConst . RET_IMAGE_NOT_EXIST , url ) ; } }
get image status by imageUrl from fileSystem.
get image status by imageUrl from fileSystem .