Package opendap.dap.http

Examples of opendap.dap.http.HTTPMethod.execute()


      return result;

    HTTPMethod method = null;
    try {
      method = session.newMethodHead(location);
      int statusCode = method.execute();
      if (statusCode >= 300) {
        if (statusCode == 401)
          throw new IOException("Unauthorized to open dataset " + location);
        else
          throw new IOException(location + " is not a valid URL, return status=" + statusCode);
View Full Code Here


    try {
      // For some reason, the head method is not using credentials
      // method = session.newMethodHead(location + ".dds");
      method = session.newMethodGet(location + ".dds");

      int status = method.execute();
      if (status == 200) {
        Header h = method.getResponseHeader("Content-Description");
        if ((h != null) && (h.getValue() != null)) {
          String v = h.getValue();
          if (v.equalsIgnoreCase("dods-dds") || v.equalsIgnoreCase("dods_dds"))
View Full Code Here

    HTTPSession useSession = session;
    try {
      if (useSession == null)
        useSession = new HTTPSession();
      HTTPMethod m = useSession.newMethodGet(urlString);
      m.execute();
      return m.getResponseAsString();
    } finally {
      if ((session == null) && (useSession != null))
        useSession.close();
    }
View Full Code Here

      session = new HTTPSession();
      HTTPMethod m = session.newMethodPut(urlString);

      m.setRequestContentAsString(content);

      m.execute();

      int resultCode = m.getStatusCode();

      // followRedirect wont work for PUT
      if (resultCode == 302) {
View Full Code Here

      HTTPMethod m = useSession.newMethodGet(urlString);
      m.setFollowRedirects(true);
      m.setRequestHeader("Accept-Encoding", "gzip,deflate");

      int status = m.execute();
      if (status != 200) {
        throw new RuntimeException("failed status = " + status);
      }

      String charset = m.getResponseCharSet();
View Full Code Here

        useSession = new HTTPSession();

      HTTPMethod m = useSession.newMethodGet(urlString);
      m.setRequestHeader("Accept-Encoding", "gzip,deflate");

      int status = m.execute();

      if (status != 200) {
        throw new RuntimeException("failed status = " + status);
      }
View Full Code Here

      HTTPMethod m = useSession.newMethodGet(urlString);
      m.setRequestHeader("Accept-Encoding", "gzip,deflate");
      m.setRequestHeader("Range", "bytes=" + start + "-" + end);

      int status = m.execute();
      if ((status != 200) && (status != 206)) {
        throw new RuntimeException("failed status = " + status);
      }

      String charset = m.getResponseCharSet();
View Full Code Here

    session.setSoTimeout( this.socketTimeout );
    HTTPMethod method = session.newMethodGet( uri.toString() );
    method.setFollowRedirects( this.followRedirects );
    method.setRequestHeader( "Accept-Encoding", this.contentEncoding );

   method.execute();
    int statusCode = method.getStatusCode();
    if ( statusCode == 200 || statusCode == 201 )
    {
      return method;
    }
View Full Code Here

    try {
      String url = remoteURI + "?req=header";
      method = httpClient.newMethodGet(url);
      method.setFollowRedirects(true);
      if (showRequest) System.out.printf("CdmRemote request %s %n", url);
      int statusCode = method.execute();

      if (statusCode == 404)
        throw new FileNotFoundException(method.getURI() + " " + method.getStatusLine());

      if (statusCode >= 300)
View Full Code Here

      System.out.println(" CdmRemote data request for variable: " + v.getFullName() + " section= " + section + " url=" + sbuff);

    HTTPMethod method = null;
    try {
      method = httpClient.newMethodGet(sbuff.toString());
      int statusCode = method.execute();

      if (statusCode == 404)
        throw new FileNotFoundException(method.getPath() + " " + method.getStatusLine());

      if (statusCode >= 300)
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.