/// <summary>standard constructor</summary> public AtomFeedParser(IVersionAware v) : base() { Tracing.TraceCall("constructing AtomFeedParser"); _nameTable = new AtomParserNameTable(); _nameTable.InitAtomParserNameTable(); _versionInfo = new VersionInformation(v); }
/// <summary> /// this gets called out of a notification chain. It sets /// this objects version info and the extension lists. We do not /// use the property accessor to avoid the notification loop /// </summary> /// <param name="obj"></param> internal void SetVersionInfo(IVersionAware obj) { _versionInfo = new VersionInformation(obj); _versionInfo.ImprintVersion(ExtensionElements); _versionInfo.ImprintVersion(ExtensionFactories); }
/// <summary>Constructor.</summary> /// <param name="v">the versioninformation to pass </param> internal ChangeVersion(IVersionAware v) { _v = new VersionInformation(v); }
/// <summary>Executes the request and prepares the response stream. Also /// does error checking</summary> /// <param name="retryCounter">indicates the n-th time this is run</param> protected void Execute(int retryCounter) { Tracing.TraceCall("GoogleAuth: Execution called"); try { CopyRequestData(); base.Execute(); if (Response is HttpWebResponse) { HttpWebResponse response = Response as HttpWebResponse; _responseVersion = new VersionInformation(response.Headers[GDataGAuthRequestFactory.GDataVersion]); } } catch (GDataForbiddenException) { Tracing.TraceMsg("need to reauthenticate, got a forbidden back"); // do it again, once, reset AuthToken first and streams first Reset(); _factory.GAuthToken = null; CopyRequestData(); base.Execute(); } catch (GDataRedirectException re) { // we got a redirect. Tracing.TraceMsg("Got a redirect to: " + re.Location); // only reset the base, the auth cookie is still valid // and cookies are stored in the factory if (_factory.StrictRedirect) { HttpWebRequest http = Request as HttpWebRequest; if (http != null) { // only redirect for GET, else throw if (http.Method != HttpMethods.Get) { throw; } } } // verify that there is a non empty location string if (re.Location.Trim().Length == 0) { throw; } Reset(); TargetUri = new Uri(re.Location); CopyRequestData(); base.Execute(); } catch (GDataRequestException re) { HttpWebResponse webResponse = re.Response as HttpWebResponse; if (webResponse != null && webResponse.StatusCode != HttpStatusCode.InternalServerError) { Tracing.TraceMsg("Not a server error. Possibly a Bad request or forbidden resource."); Tracing.TraceMsg("We don't want to retry non 500 errors."); throw; } if (retryCounter > _factory.NumberOfRetries) { Tracing.TraceMsg("Number of retries exceeded"); throw; } Tracing.TraceMsg("Let's retry this"); // only reset the base, the auth cookie is still valid // and cookies are stored in the factory Reset(); Execute(retryCounter + 1); } catch (Exception e) { Tracing.TraceCall("*** EXCEPTION " + e.GetType().Name + " CAUGHT ***"); throw; } finally { if (_requestCopy != null) { _requestCopy.Close(); _requestCopy = null; } } }