コード例 #1
0
        public void ReadRequestAsync(Action<HttpEntityManager, byte[]> onReadSuccess, Action<Exception> onError)
        {
            Ensure.NotNull(onReadSuccess, "OnReadSuccess");
            Ensure.NotNull(onError, "onError");

            var state = new ManagerOperationState(
                HttpEntity.Request.InputStream, new MemoryStream(), onReadSuccess, onError);
            var copier = new AsyncStreamCopier<ManagerOperationState>(
                state.InputStream, state.OutputStream, state, RequestRead);
            copier.Start();
        }
コード例 #2
0
        private void WriteResponseAsync(byte[] response, Action <Exception> onError)
        {
            SetResponseLength(response.Length);

            var state = new ManagerOperationState(HttpEntity, (sender, e) => {}, onError)
            {
                InputStream  = new MemoryStream(response),
                OutputStream = HttpEntity.Response.OutputStream
            };
            var copier = new AsyncStreamCopier <ManagerOperationState>(state.InputStream, state.OutputStream, state);

            copier.Completed += ResponseWritten;
            copier.Start();
        }
コード例 #3
0
        public void ReadRequestAsync(Action <HttpEntityManager, string> onSuccess, Action <Exception> onError)
        {
            Ensure.NotNull(onSuccess, "onSuccess");
            Ensure.NotNull(onError, "onError");

            var state = new ManagerOperationState(HttpEntity, onSuccess, onError)
            {
                InputStream  = HttpEntity.Request.InputStream,
                OutputStream = new MemoryStream()
            };

            var copier = new AsyncStreamCopier <ManagerOperationState>(state.InputStream, state.OutputStream, state);

            copier.Completed += RequestRead;
            copier.Start();
        }
コード例 #4
0
        public void ReadRequestAsync(Action<HttpEntityManager, byte[]> onReadSuccess, Action<Exception> onError)
        {
            Ensure.NotNull(onReadSuccess, "OnReadSuccess");
            Ensure.NotNull(onError, "onError");

            var state = new ManagerOperationState(
                HttpEntity.Request.InputStream, new MemoryStream(), onReadSuccess, onError);
            var copier = new AsyncStreamCopier<ManagerOperationState>(
                state.InputStream, state.OutputStream, state, RequestRead);
            copier.Start();
        }
コード例 #5
0
        public void ReadRequestAsync(Action<HttpEntityManager, string> onSuccess, Action<Exception> onError)
        {
            Ensure.NotNull(onSuccess, "onSuccess");
            Ensure.NotNull(onError, "onError");

            var state = new ManagerOperationState(HttpEntity, onSuccess, onError)
                            {
                                InputStream = HttpEntity.Request.InputStream,
                                OutputStream = new MemoryStream()
                            };

            var copier = new AsyncStreamCopier<ManagerOperationState>(state.InputStream, state.OutputStream, state);
            copier.Completed += RequestRead;
            copier.Start();
        }
コード例 #6
0
        private void WriteResponseAsync(byte[] response, Action<Exception> onError)
        {
            SetResponseLength(response.Length);

            var state = new ManagerOperationState(HttpEntity, (sender, e) => {}, onError)
                            {
                                InputStream = new MemoryStream(response),
                                OutputStream = HttpEntity.Response.OutputStream
                            };
            var copier = new AsyncStreamCopier<ManagerOperationState>(state.InputStream, state.OutputStream, state);
            copier.Completed += ResponseWritten;
            copier.Start();
        }