diff --git a/ideexpert/DMVC.Expert.CodeGen.Templates.pas b/ideexpert/DMVC.Expert.CodeGen.Templates.pas index 2847bc0b..dacb3829 100644 --- a/ideexpert/DMVC.Expert.CodeGen.Templates.pas +++ b/ideexpert/DMVC.Expert.CodeGen.Templates.pas @@ -81,7 +81,7 @@ resourcestring ' LServer.ListenQueue := dotEnv.Env(''dmvc.indy.listen_queue'', 500);' + sLineBreak + sLineBreak + ' LServer.Active := True;' + sLineBreak + ' LogI(''Listening on port '' + APort.ToString);' + sLineBreak + - ' LogI(''CTRL+C to shutdown the server'');' + sLineBreak + + ' LogI(''Application started. Press Ctrl+C to shut down.'');' + sLineBreak + ' WaitForTerminationSignal; ' + sLineBreak + ' EnterInShutdownState; ' + sLineBreak + ' LServer.Active := False; ' + sLineBreak + @@ -174,22 +174,22 @@ resourcestring sIndexMethodIntf = ' [MVCPath]' + sLineBreak + ' [MVCHTTPMethod([httpGET])]' + sLineBreak + - ' procedure Index;' + sLineBreak + sLineBreak + + ' function Index: String;' + sLineBreak + sLineBreak + ' [MVCPath(''/reversedstrings/($Value)'')]' + sLineBreak + ' [MVCHTTPMethod([httpGET])]' + sLineBreak + ' [MVCProduces(TMVCMediaType.TEXT_PLAIN)]' + sLineBreak + - ' procedure GetReversedString(const Value: String);' + sLineBreak; + ' function GetReversedString(const Value: String): String;' + sLineBreak; // 0 - Class Name sIndexMethodImpl = - 'procedure %0:s.Index;' + sLineBreak + + 'function %0:s.Index: String;' + sLineBreak + 'begin' + sLineBreak + ' //use Context property to access to the HTTP request and response ' + sLineBreak + - ' Render(''Hello DelphiMVCFramework World'');' + sLineBreak + + ' Result := ''Hello DelphiMVCFramework World'';' + sLineBreak + 'end;' + sLineBreak + sLineBreak + - 'procedure %0:s.GetReversedString(const Value: String);' + sLineBreak + + 'function %0:s.GetReversedString(const Value: String): String;' + sLineBreak + 'begin' + sLineBreak + - ' Render(System.StrUtils.ReverseString(Value.Trim));' + sLineBreak + + ' Result := System.StrUtils.ReverseString(Value.Trim);' + sLineBreak + 'end;' + sLineBreak; sCRUDMethodsIntf = diff --git a/sources/MVCFramework.Middleware.Authentication.pas b/sources/MVCFramework.Middleware.Authentication.pas index 341135fd..2540aec2 100644 --- a/sources/MVCFramework.Middleware.Authentication.pas +++ b/sources/MVCFramework.Middleware.Authentication.pas @@ -298,7 +298,7 @@ var begin AContext.SessionStop(False); AContext.LoggedUser.Clear; - if not AContext.Request.ThereIsRequestBody then + if not AContext.Request.HasBody then begin AHandled := True; AContext.Response.StatusCode := HTTP_STATUS.BadRequest; diff --git a/sources/MVCFramework.Router.pas b/sources/MVCFramework.Router.pas index 6b8149ad..ec18de26 100644 --- a/sources/MVCFramework.Router.pas +++ b/sources/MVCFramework.Router.pas @@ -364,7 +364,7 @@ begin begin lNames := GetParametersNames(AMVCPath); lPattern := ToPattern(AMVCPath, lNames); - lCacheItem := TMVCActionParamCacheItem.Create(lPattern, lNames); + lCacheItem := TMVCActionParamCacheItem.Create('^' + lPattern + '$', lNames); FActionParamsCache.Add(AMVCPath, lCacheItem); end; @@ -372,12 +372,12 @@ begin Exit(True) else begin - lRegEx := TRegEx.Create('^' + lCacheItem.Value + '$', [roIgnoreCase, roCompiled, roSingleLine]); + lRegEx := TRegEx.Create(lCacheItem.Value, [roIgnoreCase, roCompiled, roSingleLine]); lMatch := lRegEx.Match(APath); Result := lMatch.Success; if Result then begin - for I := 1 to pred(lMatch.Groups.Count) do + for I := 1 to Pred(lMatch.Groups.Count) do begin aParams.Add(lCacheItem.Params[I - 1], TIdURI.URLDecode(lMatch.Groups[I].Value)); end;