Skip to content

Commit

Permalink
Updated sample to be compatible with the new middleware based session
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleteti committed Jan 23, 2025
1 parent 47420a7 commit 2742960
Show file tree
Hide file tree
Showing 22 changed files with 17 additions and 1,309 deletions.
2 changes: 0 additions & 2 deletions samples/ado/WebModuleU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ procedure TMyWebModule.WebModuleCreate(Sender: TObject);
procedure(Config: TMVCConfig)
begin
Config.dotEnv := dotEnv;
// session timeout (0 means session cookie)
Config[TMVCConfigKey.SessionTimeout] := dotEnv.Env('dmvc.session_timeout', '0');
//default content-type
Config[TMVCConfigKey.DefaultContentType] := dotEnv.Env('dmvc.default.content_type', TMVCConstants.DEFAULT_CONTENT_TYPE);
//default content charset
Expand Down
2 changes: 0 additions & 2 deletions samples/concurrency_speed_test/WebModuleU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ procedure TMyWebModule.WebModuleCreate(Sender: TObject);
procedure(Config: TMVCConfig)
begin
Config.dotEnv := dotEnv;
// session timeout (0 means session cookie)
Config[TMVCConfigKey.SessionTimeout] := Config.dotEnv.Env('dmvc.session_timeout', '0');
//default content-type
Config[TMVCConfigKey.DefaultContentType] := Config.dotEnv.Env('dmvc.default.content_type', TMVCConstants.DEFAULT_CONTENT_TYPE);
//default content charset
Expand Down
2 changes: 0 additions & 2 deletions samples/functional_actions_showcase/WebModuleU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ procedure TMyWebModule.WebModuleCreate(Sender: TObject);
procedure(Config: TMVCConfig)
begin
Config.dotEnv := dotEnv;
// session timeout (0 means session cookie)
Config[TMVCConfigKey.SessionTimeout] := dotEnv.Env('dmvc.session_timeout', '0');
//default content-type
Config[TMVCConfigKey.DefaultContentType] := dotEnv.Env('dmvc.default.content_type', TMVCConstants.DEFAULT_CONTENT_TYPE);
//default content charset
Expand Down
2 changes: 0 additions & 2 deletions samples/htmx_mustache/WebModuleU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ procedure TWebModule1.WebModuleCreate(Sender: TObject);
procedure(Config: TMVCConfig)
begin
Config.dotEnv := dotEnv;
// session timeout (0 means session cookie)
Config[TMVCConfigKey.SessionTimeout] := dotEnv.Env('dmvc.session_timeout', '0');
//default content-type
Config[TMVCConfigKey.DefaultContentType] := dotEnv.Env('dmvc.default.content_type', TMVCMediaType.TEXT_HTML);
//default content charset
Expand Down
2 changes: 0 additions & 2 deletions samples/htmx_templatepro/WebModuleU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ procedure TWebModule1.WebModuleCreate(Sender: TObject);
procedure(Config: TMVCConfig)
begin
Config.dotEnv := dotEnv;
// session timeout (0 means session cookie)
Config[TMVCConfigKey.SessionTimeout] := dotEnv.Env('dmvc.session_timeout', '0');
//default content-type
Config[TMVCConfigKey.DefaultContentType] := dotEnv.Env('dmvc.default.content_type', TMVCMediaType.TEXT_HTML);
//default content charset
Expand Down
2 changes: 0 additions & 2 deletions samples/htmx_website_with_templatepro/WebModuleU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ procedure TMyWebModule.WebModuleCreate(Sender: TObject);
FMVC := TMVCEngine.Create(Self,
procedure(Config: TMVCConfig)
begin
// session timeout (0 means session cookie)
Config[TMVCConfigKey.SessionTimeout] := dotEnv.Env('dmvc.session_timeout', '0');
//default content-type
Config[TMVCConfigKey.DefaultContentType] := dotEnv.Env('dmvc.default.content_type', TMVCMediaType.TEXT_HTML);
//default content charset
Expand Down
2 changes: 0 additions & 2 deletions samples/htmx_website_with_webstencils/WebModuleU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ procedure TMyWebModule.WebModuleCreate(Sender: TObject);
FMVC := TMVCEngine.Create(Self,
procedure(Config: TMVCConfig)
begin
// session timeout (0 means session cookie)
Config[TMVCConfigKey.SessionTimeout] := dotEnv.Env('dmvc.session_timeout', '0');
//default content-type
Config[TMVCConfigKey.DefaultContentType] := dotEnv.Env('dmvc.default.content_type', TMVCMediaType.TEXT_HTML);
//default content charset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ procedure TMyWebModule.WebModuleCreate(Sender: TObject);
FMVC := TMVCEngine.Create(Self,
procedure(Config: TMVCConfig)
begin
// session timeout (0 means session cookie)
Config[TMVCConfigKey.SessionTimeout] := dotEnv.Env('dmvc.session_timeout', '0');
//default content-type
Config[TMVCConfigKey.DefaultContentType] := dotEnv.Env('dmvc.default.content_type', TMVCMediaType.TEXT_HTML);
//default content charset
Expand Down
2 changes: 0 additions & 2 deletions samples/middleware_cors/SimpleWebServer/WebModuleU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ procedure TMyWebModule.WebModuleCreate(Sender: TObject);
procedure(Config: TMVCConfig)
begin
Config.dotEnv := dotEnv;
// session timeout (0 means session cookie)
Config[TMVCConfigKey.SessionTimeout] := dotEnv.Env('dmvc.session_timeout', '0');
//default content-type
Config[TMVCConfigKey.DefaultContentType] := dotEnv.Env('dmvc.default.content_type', TMVCConstants.DEFAULT_CONTENT_TYPE);
//default content charset
Expand Down
2 changes: 0 additions & 2 deletions samples/render_binary_contents/WebModuleU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ procedure TMyWebModule.WebModuleCreate(Sender: TObject);
FMVC := TMVCEngine.Create(Self,
procedure(Config: TMVCConfig)
begin
// session timeout (0 means session cookie)
Config[TMVCConfigKey.SessionTimeout] := dotEnv.Env('dmvc.session_timeout', '0');
//default content-type
Config[TMVCConfigKey.DefaultContentType] := dotEnv.Env('dmvc.default.content_type', TMVCConstants.DEFAULT_CONTENT_TYPE);
//default content charset
Expand Down
2 changes: 0 additions & 2 deletions samples/services_injection/WebModuleU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ procedure TMyWebModule.WebModuleCreate(Sender: TObject);
procedure(Config: TMVCConfig)
begin
Config.dotEnv := dotEnv;
// session timeout (0 means session cookie)
Config[TMVCConfigKey.SessionTimeout] := dotEnv.Env('dmvc.session_timeout', '0');
//default content-type
Config[TMVCConfigKey.DefaultContentType] := dotEnv.Env('dmvc.default.content_type', TMVCConstants.DEFAULT_CONTENT_TYPE);
//default content charset
Expand Down
5 changes: 2 additions & 3 deletions samples/session_file_based/WebModuleUnit1.pas
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,17 @@ implementation
{$R *.dfm}


uses AppControllerU, MVCFramework.Commons, MVCFramework.Middleware.Redirect;
uses AppControllerU, MVCFramework.Commons, MVCFramework.Middleware.Redirect, MVCFramework.Middleware.Session;

procedure TWebModule1.WebModuleCreate(Sender: TObject);
begin
MVC := TMVCEngine.Create(Self,
procedure(Config: TMVCConfig)
begin
Config[TMVCConfigKey.SessionTimeout] := '10'; // 10minutes
Config[TMVCConfigKey.DefaultContentType] := 'text/plain';
Config[TMVCConfigKey.SessionType] := 'file';
end);
MVC.AddController(TApp1MainController);
MVC.AddMiddleware(UseFileSessionMiddleware(0));
MVC.AddMiddleware(TMVCRedirectMiddleware.Create(['/'], '/name'));
end;

Expand Down
114 changes: 0 additions & 114 deletions samples/sessioncustom/AppControllerU.pas

This file was deleted.

49 changes: 0 additions & 49 deletions samples/sessioncustom/CustomSessionSample.dpr

This file was deleted.

Loading

0 comments on commit 2742960

Please sign in to comment.