Package net.datacrow.core.http

Examples of net.datacrow.core.http.HttpConnection


        }
       
        boolean checked = false;
        while (!checked) {
            try {
                HttpConnection conn =  HttpConnectionUtil.getConnection(address);
                InputStream is = conn.getInputStream();
                properties.load(is);

                String version = (String) properties.get(_VERSION);
                String downloadUrl = (String) properties.get(_DOWNLOAD_URL);
                String infoUrl = (String) properties.get(_INFO_URL);
View Full Code Here


      url = new URL( "http://" + server + "/~cddb/cddb.cgi" );
    } catch (MalformedURLException e) {
      throw new Exception(DcResources.getText("msgInvalidURLChangeSetting", url.toString()));
    }
       
        HttpConnection connection = HttpConnectionUtil.getConnection(url);

    try {
      PrintWriter out = new PrintWriter(connection.getOutputStream());
            String query = "cmd=" + command + "&hello=" + userLogin + "+" + userDomain + "+" +
                           clientName + "+" + clientVersion + "&proto="+ protocol;
            out.println(query);
            out.flush();
            out.close();
    } catch ( IOException e ) {
      throw new Exception(DcResources.getText("msgFreeDBServerUnreachable", e.getMessage()));
    }
   
    String output = connection.getString();

    //Preliminary freedb error check, error codes 4xx and 5xx indicate an error
    if (output.startsWith("4") || output.startsWith("5") || output.startsWith("202")) {
      throw new Exception(DcResources.getText("msgFreeDBServerReturnedError", output));
        }
View Full Code Here

       
        return document;
    }   
   
    public static String getHtmlCleaned(URL url, String charset, boolean cleanup) throws Exception {
        HttpConnection connection = HttpConnectionUtil.getConnection(url);
        String html = connection.getString(charset);
        connection.close();       
       
        if (html.contains("<html") || html.contains("<HTML")) {
            String title = StringUtils.getValueBetween("<title>", "</title>", html);
            html = StringUtils.getValueBetween("<body", "</body>", html);
            html = html.substring(html.indexOf(">") + 1);
View Full Code Here

TOP

Related Classes of net.datacrow.core.http.HttpConnection

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.