Package freenet.keys

Examples of freenet.keys.FreenetURI


    }
  }
 
  @Override
  public void onSuccess(BaseClientPutter state) {
    FreenetURI uri = state.getURI();
    if(logMINOR) Logger.minor(this, darknetOpennetString + " ARK insert succeeded: " + uri);
    synchronized (this) {
      inserter = null;
      if(!shouldInsert) return;
      shouldInsert = false;
View Full Code Here


      String key = entry.getKey().intern();
      Object o = entry.getValue();
      Metadata target;
      if(o instanceof String) {
        // External redirect
        FreenetURI uri = new FreenetURI((String)o);
        target = new Metadata(DocumentType.SIMPLE_REDIRECT, null, null, uri, null);
      } else if(o instanceof HashMap) {
        target = new Metadata();
        target.addRedirectionManifest(Metadata.forceMap(o));
      } else throw new IllegalArgumentException("Not String nor HashMap: "+o);
View Full Code Here

        dos.write(nameData);
        Metadata meta = entry.getValue();
        try {
          byte[] data = meta.writeToByteArray();
          if(data.length > MAX_SIZE_IN_MANIFEST) {
            FreenetURI uri = meta.resolvedURI;
            String n = meta.resolvedName;
            if(uri != null) {
              meta = new Metadata(DocumentType.SIMPLE_REDIRECT, null, null, uri, null);
              data = meta.writeToByteArray();
            } else if (n != null) {
View Full Code Here

    if(logMINOR) Logger.minor(this, "Found edition "+l+" for "+this+" - fetching...");
    // Create a SingleFileFetcher for the key (as an SSK).
    // Put the edition number into its context object.
    // Put ourself as callback.
    // Fetch it. If it fails, ignore it, if it succeeds, return the data with the edition # to the client.
    FreenetURI uri = key.getSSK(l).getURI();
    try {
      SingleFileFetcher getter =
        (SingleFileFetcher) SingleFileFetcher.create(this, this, uri, ctx, new ArchiveContext(ctx.maxTempLength, ctx.maxArchiveLevels),
            ctx.maxNonSplitfileRetries, 0, true, l, true, false, context, realTimeFlag, false);
      getter.schedule(context);
View Full Code Here

      } else if(arkPubKey != null && arkNo > -1) {
        if(onStartup) arkNo++;
        // this is the number of the ref we are parsing.
        // we want the number of the next edition.
        // on startup we want to fetch the old edition in case there's been a corruption.
        FreenetURI uri = new FreenetURI(arkPubKey);
        ClientSSK ssk = new ClientSSK(uri);
        ark = new USK(ssk, arkNo);
      } else if(forDiffNodeRef && arkPubKey == null && myARK != null && arkNo > -1) {
        // get the ARK URI from the previous ARK and the edition from the SFS
        ark = myARK.copy(arkNo);
View Full Code Here

    switch(e.mode) {
    case NOT_ENOUGH_PATH_COMPONENTS:
    case PERMANENT_REDIRECT:
      context.uskManager.updateKnownGood(usk, usk.suggestedEdition, context);
    }
    FreenetURI uri = e.newURI;
    if(uri != null) {
      // FIXME what are we doing here anyway? Document!
      uri = usk.turnMySSKIntoUSK(uri);
      e = new FetchException(e, uri);
    }
View Full Code Here

  }

  public void handleFproxyBookmarkFeed(SimpleFieldSet fs, int fileNumber) {
    String name = fs.get("Name");
    String description = null;
    FreenetURI uri = null;
    boolean hasAnActiveLink = fs.getBoolean("hasAnActivelink", false);
    long composedTime = fs.getLong("composedTime", -1);
    long sentTime = fs.getLong("sentTime", -1);
    long receivedTime = fs.getLong("receivedTime", -1);
    try {
      String s = fs.get("Description");
      if(s != null)
        description = Base64.decodeUTF8(s);
      uri = new FreenetURI(fs.get("URI"));
    } catch (MalformedURLException e) {
      Logger.error(this, "Malformed URI in N2NTM Bookmark Feed message");
      return;
    } catch (IllegalBase64Exception e) {
      Logger.error(this, "Bad Base64 encoding when decoding a N2NTM SimpleFieldSet", e);
View Full Code Here

    BookmarkFeedUserAlert userAlert = new BookmarkFeedUserAlert(this, name, description, hasAnActiveLink, fileNumber, uri, composedTime, sentTime, receivedTime);
    node.clientCore.alerts.register(userAlert);
  }

  public void handleFproxyDownloadFeed(SimpleFieldSet fs, int fileNumber) {
    FreenetURI uri = null;
    String description = null;
    long composedTime = fs.getLong("composedTime", -1);
    long sentTime = fs.getLong("sentTime", -1);
    long receivedTime = fs.getLong("receivedTime", -1);
    try {
      String s = fs.get("Description");
      if(s != null)
        description = Base64.decodeUTF8(s);
      uri = new FreenetURI(fs.get("URI"));
    } catch (MalformedURLException e) {
      Logger.error(this, "Malformed URI in N2NTM File Feed message");
      return;
    } catch (IllegalBase64Exception e) {
      Logger.error(this, "Bad Base64 encoding when decoding a N2NTM SimpleFieldSet", e);
View Full Code Here

          Logger.minor(this, "Command: "+line);
        if(uline.startsWith("GET:")) {
            // Should have a key next
            String key = line.substring("GET:".length()).trim();
            Logger.normal(this, "Key: "+key);
            FreenetURI uri;
            try {
                uri = new FreenetURI(key);
                Logger.normal(this, "Key: "+uri);
            } catch (MalformedURLException e2) {
                outsb.append("Malformed URI: ").append(key).append(" : ").append(e2);
    outsb.append("\r\n");
    w.write(outsb.toString());
    w.flush();
                return false;
            }
            try {
        FetchResult result = client.fetch(uri);
        ClientMetadata cm = result.getMetadata();
                outsb.append("Content MIME type: ").append(cm.getMIMEType());
        Bucket data = result.asBucket();
        // FIXME limit it above
        if(data.size() > 32*1024) {
          System.err.println("Data is more than 32K: "+data.size());
          outsb.append("Data is more than 32K: ").append(data.size());
          outsb.append("\r\n");
          w.write(outsb.toString());
          w.flush();
          return false;
        }
        byte[] dataBytes = BucketTools.toByteArray(data);
        boolean evil = false;
        for(byte b: dataBytes) {
          // Look for escape codes
          if(b == '\n') continue;
          if(b == '\r') continue;
          if(b < 32) evil = true;
        }
        if(evil) {
          System.err.println("Data may contain escape codes which could cause the terminal to run arbitrary commands! Save it to a file if you must with GETFILE:");
          outsb.append("Data may contain escape codes which could cause the terminal to run arbitrary commands! Save it to a file if you must with GETFILE:");
          outsb.append("\r\n");
          w.write(outsb.toString());
          w.flush();
          return false;
        }
        outsb.append("Data:\r\n");
        outsb.append(new String(dataBytes, ENCODING));
      } catch (FetchException e) {
                outsb.append("Error: ").append(e.getMessage()).append("\r\n");
              if((e.getMode() == FetchExceptionMode.SPLITFILE_ERROR) && (e.errorCodes != null)) {
                outsb.append(e.errorCodes.toVerboseString());
              }
              if(e.newURI != null)
                    outsb.append("Permanent redirect: ").append(e.newURI).append("\r\n");
      }
        } else if(uline.startsWith("DUMP:")) {
              // Should have a key next
              String key = line.substring("DUMP:".length()).trim();
              Logger.normal(this, "Key: "+key);
              FreenetURI uri;
              try {
                  uri = new FreenetURI(key);
                  Logger.normal(this, "Key: "+uri);
              } catch (MalformedURLException e2) {
                  outsb.append("Malformed URI: ").append(key).append(" : ").append(e2);
      outsb.append("\r\n");
      w.write(outsb.toString());
      w.flush();
                  return false;
              }
              try {
                FetchContext context = client.getFetchContext();
              FetchWaiter fw = new FetchWaiter((RequestClient)client);
              ClientGetter get = new ClientGetter(fw, uri, context, RequestStarter.INTERACTIVE_PRIORITY_CLASS, null, null, null);
              get.setMetaSnoop(new DumperSnoopMetadata());
                get.start(n.clientCore.clientContext);
          FetchResult result = fw.waitForCompletion();
          ClientMetadata cm = result.getMetadata();
                  outsb.append("Content MIME type: ").append(cm.getMIMEType());
          Bucket data = result.asBucket();
          // FIXME limit it above
          if(data.size() > 32*1024) {
            System.err.println("Data is more than 32K: "+data.size());
            outsb.append("Data is more than 32K: ").append(data.size());
            outsb.append("\r\n");
            w.write(outsb.toString());
            w.flush();
            return false;
          }
          byte[] dataBytes = BucketTools.toByteArray(data);
          boolean evil = false;
          for(byte b: dataBytes) {
            // Look for escape codes
            if(b == '\n') continue;
            if(b == '\r') continue;
            if(b < 32) evil = true;
          }
          if(evil) {
            System.err.println("Data may contain escape codes which could cause the terminal to run arbitrary commands! Save it to a file if you must with GETFILE:");
            outsb.append("Data may contain escape codes which could cause the terminal to run arbitrary commands! Save it to a file if you must with GETFILE:");
            outsb.append("\r\n");
            w.write(outsb.toString());
            w.flush();
            return false;
          }
          outsb.append("Data:\r\n");
          outsb.append(new String(dataBytes, ENCODING));
        } catch (FetchException e) {
                  outsb.append("Error: ").append(e.getMessage()).append("\r\n");
                if((e.getMode() == FetchExceptionMode.SPLITFILE_ERROR) && (e.errorCodes != null)) {
                  outsb.append(e.errorCodes.toVerboseString());
                }
                if(e.newURI != null)
                      outsb.append("Permanent redirect: ").append(e.newURI).append("\r\n");
        }
        } else if(uline.startsWith("GETFILE:")) {
            // Should have a key next
            String key = line.substring("GETFILE:".length()).trim();
            Logger.normal(this, "Key: "+key);
            FreenetURI uri;
            try {
                uri = new FreenetURI(key);
            } catch (MalformedURLException e2) {
                outsb.append("Malformed URI: ").append(key).append(" : ").append(e2);
    outsb.append("\r\n");
    w.write(outsb.toString());
    w.flush();
                return false;
            }
            try {
              long startTime = System.currentTimeMillis();
        FetchResult result = client.fetch(uri);
        ClientMetadata cm = result.getMetadata();
                outsb.append("Content MIME type: ").append(cm.getMIMEType());
        Bucket data = result.asBucket();
                // Now calculate filename
                String fnam = uri.getDocName();
                fnam = sanitize(fnam);
                if(fnam.length() == 0) {
                    fnam = "freenet-download-"+HexUtil.bytesToHex(BucketTools.hash(data), 0, 10);
                    String ext = DefaultMIMETypes.getExtension(cm.getMIMEType());
                    if((ext != null) && !ext.equals(""))
                      fnam += '.' + ext;
                }
                File f = new File(downloadsDir, fnam);
                if(f.exists()) {
                    outsb.append("File exists already: ").append(fnam);
                    fnam = "freenet-"+System.currentTimeMillis()+ '-' +fnam;
                }
                FileOutputStream fos = null;
                try {
                    fos = new FileOutputStream(f);
                    BucketTools.copyTo(data, fos, Long.MAX_VALUE);
                    fos.close();
                    outsb.append("Written to ").append(fnam);
                } catch (IOException e) {
                    outsb.append("Could not write file: caught ").append(e);
                    e.printStackTrace();
                } finally {
                    if(fos != null) try {
                        fos.close();
                    } catch (IOException e1) {
                        // Ignore
                    }
                }
                long endTime = System.currentTimeMillis();
                long sz = data.size();
                double rate = 1000.0 * sz / (endTime-startTime);
                outsb.append("Download rate: ").append(rate).append(" bytes / second");
      } catch (FetchException e) {
                outsb.append("Error: ").append(e.getMessage());
              if((e.getMode() == FetchExceptionMode.SPLITFILE_ERROR) && (e.errorCodes != null)) {
                outsb.append(e.errorCodes.toVerboseString());
              }
              if(e.newURI != null)
                    outsb.append("Permanent redirect: ").append(e.newURI).append("\r\n");
      }
    } else if(uline.startsWith("UPDATE")) {
      outsb.append("starting the update process");
      // FIXME run on separate thread
      n.ticker.queueTimedJob(new Runnable() {
        @Override
        public void run() {
            freenet.support.Logger.OSThread.logPID(this);
          n.getNodeUpdater().arm();
        }
      }, 0);
      outsb.append("\r\n");
      w.write(outsb.toString());
      w.flush();
      return false;
    }else if(uline.startsWith("FILTER:")) {
      line = line.substring("FILTER:".length()).trim();
      outsb.append("Here is the result:\r\n");
     
      final String content = readLines(reader, false);
      final Bucket input = new ArrayBucket(content.getBytes("UTF-8"));
      final Bucket output = new ArrayBucket();
      InputStream inputStream = null;
      OutputStream outputStream = null;
      InputStream bis = null;
      try {
        inputStream = input.getInputStream();
        outputStream = output.getOutputStream();
        ContentFilter.filter(inputStream, outputStream, "text/html", new URI("http://127.0.0.1:8888/"), null, null, null, core.getLinkFilterExceptionProvider());
        inputStream.close();
      inputStream = null;
        outputStream.close();
      outputStream = null;

        bis = output.getInputStream();
        while(bis.available() > 0){
          outsb.append((char)bis.read());
        }
      } catch (IOException e) {
        outsb.append("Bucket error?: " + e.getMessage());
        Logger.error(this, "Bucket error?: " + e, e);
      } catch (URISyntaxException e) {
        outsb.append("Internal error: " + e.getMessage());
        Logger.error(this, "Internal error: " + e, e);
      } finally {
      Closer.close(inputStream);
      Closer.close(outputStream);
      Closer.close(bis);
        input.free();
        output.free();
      }
      outsb.append("\r\n");
    }else if(uline.startsWith("BLOW")) {
      n.getNodeUpdater().blow("caught an  IOException : (Incompetent Operator) :p", true);
      outsb.append("\r\n");
      w.write(outsb.toString());
      w.flush();
      return false;
  } else if(uline.startsWith("SHUTDOWN")) {
    StringBuilder sb = new StringBuilder();
    sb.append("Shutting node down.\r\n");
    w.write(sb.toString());
    w.flush();
    n.exit("Shutdown from console");
  } else if(uline.startsWith("RESTART")) {
    StringBuilder sb = new StringBuilder();
    sb.append("Restarting the node.\r\n");
    w.write(sb.toString());
    w.flush();
    n.getNodeStarter().restart();
  } else if(uline.startsWith("QUIT") && (core.directTMCI == this)) {
    StringBuilder sb = new StringBuilder();
    sb.append("QUIT command not available in console mode.\r\n");
    w.write(sb.toString());
    w.flush();
    return false;
        } else if(uline.startsWith("QUIT")) {
    StringBuilder sb = new StringBuilder();
    sb.append("Closing connection.\r\n");
    w.write(sb.toString());
    w.flush();
    return true;
        } else if(uline.startsWith("MEMSTAT")) {
    Runtime rt = Runtime.getRuntime();
    float freeMemory = rt.freeMemory();
    float totalMemory = rt.totalMemory();
    float maxMemory = rt.maxMemory();

    long usedJavaMem = (long)(totalMemory - freeMemory);
    long allocatedJavaMem = (long)totalMemory;
    long maxJavaMem = (long)maxMemory;
    int availableCpus = rt.availableProcessors();
    NumberFormat thousendPoint = NumberFormat.getInstance();

    ThreadGroup tg = Thread.currentThread().getThreadGroup();
    while(tg.getParent() != null) tg = tg.getParent();
    int threadCount = tg.activeCount();

    StringBuilder sb = new StringBuilder();
    sb.append("Used Java memory:\u00a0" + SizeUtil.formatSize(usedJavaMem, true)+"\r\n");
    sb.append("Allocated Java memory:\u00a0" + SizeUtil.formatSize(allocatedJavaMem, true)+"\r\n");
    sb.append("Maximum Java memory:\u00a0" + SizeUtil.formatSize(maxJavaMem, true)+"\r\n");
    sb.append("Running threads:\u00a0" + thousendPoint.format(threadCount)+"\r\n");
    sb.append("Available CPUs:\u00a0" + availableCpus+"\r\n");
    sb.append("Java Version:\u00a0" + System.getProperty("java.version")+"\r\n");
    sb.append("JVM Vendor:\u00a0" + System.getProperty("java.vendor")+"\r\n");
    sb.append("JVM Version:\u00a0" + System.getProperty("java.version")+"\r\n");
    sb.append("OS Name:\u00a0" + System.getProperty("os.name")+"\r\n");
    sb.append("OS Version:\u00a0" + System.getProperty("os.version")+"\r\n");
    sb.append("OS Architecture:\u00a0" + System.getProperty("os.arch")+"\r\n");
    w.write(sb.toString());
    w.flush();
    return false;
  } else if(uline.startsWith("HELP")) {
    printHeader(w);
    outsb.append("\r\n");
    w.write(outsb.toString());
    w.flush();
    return false;
        } else if(uline.startsWith("PUT:") || (getCHKOnly = uline.startsWith("GETCHK:"))) {
          if(getCHKOnly)
            line = line.substring(("GETCHK:").length()).trim();
          else
            line = line.substring("PUT:".length()).trim();
            String content;
            if(line.length() > 0) {
                // Single line insert
                content = line;
            } else {
                // Multiple line insert
                content = readLines(reader, false);
            }
            // Insert
            byte[] data = content.getBytes(ENCODING);
           
            InsertBlock block = new InsertBlock(new ArrayBucket(data), null, FreenetURI.EMPTY_CHK_URI);

            FreenetURI uri;
            try {
              uri = client.insert(block, getCHKOnly, null);
            } catch (InsertException e) {
                outsb.append("Error: ").append(e.getMessage());
              if(e.uri != null)
                    outsb.append("URI would have been: ").append(e.uri);
              InsertExceptionMode mode = e.getMode();
              if((mode == InsertExceptionMode.FATAL_ERRORS_IN_BLOCKS) || (mode == InsertExceptionMode.TOO_MANY_RETRIES_IN_BLOCKS)) {
                    outsb.append("Splitfile-specific error:\n").append(e.errorCodes.toVerboseString());
              }
    outsb.append("\r\n");
    w.write(outsb.toString());
    w.flush();
              return false;
            }

            outsb.append("URI: ").append(uri);
            ////////////////////////////////////////////////////////////////////////////////
        } else if(uline.startsWith("PUTDIR:") || (uline.startsWith("PUTSSKDIR")) || (getCHKOnly = uline.startsWith("GETCHKDIR:"))) {
          // TODO: Check for errors?
          boolean ssk = false;
          if(uline.startsWith("PUTDIR:"))
            line = line.substring("PUTDIR:".length());
          else if(uline.startsWith("PUTSSKDIR:")) {
            line = line.substring("PUTSSKDIR:".length());
            ssk = true;
          } else if(uline.startsWith("GETCHKDIR:"))
            line = line.substring(("GETCHKDIR:").length());
          else {
            System.err.println("Impossible");
            outsb.append("Impossible");
          }
         
          line = line.trim();
         
          if(line.length() < 1) {
            printHeader(w);
      outsb.append("\r\n");
      w.write(outsb.toString());
      w.flush();
            return false;
          }
         
          String defaultFile = null;
         
          FreenetURI insertURI = FreenetURI.EMPTY_CHK_URI;
         
          // set default file?
          if (line.matches("^.*#.*$")) {
            String[] split = line.split("#");
            if(ssk) {
              insertURI = new FreenetURI(split[0]);
              line = split[1];
              if(split.length > 2)
                defaultFile = split[2];
            } else {
              defaultFile = split[1];
              line = split[0];
            }
          }
         
          HashMap<String, Object> bucketsByName =
            makeBucketsByName(line);
         
          if(defaultFile == null) {
            String[] defaultFiles =
              new String[] { "index.html", "index.htm", "default.html", "default.htm" };
            for(String file: defaultFiles) {
              if(bucketsByName.containsKey(file)) {
                defaultFile = file;
                break;
              }               
            }
          }
         
          FreenetURI uri;
      try {
        uri = client.insertManifest(insertURI, bucketsByName, defaultFile);
        uri = uri.addMetaStrings(new String[] { "" });
            outsb.append("=======================================================");
                outsb.append("URI: ").append(uri);
            outsb.append("=======================================================");
      } catch (InsertException e) {
                outsb.append("Finished insert but: ").append(e.getMessage());
              if(e.uri != null) {
                uri = e.uri;
            uri = uri.addMetaStrings(new String[] { "" });
                    outsb.append("URI would have been: ").append(uri);
              }
              if(e.errorCodes != null) {
                outsb.append("Splitfile errors breakdown:");
                outsb.append(e.errorCodes.toVerboseString());
              }
              Logger.error(this, "Caught "+e, e);
      }
           
        } else if(uline.startsWith("PUTFILE:") || (getCHKOnly = uline.startsWith("GETCHKFILE:"))) {
            // Just insert to local store
          if(getCHKOnly) {
            line = line.substring(("GETCHKFILE:").length()).trim();
          } else {
            line = line.substring("PUTFILE:".length()).trim();
          }
            String mimeType = DefaultMIMETypes.guessMIMEType(line, false);
            if (line.indexOf('#') > -1) {
              String[] splittedLine = line.split("#");
              line = splittedLine[0];
              mimeType = splittedLine[1];
            }
            File f = new File(line);
            outsb.append("Attempting to read file ").append(line);
            long startTime = System.currentTimeMillis();
            try {
              if(!(f.exists() && f.canRead())) {
                throw new FileNotFoundException();
              }
             
              // Guess MIME type
                outsb.append(" using MIME type: ").append(mimeType).append("\r\n");
              if(mimeType.equals(DefaultMIMETypes.DEFAULT_MIME_TYPE))
                mimeType = ""; // don't need to override it
             
              FileBucket fb = new FileBucket(f, true, false, false, false);
              InsertBlock block = new InsertBlock(fb, new ClientMetadata(mimeType), FreenetURI.EMPTY_CHK_URI);

              startTime = System.currentTimeMillis();
              FreenetURI uri = client.insert(block, getCHKOnly, f.getName());
             
              // FIXME depends on CHK's still being renamable
                //uri = uri.setDocName(f.getName());

                outsb.append("URI: ").append(uri).append("\r\n");
              long endTime = System.currentTimeMillis();
                long sz = f.length();
                double rate = 1000.0 * sz / (endTime-startTime);
                outsb.append("Upload rate: ").append(rate).append(" bytes / second\r\n");
            } catch (FileNotFoundException e1) {
                outsb.append("File not found");
            } catch (InsertException e) {
                outsb.append("Finished insert but: ").append(e.getMessage());
              if(e.uri != null) {
                    outsb.append("URI would have been: ").append(e.uri);
                  long endTime = System.currentTimeMillis();
                    long sz = f.length();
                    double rate = 1000.0 * sz / (endTime-startTime);
                    outsb.append("Upload rate: ").append(rate).append(" bytes / second");
              }
              if(e.errorCodes != null) {
                outsb.append("Splitfile errors breakdown:");
                outsb.append(e.errorCodes.toVerboseString());
              }
            } catch (Throwable t) {
                outsb.append("Insert threw: ").append(t);
                t.printStackTrace();
            }
        } else if(uline.startsWith("MAKESSK")) {
          InsertableClientSSK key = InsertableClientSSK.createRandom(r, "");
            outsb.append("Insert URI: ").append(key.getInsertURI().toString(false, false)).append("\r\n");
            outsb.append("Request URI: ").append(key.getURI().toString(false, false)).append("\r\n");
          FreenetURI insertURI = key.getInsertURI().setDocName("testsite");
          String fixedInsertURI = insertURI.toString(false, false);
            outsb.append("Note that you MUST add a filename to the end of the above URLs e.g.:\r\n").append(fixedInsertURI).append("\r\n");
            outsb.append("Normally you will then do PUTSSKDIR:<insert URI>#<directory to upload>, for example:\r\nPUTSSKDIR:").append(fixedInsertURI).append("#directoryToUpload/\r\n");
            outsb.append("This will then produce a manifest site containing all the files, the default document can be accessed at\r\n").append(key.getURI().toString(false, false)).append("testsite/");
        } else if(uline.startsWith("PUTSSK:")) {
          String cmd = line.substring("PUTSSK:".length());
          cmd = cmd.trim();
          if(cmd.indexOf(';') <= 0) {
            outsb.append("No target URI provided.");
            outsb.append("PUTSSK:<insert uri>;<url to redirect to>");
      outsb.append("\r\n");
      w.write(outsb.toString());
      w.flush();
            return false;
          }
          String[] split = cmd.split(";");
          String insertURI = split[0];
          String targetURI = split[1];
            outsb.append("Insert URI: ").append(insertURI);
            outsb.append("Target URI: ").append(targetURI);
          FreenetURI insert = new FreenetURI(insertURI);
          FreenetURI target = new FreenetURI(targetURI);
          try {
        FreenetURI result = client.insertRedirect(insert, target);
                outsb.append("Successfully inserted to fetch URI: ").append(result);
      } catch (InsertException e) {
                outsb.append("Finished insert but: ").append(e.getMessage());
              Logger.normal(this, "Error: "+e, e);
              if(e.uri != null) {
View Full Code Here

   * @param edition
   * @param context
   */
  public void hintUpdate(USK usk, long edition, ClientContext context) {
    if(edition < lookupLatestSlot(usk)) return;
    FreenetURI uri = usk.copy(edition).getURI().sskForUSK();
    final ClientGetter get = new ClientGetter(new NullClientCallback(rcBulk), uri, new FetchContext(backgroundFetchContext, FetchContext.IDENTICAL_MASK), RequestStarter.UPDATE_PRIORITY_CLASS, new NullBucket(), null, null);
    try {
      get.start(context);
    } catch (FetchException e) {
      // Ignore
View Full Code Here

TOP

Related Classes of freenet.keys.FreenetURI

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.