Beispiel #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();
        }
        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();
        }
Beispiel #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();
        }
        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();
        }
        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();
        }
        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();
        }