Package net.sf.jabref.net

Examples of net.sf.jabref.net.URLDownload


          }
          File file = new File(new File(directory), plannedName);

          URL url = new URL(res);

          URLDownload udl = new URLDownload(parent, url, file);
          try {
            udl.download();
          } catch (IOException e2) {
            JOptionPane.showMessageDialog(parent, Globals.lang("Invalid URL")+": "
              + e2.getMessage(), Globals.lang("Download file"),
              JOptionPane.ERROR_MESSAGE);
            Globals.logger("Error while downloading " + url.toString());
View Full Code Here


   
    public void installFromURL(URL url) {
        try {
            File tmpFile = File.createTempFile("jabref-plugin", ".jar");
            tmpFile.deleteOnExit();
            URLDownload ud = new URLDownload(frame, url, tmpFile);
            ud.download();
            String path = url.getPath();
            int pos = path.lastIndexOf('/');
            if ((pos >= 0) && (pos < path.length()-1))
                path = path.substring(pos+1);
            PluginInstaller.installPlugin(frame, tmpFile, path);
View Full Code Here

         this.parent = parent;
         this.destination = destination;
    }
   
    public void run() {
        URLDownload ud = new URLDownload(parent, resource, destination);
        try {
            ud.download();
        } catch (IOException ex) {
            Globals.logger("Error extracting resource: "+ex.getMessage());           
        }
    }
View Full Code Here

            if (!created) {
                return UNABLE_TO_CREATE_DIR;
            }
        }
        File destFile = new File(PluginCore.userPluginDir, destFileName);
        URLDownload ud = new URLDownload(frame, source, destFile);

        try {
            ud.download();
            return SUCCESS;
        } catch (IOException e) {
            e.printStackTrace();
            return UNABLE_TO_COPY_FILE;
        }
View Full Code Here

        }
    }

    protected String getCitationsFromUrl(String urlQuery, List<String> ids) throws IOException {
        URL url = new URL(urlQuery);
        URLDownload ud = new URLDownload(url);
        ud.download();

        String cont = ud.getStringContent();
        String entirePage = cont;

        Matcher m = idPattern.matcher(cont);
        if (m.find()) {
            while (m.find()) {
View Full Code Here

                String toName = FileDialogs.getNewFile(frame, new File(System.getProperty("user.home")),
                        null, JFileChooser.SAVE_DIALOG, false);
                if (toName == null)
                    return;
                else toFile = new File(toName);
                URLDownload ud = new URLDownload(comp, url, toFile);
                ud.download();
                comp.setText(toFile.getPath());
            } catch (MalformedURLException ex) {
                ex.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            } catch (IOException ex2) {
                ex2.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
View Full Code Here

            // Replace special characters by corresponding sequences:
            entryUrl = entryUrl.replaceAll("%", "%25").replaceAll(":", "%3A").replaceAll("/", "%2F")
                    .replaceAll("\\?", "%3F").replaceAll("&", "%26").replaceAll("=", "%3D");
                   
            URL url = new URL(BIBSONOMY_SCRAPER+entryUrl+BIBSONOMY_SCRAPER_POST);
            URLDownload ud = new URLDownload(url);
            ud.download();
            String bibtex = ud.getStringContent();
            BibtexParser bp = new BibtexParser(new StringReader(bibtex));
            ParserResult pr = bp.parse();
            if ((pr != null) && (pr.getDatabase().getEntryCount() > 0)) {
                return pr.getDatabase().getEntries().iterator().next();
            }
View Full Code Here

        }
    }

    protected String getCitationsFromUrl(String urlQuery, List<String> ids) throws IOException {
        URL url = new URL(urlQuery);
        URLDownload ud = new URLDownload(url);
        ud.download();

        String cont = ud.getStringContent();
        //String entirePage = cont;
        Matcher m = linkPattern.matcher(cont);
        if (m.find()) {
            while (m.find()) {
                ids.add(linkPrefix+m.group(1));
View Full Code Here

                    if (result != null) {
                       
                        // Check the MIME type of this URL to see if it is a PDF. If not,
                        // it could be because the user doesn't have access:
                        try {
                            URLDownload udl = new URLDownload(null, result, null);
                            udl.openConnectionOnly();

                            String mimeType = udl.getMimeType();
                            if ((mimeType != null) && (mimeType.toLowerCase().equals("application/pdf"))) {
                                return new FindResult(result, url);
                            }
                            else {
                                udl = new URLDownload(null, result, new File("page.html"));
                                udl.download();
                                return new FindResult(WRONG_MIME_TYPE, url);
                            }
                        } catch (IOException ex) {
                            ex.printStackTrace();
                            return new FindResult(IO_EXCEPTION, url);
View Full Code Here

                    //auto file name:
                    File file = new File(new File(Globals.prefs
                            .get("pdfDirectory")), editor.getEntry()
                            .getField(BibtexFields.KEY_FIELD)
                            + ".pdf");
                    URLDownload udl = new URLDownload(editor, url,
                            file);
                    frame.output(Globals.lang("Downloading..."));
                    udl.download();
                    frame.output(Globals.lang("Download completed"));
                    feditor.setText(file.toURI().toURL().toString());
                    editor.updateField(feditor);

                }catch (IOException ioex){
View Full Code Here

TOP

Related Classes of net.sf.jabref.net.URLDownload

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.