Package java.net

Examples of java.net.HttpURLConnection.disconnect()


        fail(response);
        throw new RuntimeException(response);
      }
    }
    finally {
      conn.disconnect();
    }
  }
}
View Full Code Here


    }
    oStm.close();
  } else {
    throw new IOException(String.valueOf(responseCode));
  }
  oCon.disconnect();
  return oRetVal;
  } // post

  // ------------------------------------------------------------------------
View Full Code Here

    }
    oStm.close();
  } else {
    throw new IOException(String.valueOf(responseCode));
  }
  oCon.disconnect();
  return oRetVal;
  } // post

}
View Full Code Here

        break;
        default:
            throw new IOException("Invalid HTTP response Code "+String.valueOf(iStatusCode));
      } // end switch 
   
    oCon.disconnect();

    if (DebugFile.trace) {
      DebugFile.decIdent();
      DebugFile.writeln("End SMSPushRealidadFutura.push() : " + oRsp.toString());
    }
View Full Code Here

  } else if (sSourceURI.startsWith("http://")) {
    try {
        URL oUrl = new URL(sSourceURI);
      HttpURLConnection oCon = (HttpURLConnection) oUrl.openConnection();
      int iResponseCode = oCon.getResponseCode();
      oCon.disconnect();
      bExists = (iResponseCode>=200 && iResponseCode<=299);
      } catch (MalformedURLException mue) {
        throw new IOException(mue.getMessage());
      }
  } else if (sSourceURI.startsWith("https://")) {
View Full Code Here

  } else if (sSourceURI.startsWith("https://")) {
    try {
        URL oUrl = new URL(sSourceURI);
      HttpsURLConnection oCon = (HttpsURLConnection) oUrl.openConnection();
      int iResponseCode = oCon.getResponseCode();
      oCon.disconnect();
      bExists = (iResponseCode>=200 && iResponseCode<=299);
      } catch (MalformedURLException mue) {
        throw new IOException(mue.getMessage());
      }
  }
View Full Code Here

      final HttpURLConnection huc = (HttpURLConnection) conn;
      huc.connect();
     
      final int code = huc.getResponseCode();
      if (!(code >= 200 && code < 300))
      {  huc.disconnect();
        throw new IOException("HTTP response code: " + code);
     
     
      // some web servers will give the wrong content type.  It is hard to say whether we should just
      // always ignore the web server's content type, and just check the extension, or whether we should
View Full Code Here

    if (conn != null)
    {
      if (conn instanceof HttpURLConnection)
      {
        final HttpURLConnection huc = (HttpURLConnection) conn;
        huc.disconnect();
      }
      // TODO: others
    }
   
    connected = false;
View Full Code Here

      }
      huc.connect();
     
      final int code = huc.getResponseCode();
      if (!(code >= 200 && code < 300))
      {  huc.disconnect();
        throw new IOException("HTTP response code: " + code);
     
     
      // TODO: what is the right place to apply ContentDescriptor.mimeTypeToPackageName?
      contentTypeStr = ContentDescriptor.mimeTypeToPackageName(stripTrailer(conn.getContentType()));
View Full Code Here

    if (conn != null)
    {
      if (conn instanceof HttpURLConnection)
      {
        final HttpURLConnection huc = (HttpURLConnection) conn;
        huc.disconnect();
      }
      // TODO: others
    }
    connected = false;
  }
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.