congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.jclouds.http
Code IndexAdd Tabnine to your IDE (free)

How to use org.jclouds.http

Best Java code snippets using org.jclouds.http (Showing top 20 results out of 2,304)

origin: stackoverflow.com

 import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import java.io.IOException;
import java.io.InputStream;

public class Network {

  static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport();

  public void getRequest(String reqUrl) throws IOException {
    GenericUrl url = new GenericUrl(reqUrl);
    HttpRequest request = HTTP_TRANSPORT.createRequestFactory().buildGetRequest(url);
    HttpResponse response = request.execute();
    System.out.println(response.getStatusCode());

    InputStream is = response.getContent();
    int ch;
    while ((ch = is.read()) != -1) {
      System.out.print((char) ch);
    }
    response.disconnect();
  }
}
origin: jclouds/legacy-jclouds

public static HttpResponseException returnResponseException(int code) {
 HttpResponse response = HttpResponse.builder().statusCode(code).build();
 return new HttpResponseException(new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://stub")
    .build()), response);
}
origin: jclouds/legacy-jclouds

/**
 * @see HttpRequest#getEndpoint()
 */
public T replaceQueryParam(String name, String... values) {
  endpoint = uriBuilder(endpoint).replaceQuery(name, values).build();
  return self();
}

origin: jclouds/legacy-jclouds

  HttpCommand createHttpCommandForFailureCount(final int failureCount) {
   HttpCommand command = new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://localhost").build());
   while (command.getFailureCount() != failureCount)
     command.incrementFailureCount();
   return command;
  }
}
origin: jclouds/legacy-jclouds

 public T fromHttpRequest(HttpRequest in) {
   return super.fromHttpMessage(in)
         .method(in.getMethod())
         .endpoint(in.getEndpoint())
         .filters(in.getFilters());
 }
}
origin: jclouds/legacy-jclouds

 public T fromHttpResponse(HttpResponse in) {
   return super.fromHttpMessage(in)
         .statusCode(in.getStatusCode())
         .message(in.getMessage());
 }
}
origin: jclouds/legacy-jclouds

public String apply(HttpResponse from) {
 releasePayload(from);
 String eTag = from.getFirstHeaderOrNull(ETAG);
 if (eTag == null) {
   // TODO: Cloud Files sends incorrectly cased ETag header... Remove this when fixed.
   eTag = from.getFirstHeaderOrNull("Etag");
 }
 if (eTag != null) {
   return eTag;
 }
 throw new HttpException("did not receive ETag");
}
origin: gaul/s3proxy

  return;
} catch (HttpResponseException hre) {
  HttpResponse hr = hre.getResponse();
  if (hr == null) {
    response.sendError(
    return;
  int status = hr.getStatusCode();
  switch (status) {
  case 416:
origin: jclouds/legacy-jclouds

/**
 * @see HttpRequest#getEndpoint()
 */
public T addQueryParams(Multimap<String, String> parameters) {
  endpoint = uriBuilder(endpoint).addQuery(parameters).build();
  return self();
}

origin: stackoverflow.com

URI requestURI = new URI(request.getRequestLine().getUri());
URI absoluteRequestURI = URIUtils.rewriteURI(requestURI, target, true);
uri = URIUtils.resolve(absoluteRequestURI, uri); 
origin: org.apache.jclouds/jclouds-blobstore

private static HttpResponseException returnResponseException(int code) {
 HttpResponse response = HttpResponse.builder().statusCode(code).build();
 return new HttpResponseException(new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://stub")
    .build()), response);
}
origin: jclouds/legacy-jclouds

/**
 * @see HttpRequest#getEndpoint()
 */
public T replaceQueryParam(String name, Iterable<String> values) {
  endpoint = uriBuilder(endpoint).replaceQuery(name, values).build();
  return self();
}

origin: jclouds/legacy-jclouds

/**
 * @see HttpRequest#getEndpoint()
 */
public T addQueryParam(String name, String... values) {
  endpoint = uriBuilder(endpoint).addQuery(name, values).build();
  return self();
}
origin: org.apache.jclouds/jclouds-blobstore

private static HttpResponseException returnResponseException(int code) {
 HttpResponse response = HttpResponse.builder().statusCode(code).build();
 // TODO: bogus endpoint
 return new HttpResponseException(new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://stub")
    .build()), response);
}
origin: jclouds/legacy-jclouds

/**
 * @see HttpRequest#getEndpoint()
 */
public T replaceQueryParams(Multimap<String, String> parameters) {
  endpoint = uriBuilder(endpoint).replaceQuery(parameters).build();
  return self();
}
origin: jclouds/legacy-jclouds

/**
 * @see HttpRequest#getEndpoint()
 */
public T addQueryParam(String name, Iterable<String> values) {
  endpoint = uriBuilder(endpoint).addQuery(name, values).build();
  return self();
}

origin: org.jclouds/jclouds-blobstore

public static HttpResponseException returnResponseException(int code) {
 HttpResponse response = HttpResponse.builder().statusCode(code).build();
 return new HttpResponseException(new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://stub")
    .build()), response);
}
origin: com.amysta.jclouds/jclouds-blobstore

private static HttpResponseException returnResponseException(int code) {
 HttpResponse response = HttpResponse.builder().statusCode(code).build();
 // TODO: bogus endpoint
 return new HttpResponseException(new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://stub")
    .build()), response);
}
origin: com.amysta.jclouds/jclouds-blobstore

private static HttpResponseException returnResponseException(int code) {
 HttpResponse response = HttpResponse.builder().statusCode(code).build();
 return new HttpResponseException(new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://stub")
    .build()), response);
}
origin: io.cloudsoft.jclouds/jclouds-blobstore

public static HttpResponseException returnResponseException(int code) {
 HttpResponse response = HttpResponse.builder().statusCode(code).build();
 return new HttpResponseException(new HttpCommand(HttpRequest.builder().method("GET").endpoint("http://stub")
    .build()), response);
}
org.jclouds.http

Most used classes

  • HttpRequest
    Represents a request that can be executed within HttpCommandExecutorService
  • HttpResponse
    Represents a response produced from HttpCommandExecutorService
  • HttpRequest$Builder
  • HttpCommand
  • HttpResponseException
    Represents an error obtained from an HttpResponse.
  • HttpResponse$Builder,
  • ParseSax$Factory,
  • ParseSax,
  • BackoffLimitedRetryHandler,
  • Uris$UriBuilder,
  • Uris,
  • ParseJson,
  • Queries,
  • HttpException,
  • PayloadEnclosingImpl,
  • ReturnStringIf2xx,
  • HttpRequestFilter,
  • SignatureWire,
  • GetOptions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now