Package org.wymiwyg.commons.util.http

Examples of org.wymiwyg.commons.util.http.HttpURLTools


  private static HttpURLConnection getConnection(URL url, Model model)
            throws IOException {
        int responseCode = 300;
        HttpURLConnection connection = null;
        while ((responseCode >= 300) && (responseCode < 400)) {
            HttpURLTools urlTools = new HttpURLTools(url);
            urlTools
                    .setAccept("text/rdf+xml, application/rdf+xml, text/rss+xml, application/rss+xml, application/xml, application/xml");
            // set accept-language
            urlTools.setAcceptLanguage(getAcceptLanguages(model));
            HttpURLConnection.setFollowRedirects(true);
            connection = (HttpURLConnection) urlTools.getConnection();
            responseCode = connection.getResponseCode();
            if ((responseCode < 300) || (responseCode >= 400)) {
                break;
            }
            url = new URL(connection.getHeaderField("Location"));
View Full Code Here


   */
  static void download(Model model, String url, URL baseURL) throws HandlerException {
    Model importing = ModelFactory.createDefaultModel();
   
    try {
        HttpURLTools tools = new HttpURLTools(new URL(url));
        tools.setAccept("application/rdf+xml, */*;q=.1");
      importing.read(tools.getConnection().getInputStream(), url);
    } catch (Exception ex) {
      throw new HandlerException("Exception retriewing "+url,ex);
    }
       
    model.enterCriticalSection(ModelLock.READ);
View Full Code Here

TOP

Related Classes of org.wymiwyg.commons.util.http.HttpURLTools

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.