Package java.net

Examples of java.net.HttpURLConnection.disconnect()


            HttpURLConnection connection = (HttpURLConnection) new URL(url)
                    .openConnection();
            connection.setRequestProperty("User-Agent", userAgent);

            String response = IOUtils.toString(connection.getInputStream());
            connection.disconnect();

            return response;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here


        }
      } catch (ParseException pe) {
        System.out.println(pe);
      }

      conn.disconnect();
    } catch (MalformedURLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
View Full Code Here

                    break;
                }
            }
        } catch (IOException e) {
        }
        connection.disconnect();
        return resolved;
    }

    /**
     * @param file - the name of the file, as saved to the repo (including extension)
View Full Code Here

                    break;
                }
            }
        } catch (IOException e) {
        }
        connection.disconnect();
        if (good) {
            return resolved;
        } else {
            Logger.logWarn("Using backupLink for " + file);
            return backupLink;
View Full Code Here

                    }
                }
            }
        } catch (IOException e) {
        }
        connection.disconnect();
        return resolved;
    }

    /**
     * @param file - file on the repo in static
View Full Code Here

                    }
                }
            }
        } catch (IOException e) {
        } finally {
            connection.disconnect();
            if (scanner != null) {
                scanner.close();
            }
        }
        String result = fileMD5(file);
View Full Code Here

                try {
                    if (in != null) {
                        in.close();
                    }
                    if (connection != null) {
                        connection.disconnect();
                    }
                } catch (IOException e) {
                    Logger.logWarn("Error while downloading modpack", e);
                }
            } while (amount < modPackSize && (amount > startAmount || retryCount-- > 0));
View Full Code Here

            }
        } catch (IOException e) {
            Logger.logError(e.getMessage());
        } finally {
            if (conn != null) {
                conn.disconnect();
            }
            if (in != null) {
                try {
                    in.close();
                } catch (IOException ignored) {
View Full Code Here

                conn.setRequestProperty("Cache-Control", "no-transform");
                conn.setRequestMethod("HEAD");
                conn.connect();
                hash = conn.getHeaderField("ETag").replace("\"", "");
                fileSizes[i] = conn.getContentLength();
                conn.disconnect();
                totalDownloadSize += fileSizes[i];
            } catch (Exception e) {
                Logger.logWarn("Authlib checksum download failed", e);
                return false;
            }
View Full Code Here

            Logger.logError("Headless Exception from Piwik", e);
        } catch (IOException e) {
            Logger.logError("Error Contacting tracking server", e);
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
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.