public bool ProcessRedirect(Uri redirectedUri) { MetadataParsedURL originalMetadataPURL = originalDocument.Location; ParsedUri originalPURL = originalMetadataPURL == null ? null : originalMetadataPURL.Value; ParsedUri redirectedPURL = new ParsedUri(redirectedUri.AbsoluteUri); Debug.WriteLine("try redirecting: " + originalPURL + " > " + redirectedPURL); /*Document redirectedDocument = semanticsSessionScope.GetOrConstructDocument(redirectedPURL); * // note FIXME currently, GetOrConstructDocument does not return null! * if (redirectedDocument != null) * { * // existing document: the redirected url has been visited already. * * if (originalPURL != redirectedPURL) * redirectedDocument.AddAdditionalLocation(originalMetadataPURL); * * // TODO -- copy metadata from originalDocument?!! * * documentClosure.ChangeDocument(redirectedDocument); * * // TODO -- reconnect * * return true; * } * else * { * // TODO -- redirect to a new location. * }*/ // TODO -- what if redirectedDocument is already in the queue or being downloaded? return(false); }
public void AddAdditionalLocation(MetadataParsedURL additionalLocation) { if (AdditionalLocations == null) { AdditionalLocations = new List <MetadataParsedURL>(); } AdditionalLocations.Add(additionalLocation); }
///<summary> /// Get the old location from this. /// Set the location of this to the newLocation. /// Add a mapping in the GlobalCollection from newLocation to this. /// Add the old location for this as an additionalLocation for this. ///</summary> public void ChangeLocation(ParsedUri newLocation) { if (newLocation != null) { MetadataParsedURL origLocation = Location; if (!origLocation.Value.Equals(newLocation)) { Location = new MetadataParsedURL(newLocation); if (SemanticsSessionScope != null) { SemanticsSessionScope.GlobalDocumentCollection.AddDocument(this, newLocation); } AddAdditionalLocation(origLocation); } } }
///<summary> /// Get the old location from this. /// Set the location of this to the newLocation. /// Add a mapping in the GlobalCollection from newLocation to this. /// Add the old location for this as an additionalLocation for this. ///</summary> public void ChangeLocation(ParsedUri newLocation) { if (newLocation != null) { MetadataParsedURL origLocation = Location; if (!origLocation.Value.Equals(newLocation)) { Location = new MetadataParsedURL(newLocation); if (SemanticsSessionScope != null) SemanticsSessionScope.GlobalDocumentCollection.AddDocument(this, newLocation); AddAdditionalLocation(origLocation); } } }
public void AddAdditionalLocation(MetadataParsedURL additionalLocation) { if (AdditionalLocations == null) AdditionalLocations = new List<MetadataParsedURL>(); AdditionalLocations.Add(additionalLocation); }