Exemple #1
0
        public override System.Data.Services.Http.WebResponse EndGetResponse(IAsyncResult asyncResult)
        {
            if (asyncResult == null)
            {
                throw new ArgumentNullException("asyncResult");
            }

            if (this.asyncResponseResult != asyncResult)
            {
                throw new InvalidOperationException(
                          System.Data.Services.Client.Strings.HttpWeb_Internal("HttpWebRequest.EndGetResponse"));
            }

            if (this.asyncResponseResult.EndCalled)
            {
                throw new InvalidOperationException(
                          System.Data.Services.Client.Strings.HttpWeb_Internal("HttpWebRequest.EndGetResponse.2"));
            }

            if (this.aborted)
            {
                throw CreateAbortException();
            }

            this.asyncResponseResult.EndCalled = true;
            this.CreateResponse();
            this.asyncResponseResult.Dispose();
            this.asyncResponseResult = null;
            return(this.response);
        }
Exemple #2
0
        public override IAsyncResult BeginGetRequestStream(AsyncCallback callback, object state)
        {
            if (this.aborted)
            {
                throw CreateAbortException();
            }

            if (this.contentStream == null)
            {
                this.contentStream = new NonClosingMemoryStream();
            }
            else
            {
                this.contentStream.Seek(0L, SeekOrigin.Begin);
            }

            HttpWebRequestAsyncResult asyncResult = new HttpWebRequestAsyncResult(callback, state);

            this.asyncRequestResult = asyncResult;
            this.asyncRequestResult.CompletedSynchronously = true;
            if (asyncResult != null)
            {
                asyncResult.SetCompleted();
                asyncResult.Callback(asyncResult);
            }

            return(asyncResult);
        }
Exemple #3
0
 public override IAsyncResult BeginGetResponse(AsyncCallback callback, object state)
 {
     HttpWebRequestAsyncResult result = new HttpWebRequestAsyncResult(callback, state);
     try
     {
         result.InsideBegin = true;
         this.asyncResponseResult = result;
         this.InvokeRequest();
     }
     finally
     {
         result.InsideBegin = false;
     }
     return result;
 }
Exemple #4
0
        public override IAsyncResult BeginGetResponse(AsyncCallback callback, object state)
        {
            HttpWebRequestAsyncResult asyncResult = new HttpWebRequestAsyncResult(callback, state);

            try
            {
                asyncResult.InsideBegin  = true;
                this.asyncResponseResult = asyncResult;
                this.InvokeRequest();
            }
            finally
            {
                asyncResult.InsideBegin = false;
            }

            return(asyncResult);
        }
Exemple #5
0
 public override IAsyncResult BeginGetRequestStream(AsyncCallback callback, object state)
 {
     if (this.aborted)
     {
         throw CreateAbortException();
     }
     if (this.contentStream == null)
     {
         this.contentStream = new NonClosingMemoryStream();
     }
     else
     {
         this.contentStream.Seek(0L, SeekOrigin.Begin);
     }
     HttpWebRequestAsyncResult ar = new HttpWebRequestAsyncResult(callback, state);
     this.asyncRequestResult = ar;
     this.asyncRequestResult.CompletedSynchronously = true;
     if (ar != null)
     {
         ar.SetCompleted();
         ar.Callback(ar);
     }
     return ar;
 }
Exemple #6
0
 public override WebResponse EndGetResponse(IAsyncResult asyncResult)
 {
     if (asyncResult == null)
     {
         throw new ArgumentNullException("asyncResult");
     }
     if (this.asyncResponseResult != asyncResult)
     {
         throw new InvalidOperationException("HttpWebRequest.EndGetResponse");
     }
     if (this.asyncResponseResult.EndCalled)
     {
         throw new InvalidOperationException("HttpWebRequest.EndGetResponse.2");
     }
     if (this.aborted)
     {
         throw CreateAbortException();
     }
     this.asyncResponseResult.EndCalled = true;
     this.CreateResponse();
     this.asyncResponseResult.Dispose();
     this.asyncResponseResult = null;
     return this.response;
 }
Exemple #7
0
 public override Stream EndGetRequestStream(IAsyncResult asyncResult)
 {
     if (asyncResult == null)
     {
         throw new ArgumentNullException("asyncResult");
     }
     if (this.asyncRequestResult != asyncResult)
     {
         throw new InvalidOperationException("HttpWebRequest.EndGetRequestStream");
     }
     if (this.asyncRequestResult.EndCalled)
     {
         throw new InvalidOperationException("HttpWebRequest.EndGetRequestStream.2");
     }
     if (this.aborted)
     {
         throw CreateAbortException();
     }
     this.asyncRequestResult.EndCalled = true;
     this.asyncRequestResult.Dispose();
     this.asyncRequestResult = null;
     return this.contentStream;
 }
Exemple #8
0
         public override System.Data.Services.Http.WebResponse EndGetResponse(IAsyncResult asyncResult)
        {
            if (asyncResult == null)
            {
                throw new ArgumentNullException("asyncResult");
            }

            if (this.asyncResponseResult != asyncResult)
            {
                throw new InvalidOperationException(
                    System.Data.Services.Client.Strings.HttpWeb_Internal("HttpWebRequest.EndGetResponse"));
            }
            
            if (this.asyncResponseResult.EndCalled)
            {
                throw new InvalidOperationException(
                    System.Data.Services.Client.Strings.HttpWeb_Internal("HttpWebRequest.EndGetResponse.2"));
            }
            
            if (this.aborted)
            {
                throw CreateAbortException();
            }

            this.asyncResponseResult.EndCalled = true;
            this.CreateResponse();
            this.asyncResponseResult.Dispose();
            this.asyncResponseResult = null;
            return this.response;
        }