Examples of PreparedContentLocator


Examples of org.sonatype.nexus.proxy.item.PreparedContentLocator

    catch (ItemNotFoundException e) {
      throw new AccessDeniedException(request, e.getMessage());
    }

    DefaultStorageFileItem fItem =
        new DefaultStorageFileItem(this, request, true, true, new PreparedContentLocator(is,
            getMimeSupport().guessMimeTypeFromPath(getMimeRulesSource(), request.getRequestPath()),
            ContentLocator.UNKNOWN_LENGTH));

    if (userAttributes != null) {
      fItem.getRepositoryItemAttributes().putAll(userAttributes);
View Full Code Here

Examples of org.sonatype.nexus.proxy.item.PreparedContentLocator

                  request.getRequestPath());
        }

        final long entityLength = httpResponse.getEntity().getContentLength();
        final DefaultStorageFileItem httpItem =
            new DefaultStorageFileItem(repository, request, CAN_READ, CAN_WRITE, new PreparedContentLocator(
                is, mimeType, entityLength != -1 ? entityLength : ContentLocator.UNKNOWN_LENGTH));

        httpItem.setRemoteUrl(remoteURL.toString());
        httpItem.setModified(makeDateFromHeader(httpResponse.getFirstHeader("last-modified")));
        httpItem.setCreated(httpItem.getModified());
View Full Code Here

Examples of org.sonatype.nexus.proxy.item.PreparedContentLocator

          // The remote repository is a SimpleArtifactRepository with mirrors configured
          log.debug(
              "Repository " + getId() + ": configureMirrors: found single mirrors URL=" + mirrorsURL);
          final StorageFileItem remoteMirrorsItem = getMirrorsItemRemote(mirrorsURL);
          final ContentLocator content =
              new PreparedContentLocator(((StorageFileItem) remoteMirrorsItem).getInputStream(),
                  "text/xml", remoteMirrorsItem.getLength());
          mirrorsItem =
              new DefaultStorageFileItem(this, new ResourceStoreRequest(PRIVATE_MIRRORS_PATH),
                  true /* isReadable */, false /* isWritable */, content);
          mirrorsItem = doCacheItem(mirrorsItem);
View Full Code Here

Examples of org.sonatype.nexus.proxy.item.PreparedContentLocator

                               final String mimeType, final Map<String, String> userAttributes)
      throws Exception
  {
    final DefaultStorageFileItem fItem =
        new DefaultStorageFileItem(repository, request, true, true,
            new PreparedContentLocator(in, mimeType, ContentLocator.UNKNOWN_LENGTH));

    if (userAttributes != null) {
      fItem.getRepositoryItemAttributes().putAll(userAttributes);
    }
View Full Code Here

Examples of org.sonatype.nexus.proxy.item.PreparedContentLocator

    DefaultStorageFileItem item = new DefaultStorageFileItem(
        repository,
        new ResourceStoreRequest("/" + path),
        true,
        true,
        new PreparedContentLocator(new ByteArrayInputStream(content), mimeType, ContentLocator.UNKNOWN_LENGTH)
    );

    repository.storeItem(false, item);
  }
View Full Code Here

Examples of org.sonatype.nexus.proxy.item.PreparedContentLocator

      final File baseUrl = new File("target");
      when(repository.getLocalUrl()).thenReturn(baseUrl.toURI().toURL().toString());
      final LocalStorageContext localStorageContext = new DefaultLocalStorageContext(null);
      when(repository.getLocalStorageContext()).thenReturn(localStorageContext);

      final PreparedContentLocator pcl = new PreparedContentLocator(preparedStream, "text/plain", ContentLocator.UNKNOWN_LENGTH);

      final DefaultStorageFileItem file =
          new DefaultStorageFileItem(repository, new ResourceStoreRequest("/some/file.txt"), true, true, pcl);

      testSubject.storeItem(repository, file);
View Full Code Here

Examples of org.sonatype.nexus.proxy.item.PreparedContentLocator

      final LocalStorageContext localStorageContext = new DefaultLocalStorageContext(null);
      when(repository.getLocalStorageContext()).thenReturn(localStorageContext);

      when(repository.getLocalUrl()).thenThrow(new RuntimeException("Something unexpected!"));

      final PreparedContentLocator pcl = new PreparedContentLocator(preparedStream, "text/plain", ContentLocator.UNKNOWN_LENGTH);

      final DefaultStorageFileItem file =
          new DefaultStorageFileItem(repository, new ResourceStoreRequest("/some/file.txt"), true, true, pcl);

      try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.