public void Redirect()
		{
			var url = _urls.UrlFor(typeof (LoginRequest));
		    var continuation = new AjaxContinuation {Success = false, NavigatePage = url};

		    _jsonWriter.Write(continuation.ToDictionary(), MimeType.Json.ToString());
			_outputWriter.WriteResponseCode(HttpStatusCode.Unauthorized);
		}
		public FubuContinuation Redirect()
		{
			var url = _urls.UrlFor(typeof (LoginRequest));
		    var continuation = new AjaxContinuation {Success = false, NavigatePage = url};

		    _jsonWriter.Write(continuation.ToDictionary(), MimeType.Json.ToString());

		    return FubuContinuation.EndWithStatusCode(HttpStatusCode.Unauthorized);
		}
		public void gets_and_sets_the_validation_origin()
		{
			var continuation = new AjaxContinuation();

			continuation.ValidationOrigin(ValidationOrigin.Server);
			continuation.ValidationOrigin().ShouldEqual(ValidationOrigin.Server);

			continuation.ValidationOrigin(ValidationOrigin.Client);
			continuation.ValidationOrigin().ShouldEqual(ValidationOrigin.Client);
		}
        protected override Task<DoNext> performInvoke()
        {
            var input = _request.Get<CharacterInput>();
            if (input.Race == "Ogre" && input.CharacterClass == "Paladin")
            {
                var continuation = new AjaxContinuation();
                continuation.Errors.Add(new AjaxError {field = "Character", message = "Ogres cannot be Paladins!"});
                _request.Set(continuation);

                return Task.FromResult(DoNext.Stop);
            }

            return Task.FromResult(DoNext.Continue);
        }
Beispiel #5
0
 public AjaxContinuation Parse(ParserInputModel input)
 {
     var compilationUnit = _parser.Parse(input.Content, string.Empty);
     if (compilationUnit.Errors.Count == 0) {
         return AjaxContinuation.Successful();
     }
     else {
         var continuation = new AjaxContinuation();
         foreach (var error in compilationUnit.Errors) {
             continuation.Errors.Add(new AjaxError {message = error.Message});
         }
         return continuation;
     }
 }
        public AjaxContinuation Enrich(AjaxContinuation continuation, Notification notification)
        {
            continuation.Success = notification.IsValid();
            notification
                .ToValidationErrors()
                .Each(e => continuation
                               .Errors
                               .Add(new AjaxError
                                        {
                                            field = e.field,
                                            message = e.message
                                        }));

            return continuation;
        }
        public void exceptionHandledBehavior(Action<IActionBehavior> behaviorAction)
        {
            if (InsideBehavior == null) return;

            try {
                behaviorAction(InsideBehavior);
            }
            catch (Exception exception) {
                ErrorLog.GetDefault(_httpContext).Log(new Error(exception));

                var continuation = new AjaxContinuation().ForException(exception);
                //_request.Set(continuation);
                _writer.Write(continuation, MimeType.Json.ToString());
                //_output.WriteResponseCode(HttpStatusCode.InternalServerError);
            }
        }
Beispiel #8
0
        public static AjaxContinuation BuildContinuation(Notification notification)
        {
            var continuation = new AjaxContinuation();
             continuation.Success = notification.IsValid();
             notification
                 .ToValidationErrors()
                 .Each(e => continuation
                                .Errors
                                .Add(new AjaxError
                                {
                                    field = e.field,
                                    label = e.label,
                                    message = e.message
                                }));

             return continuation;
        }
 public void Modify(AjaxContinuation continuation, Notification notification)
 {
     Continuation = continuation;
     Notification = notification;
 }
	    public AjaxContinuation BuildAjaxContinuation()
	    {
	        var url = _urls.UrlFor(new LoginRequest(), "GET");
	        var continuation = new AjaxContinuation {Success = false, NavigatePage = url};
	        return continuation;
	    }
 public void SetUp()
 {
     theContinuation = new AjaxContinuation();
 }
 public AjaxContinuation Enrich(AjaxContinuation continuation, Notification notification)
 {
     return continuation.AsNotification(notification);
 }