response.setDateHeader("Last-Modified", file.getModified()); && file.getModified() <= file.getResourceStoreRequest().getIfModifiedSince()) {
public void calculateArtifactUsage(StorageFileItem item) throws IOException { if (getLogger().isDebugEnabled()) { getLogger().debug( "Calculating usage of " + item.getRepositoryItemUid().getPath()); } // don't bother if the file hasn't changed since // the last time it was processed if (this.artifactUsageStore.isAlreadyCalculated(item .getRepositoryItemUid().getPath(), item.getModified())) { return; } // convert to a Maven project GAV artifact = getArtifactForStorageItem(item); if (artifact != null) { artifactUsageStore.addDependencies(artifact, dependencyResolver .resolveDependencies(artifact), item.getRepositoryItemUid() .getPath()); } }
long modified = localItem.getModified(); outdated = false; for (StorageItem item : items) {
@VisibleForTesting Representation renderStorageFileItem(final Request req, final StorageFileItem file) throws ResourceException { final StorageFileItemRepresentation fileRepresentation = new StorageFileItemRepresentation(file); if (file.getResourceStoreRequest().getIfModifiedSince() != 0 && file.getModified() <= file.getResourceStoreRequest().getIfModifiedSince()) { // this is a conditional GET using time-stamp throw new ResourceException(Status.REDIRECTION_NOT_MODIFIED, "Resource is not modified."); } else if (file.getResourceStoreRequest().getIfNoneMatch() != null && fileRepresentation.getTag() != null && file.getResourceStoreRequest().getIfNoneMatch().equals(fileRepresentation.getTag().getName())) { // this is a conditional GET using ETag throw new ResourceException(Status.REDIRECTION_NOT_MODIFIED, "Resource is not modified."); } else { return fileRepresentation; } }
if ( file.getModified() > req.getConditions().getModifiedSince().getTime() )
@Override public void retrieve(SpecsIndexFile specs) { log.debug("retrieve :: {}", specs); SpecsIndexZippedFile source = specs.zippedSpecsIndexFile(); try { StorageFileItem item = (StorageFileItem) repository.retrieveDirectItem(new ResourceStoreRequest(source.storagePath())); DefaultStorageFileItem unzippedItem = new DefaultStorageFileItem(repository, new ResourceStoreRequest(specs.storagePath()), true, false, gunzipContentLocator(item)); unzippedItem.setModified(item.getModified()); specs.set(unzippedItem); } catch (ItemNotFoundException e) { specs.markAsNotExists(); } catch (IOException | IllegalOperationException e) { specs.setException(e); } }
resource.setLastChanged( fileItem.getModified() ); resource.setSize( fileItem.getLength() ); resource.setUploaded( fileItem.getCreated() );
resource.setMd5Hash(fileItem.getRepositoryItemAttributes().get(DigestCalculatingInspector.DIGEST_MD5_KEY)); resource.setSha1Hash(checksum); resource.setLastChanged(fileItem.getModified()); resource.setSize(fileItem.getLength()); resource.setUploaded(fileItem.getCreated());