Examples of FreenetURI


Examples of freenet.keys.FreenetURI

  }

  @Override
  public boolean restart(ClientContext context, final boolean disableFilterData) {
    if(!canRestart()) return false;
    FreenetURI redirect = null;
    synchronized(this) {
      finished = false;
      if(persistence == Persistence.FOREVER && getFailedMessage != null) {
        if(getFailedMessage.redirectURI != null) {
          redirect =
View Full Code Here

Examples of freenet.keys.FreenetURI

        int version = dis.readInt();
        if(version != CLIENT_DETAIL_VERSION)
            throw new StorageFormatException("Bad version "+version);
        String s = dis.readUTF();
        try {
            uri = new FreenetURI(s);
        } catch (MalformedURLException e) {
            throw new StorageFormatException("Bad URI");
        }
        short r = dis.readShort();
        try {
View Full Code Here

Examples of freenet.keys.FreenetURI

            type = TYPENAME_OFFICIAL;
          } else if (new File(pluginURL).exists()) {
            type = TYPENAME_FILE;
          } else {
            try {
              new FreenetURI(pluginURL);
              type = TYPENAME_FREENET;
            } catch (MalformedURLException e) {
              // FIXME currently i have no idea how to auto detect a proper url,
              // especially distinguish it from typos/mistakes.
              // so it is disabled for now. saces.
View Full Code Here

Examples of freenet.keys.FreenetURI

      throw new MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "No Identifier", null, global);
    try {
      String u = fs.get("URI");
      if(u == null)
        throw new MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "No URI", identifier, global);
      FreenetURI uu = new FreenetURI(u);
      // Client is allowed to put a slash at the end if it wants to, but this is discouraged.
      String[] meta = uu.getAllMetaStrings();
      if(meta != null && meta.length == 1 && meta[0].length() == 0)
        uu = uu.setMetaString(null);
      uri = uu;
    } catch (MalformedURLException e) {
      throw new MessageInvalidException(ProtocolErrorMessage.FREENET_URI_PARSE_ERROR, e.getMessage(), identifier, global);
    }
    String verbosityString = fs.get("Verbosity");
View Full Code Here

Examples of freenet.keys.FreenetURI

    if(old == status) return;
    if(logMINOR) Logger.minor(this, "Starting upload "+status.getIdentifier());
    if(old != null)
        uploads.remove(old);
    uploads.add(status);
    FreenetURI uri = status.getURI();
    if(uri != null)
      uploadsByFinalURI.put(uri, status);
  }
View Full Code Here

Examples of freenet.keys.FreenetURI

  synchronized void removeByIdentifier(String identifier) {
    RequestStatus status = requestsByIdentifier.remove(identifier);
    if(status == null) return;
    if(status instanceof DownloadRequestStatus) {
      downloads.remove(status);
      FreenetURI uri = status.getURI();
      assert(uri != null);
      downloadsByURI.removeElement(uri, status);
    } else if(status instanceof UploadRequestStatus) {
      uploads.remove(status);
      FreenetURI uri = ((UploadRequestStatus) status).getFinalURI();
      if(uri != null)
        uploadsByFinalURI.removeElement(uri, status);
    }
  }
View Full Code Here

Examples of freenet.keys.FreenetURI

    if(identifier == null)
      throw new MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "No Identifier!", null, false);
    String suri = fs.get("URI");
    if(suri == null)
      throw new MessageInvalidException(ProtocolErrorMessage.MISSING_FIELD, "Expected a URI on SubscribeUSK", identifier, false);
    FreenetURI uri;
    try {
      uri = new FreenetURI(suri);
      key = USK.create(uri);
    } catch (MalformedURLException e) {
      throw new MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, "Could not parse URI: "+e, identifier, false);
    }
    this.dontPoll = fs.getBoolean("DontPoll", false);
View Full Code Here

Examples of freenet.keys.FreenetURI

    this.finalURI = finalURI2;
  }
 
  @Override
  public String getPreferredFilename() {
    FreenetURI uri = getFinalURI();
    if(uri != null &&
        (uri.hasMetaStrings() || uri.getDocName() != null))
      return uri.getPreferredFilename();
    uri = getTargetURI();
    if(uri != null &&
        (uri.hasMetaStrings() || uri.getDocName() != null))
      return uri.getPreferredFilename();
    return null;
  }
View Full Code Here

Examples of freenet.keys.FreenetURI

    for(int i=0;i<elements.length;i++) {
      String num = Integer.toString(i);
      ManifestElement e = elements[i];
      String mimeOverride = e.getMimeTypeOverride();
      SimpleFieldSet subset = new SimpleFieldSet(false);
      FreenetURI tempURI = e.getTargetURI();
      subset.putSingle("Name", e.getName());
      if(tempURI != null) {
        subset.putSingle("UploadFrom", "redirect");
        subset.putSingle("TargetURI", tempURI.toString());
      } else {
        Bucket origData = e.getData();
        Bucket data = origData;
        if(data instanceof DelayedFreeBucket) {
          data = ((DelayedFreeBucket)data).getUnderlying();
View Full Code Here

Examples of freenet.keys.FreenetURI

  @Override
  public void onFetchable(BaseClientPutter putter) {
    if(finished) return;
    if((verbosity & VERBOSITY_PUT_FETCHABLE) == VERBOSITY_PUT_FETCHABLE) {
      FreenetURI temp;
      synchronized (this) {
        temp = generatedURI;
      }
      PutFetchableMessage msg =
        new PutFetchableMessage(identifier, global, temp);
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.