Package fr.eolya.utils.http

Examples of fr.eolya.utils.http.HttpLoader.open()


           
            int ret = -1;
//           int tryCount = 0;
//           String temp = url;
           
            ret = urlLoader.open(url);
           
//            while (ret == -1 && tryCount < 3) {
//                try {
//                    urlLoader.close();
//                    ret = urlLoader.open("", "", true);
View Full Code Here


  @Test
  public void testHttpLoader(){
    try {
      HttpLoader loader = new HttpLoader();
      assertEquals(HttpLoader.LOAD_SUCCESS, loader.open("http://www.google.fr/"));
     
      assertEquals(200, loader.getResponseStatusCode());
      assertEquals("text/html; charset=ISO-8859-1", loader.getContentType());
      assertEquals("ISO-8859-1", loader.getCharSet());
View Full Code Here

      assertEquals(200, loader.getResponseStatusCode());
      assertEquals("text/html; charset=ISO-8859-1", loader.getContentType());
      assertEquals("ISO-8859-1", loader.getCharSet());

      loader = new HttpLoader();
      assertEquals(HttpLoader.LOAD_SUCCESS, loader.open("https://www.google.fr/"));
     
      assertEquals(200, loader.getResponseStatusCode());
      assertEquals("text/html; charset=ISO-8859-1", loader.getContentType());
      assertEquals("ISO-8859-1", loader.getCharSet());
View Full Code Here

      assertEquals(200, loader.getResponseStatusCode());
      assertEquals("text/html; charset=ISO-8859-1", loader.getContentType());
      assertEquals("ISO-8859-1", loader.getCharSet());

      loader = new HttpLoader();
      assertEquals(HttpLoader.LOAD_ERROR, loader.open("https://www.eolya.fr/"));

      loader = new HttpLoader();
      assertEquals(HttpLoader.LOAD_ERROR, loader.open("http://www.googlegooglegoogle.fr/"));

      loader = new HttpLoader();
View Full Code Here

      loader = new HttpLoader();
      assertEquals(HttpLoader.LOAD_ERROR, loader.open("https://www.eolya.fr/"));

      loader = new HttpLoader();
      assertEquals(HttpLoader.LOAD_ERROR, loader.open("http://www.googlegooglegoogle.fr/"));

      loader = new HttpLoader();
      assertEquals(HttpLoader.LOAD_ERROR, loader.open("http://www.google.fr/zzzzz/"));
      assertEquals(404, loader.getResponseStatusCode())
    } catch (Exception e) {
View Full Code Here

      loader = new HttpLoader();
      assertEquals(HttpLoader.LOAD_ERROR, loader.open("http://www.googlegooglegoogle.fr/"));

      loader = new HttpLoader();
      assertEquals(HttpLoader.LOAD_ERROR, loader.open("http://www.google.fr/zzzzz/"));
      assertEquals(404, loader.getResponseStatusCode())
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

                    else
                        return XmlResponse.buildErrorXml(10, "Failed get authentication cookie");
                }
            }
           
            if (urlLoader.open(page) == HttpLoader.LOAD_SUCCESS) {
                String contentType = urlLoader.getContentType();
                String contentEncoding = urlLoader.getContentEncoding();
                if ((contentType!=null) && (contentType.toLowerCase().startsWith("text/html"))) {
          HttpStream ws = new HttpStream(urlLoader.getStream(), "", contentType, contentEncoding);
                    String rawPage = ws.getString();
View Full Code Here

      //} catch (URISyntaxException e1) {
      //  e1.printStackTrace();
            //    return XmlResponse.buildErrorXml(10, "Failed load page (bad url : " + page + ")");
      //}
            if (urlLoader.open(url.toExternalForm()) == HttpLoader.LOAD_SUCCESS) {
                String ret = "<?xml version=\"1.0\" encoding=\"utf-8\"?><result>";
               
                //String contentType = urlLoader.getContentType();
                //String contentEncoding = urlLoader.getContentEncoding();
               
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.