Exemplo n.º 1
0
            protected virtual void SwitchState(VclHandler handler, VclFrontendAction frontendAction)
            {
                if (!ValidTransitionStates.Contains(frontendAction))
                {
                    throw new InvalidOperationException($"Invalid attempt to transition front-end from {State} to {frontendAction}.");
                }

                handler.Logger?.LogDebug($"Client state transition from {State} to {frontendAction}");
                handler._currentFrontendState = VclFrontendHandlerStateFactory.Get(frontendAction);
            }
Exemplo n.º 2
0
        public async Task ProcessFrontendRequestAsync(RequestContext requestContext)
        {
            var vclContext = new VclContext();

            vclContext.Request.Restarts = -1;
            if (requestContext.Request.HasEntityBody)
            {
                vclContext.Request.CopyBodyFrom(requestContext.Request.Body);
            }

            _currentFrontendState = VclFrontendHandlerStateFactory.Get(VclFrontendAction.Restart);
            while (_currentFrontendState.State != VclFrontendAction.Done)
            {
                await _currentFrontendState.ExecuteAsync(this, requestContext, vclContext).ConfigureAwait(false);
            }

            VclLog(vclContext);
        }