Package org.jclouds.io.payloads.Part

Examples of org.jclouds.io.payloads.Part.PartOptions


   private static List<Part> getParts(Invocation invocation, Multimap<String, ?> tokenValues) {
      ImmutableList.Builder<Part> parts = ImmutableList.<Part> builder();
      for (Parameter param : parametersWithAnnotation(invocation.getInvokable(), PartParam.class)) {
         PartParam partParam = param.getAnnotation(PartParam.class);
         PartOptions options = new PartOptions();
         if (!PartParam.NO_CONTENT_TYPE.equals(partParam.contentType()))
            options.contentType(partParam.contentType());
         if (!PartParam.NO_FILENAME.equals(partParam.filename()))
            options.filename(replaceTokens(partParam.filename(), tokenValues));
         Object arg = invocation.getArgs().get(param.hashCode());
         checkNotNull(arg, partParam.name());
         Part part = Part.create(partParam.name(), newPayload(arg), options);
         parts.add(part);
      }
View Full Code Here


   private static List<Part> getParts(Invocation invocation, Multimap<String, ?> tokenValues) {
      ImmutableList.Builder<Part> parts = ImmutableList.<Part> builder();
      for (Parameter param : parametersWithAnnotation(invocation.getInvokable(), PartParam.class)) {
         PartParam partParam = param.getAnnotation(PartParam.class);
         PartOptions options = new PartOptions();
         if (!PartParam.NO_CONTENT_TYPE.equals(partParam.contentType()))
            options.contentType(partParam.contentType());
         if (!PartParam.NO_FILENAME.equals(partParam.filename()))
            options.filename(replaceTokens(partParam.filename(), tokenValues));
         Object arg = invocation.getArgs().get(param.hashCode());
         checkNotNull(arg, partParam.name());
         Part part = Part.create(partParam.name(), newPayload(arg), options);
         parts.add(part);
      }
View Full Code Here

   }

   private Part newPart(String data) {
      return Part.create("file", new MockFilePayload(data),
            new PartOptions().contentType(PLAIN_TEXT_UTF_8.withoutParameters().toString()));
   }
View Full Code Here

      checkArgument(checkNotNull(input, "input") instanceof Blob, "this binder is only valid for Blobs!");
      checkNotNull(request, "request");
      Blob blob = Blob.class.cast(input);

      Part part = Part.create(blob.getMetadata().getName(), blob.getPayload(),
            new PartOptions().contentType(blob.getMetadata().getContentMetadata().getContentType()));

      request.setPayload(new MultipartForm(part));
      return request;
   }
View Full Code Here

   private static List<Part> getParts(Invocation invocation, Multimap<String, ?> tokenValues) {
      ImmutableList.Builder<Part> parts = ImmutableList.<Part> builder();
      for (Parameter param : parametersWithAnnotation(invocation.getInvokable(), PartParam.class)) {
         PartParam partParam = param.getAnnotation(PartParam.class);
         PartOptions options = new PartOptions();
         if (!PartParam.NO_CONTENT_TYPE.equals(partParam.contentType()))
            options.contentType(partParam.contentType());
         if (!PartParam.NO_FILENAME.equals(partParam.filename()))
            options.filename(replaceTokens(partParam.filename(), tokenValues));
         Object arg = invocation.getArgs().get(param.hashCode());
         checkNotNull(arg, partParam.name());
         Part part = Part.create(partParam.name(), newPayload(arg), options);
         parts.add(part);
      }
View Full Code Here

   }

   private Part newPart(String data) {
      return Part.create("file", new MockFilePayload(data),
            new PartOptions().contentType(PLAIN_TEXT_UTF_8.withoutParameters().toString()));
   }
View Full Code Here

      checkArgument(checkNotNull(input, "input") instanceof Blob, "this binder is only valid for Blobs!");
      checkNotNull(request, "request");
      Blob blob = Blob.class.cast(input);

      Part part = Part.create(blob.getMetadata().getName(), blob.getPayload(),
            new PartOptions().contentType(blob.getMetadata().getContentMetadata().getContentType()));

      request.setPayload(new MultipartForm(part));
      return request;
   }
View Full Code Here

   private static List<Part> getParts(Invocation invocation, Multimap<String, ?> tokenValues) {
      ImmutableList.Builder<Part> parts = ImmutableList.<Part> builder();
      for (Parameter param : parametersWithAnnotation(invocation.getInvokable(), PartParam.class)) {
         PartParam partParam = param.getAnnotation(PartParam.class);
         PartOptions options = new PartOptions();
         if (!PartParam.NO_CONTENT_TYPE.equals(partParam.contentType()))
            options.contentType(partParam.contentType());
         if (!PartParam.NO_FILENAME.equals(partParam.filename()))
            options.filename(replaceTokens(partParam.filename(), tokenValues));
         Object arg = invocation.getArgs().get(param.hashCode());
         checkNotNull(arg, partParam.name());
         Part part = Part.create(partParam.name(), newPayload(arg), options);
         parts.add(part);
      }
View Full Code Here

   private static List<Part> getParts(Invocation invocation, Multimap<String, ?> tokenValues) {
      ImmutableList.Builder<Part> parts = ImmutableList.<Part> builder();
      for (Parameter param : parametersWithAnnotation(invocation.getInvokable(), PartParam.class)) {
         PartParam partParam = param.getAnnotation(PartParam.class);
         PartOptions options = new PartOptions();
         if (!PartParam.NO_CONTENT_TYPE.equals(partParam.contentType()))
            options.contentType(partParam.contentType());
         if (!PartParam.NO_FILENAME.equals(partParam.filename()))
            options.filename(replaceTokens(partParam.filename(), tokenValues));
         Object arg = invocation.getArgs().get(param.hashCode());
         checkNotNull(arg, partParam.name());
         Part part = Part.create(partParam.name(), newPayload(arg), options);
         parts.add(part);
      }
View Full Code Here

      checkArgument(checkNotNull(input, "input") instanceof Blob, "this binder is only valid for Blobs!");
      checkNotNull(request, "request");
      Blob blob = Blob.class.cast(input);

      Part part = Part.create(blob.getMetadata().getName(), blob.getPayload(),
            new PartOptions().contentType(blob.getMetadata().getContentMetadata().getContentType()));

      request.setPayload(new MultipartForm(part));
      return request;
   }
View Full Code Here

TOP

Related Classes of org.jclouds.io.payloads.Part.PartOptions

Copyright © 2018 www.massapicom. 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.