diff --git a/samples/CustomAuth/CustomAuthClient.dproj b/samples/CustomAuth/CustomAuthClient.dproj
index 500b02bd..3f3a5020 100644
--- a/samples/CustomAuth/CustomAuthClient.dproj
+++ b/samples/CustomAuth/CustomAuthClient.dproj
@@ -1,7 +1,7 @@

{B42B1969-7408-4E0A-8624-A48DADE46556}
- 18.8
+ 19.1
VCL
CustomAuthClient.dpr
True
@@ -86,11 +86,11 @@
true
1033
- CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
Debug
true
false
PerMonitor
+ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)
false
@@ -535,6 +535,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -667,6 +693,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -689,6 +725,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -788,6 +884,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -799,6 +905,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -843,6 +959,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -890,6 +1086,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
1
diff --git a/samples/CustomAuth/CustomAuthServer.dproj b/samples/CustomAuth/CustomAuthServer.dproj
index de903a3a..1667bd94 100644
--- a/samples/CustomAuth/CustomAuthServer.dproj
+++ b/samples/CustomAuth/CustomAuthServer.dproj
@@ -1,7 +1,7 @@

{0293A1B2-2793-41CE-9099-8B24A46AA8CF}
- 18.8
+ 19.1
VCL
CustomAuthServer.dpr
True
@@ -498,6 +498,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -630,6 +656,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -652,6 +688,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -751,6 +847,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -762,6 +868,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -806,6 +922,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -827,6 +1023,7 @@
+
1
diff --git a/samples/CustomAuth/MainClientFormU.pas b/samples/CustomAuth/MainClientFormU.pas
index 118038aa..3a838223 100644
--- a/samples/CustomAuth/MainClientFormU.pas
+++ b/samples/CustomAuth/MainClientFormU.pas
@@ -28,7 +28,7 @@ interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.AppEvnts, MVCFramework.RESTClient,
+ Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.AppEvnts, MVCFramework.RESTClient.Intf, MVCFramework.RESTClient,
Vcl.ExtCtrls;
type
@@ -59,10 +59,10 @@ type
procedure Button3Click(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
private
- FRESTClient: TRESTClient;
+ FRESTClient: IMVCRESTClient;
FLogoutUrl: string;
FLogoutMethod: string;
- procedure FillMemo(Response: IRESTResponse);
+ procedure FillMemo(Response: IMVCRESTResponse);
{ Private declarations }
public
{ Public declarations }
@@ -102,7 +102,7 @@ end;
procedure TForm7.btnLogInLogOutClick(Sender: TObject);
var
lJObj: TJSONObject;
- lRes: IRESTResponse;
+ lRes: IMVCRESTResponse;
begin
if btnLogInLogOut.Caption = 'LOGIN' then
begin
@@ -110,10 +110,10 @@ begin
try
lJObj.AddPair('username', edtUsername.Text);
lJObj.AddPair('password', edtPassword.Text);
- lRes := FRESTClient.doPOST('/system/users/logged', [], TSystemJSON.JSONValueToString(lJObj, False));
- if lRes.HasError then
+ lRes := FRESTClient.Post('/system/users/logged', TSystemJSON.JSONValueToString(lJObj, False));
+ if not lRes.Success then
begin
- ShowMessage(lRes.Error.ExceptionMessage);
+ ShowMessage(lRes.Content);
end;
FLogoutUrl := lRes.HeaderValue('X-LOGOUT-URL');
FLogoutMethod := lRes.HeaderValue('X-LOGOUT-METHOD');
@@ -124,50 +124,50 @@ begin
else
begin
Assert(FLogoutMethod = 'DELETE');
- lRes := FRESTClient.doDELETE(FLogoutUrl, []);
- if lRes.HasError then
+ lRes := FRESTClient.Delete(FLogoutUrl);
+ if not lRes.Success then
begin
- ShowMessage(lRes.Error.ExceptionMessage);
+ ShowMessage(lRes.Content);
end;
end;
end;
procedure TForm7.Button1Click(Sender: TObject);
var
- lRes: IRESTResponse;
+ lRes: IMVCRESTResponse;
begin
- lRes := FRESTClient.doGET('/private/public/action', []);
+ lRes := FRESTClient.Get('/private/public/action');
FillMemo(lRes);
end;
procedure TForm7.Button2Click(Sender: TObject);
var
- lRes: IRESTResponse;
+ lRes: IMVCRESTResponse;
begin
- lRes := FRESTClient.doGET('/private/role1', []);
+ lRes := FRESTClient.Get('/private/role1');
FillMemo(lRes);
end;
procedure TForm7.Button3Click(Sender: TObject);
var
- lRes: IRESTResponse;
+ lRes: IMVCRESTResponse;
begin
- lRes := FRESTClient.doGET('/private/role2', []);
+ lRes := FRESTClient.Get('/private/role2');
FillMemo(lRes);
end;
-procedure TForm7.FillMemo(Response: IRESTResponse);
+procedure TForm7.FillMemo(Response: IMVCRESTResponse);
begin
Memo1.Lines.Add(
Format('[%s] [%s] %s',
[TimeToStr(Time),
- Response.ResponseText,
- Response.BodyAsString]));
+ Response.StatusText,
+ Response.Content]));
end;
procedure TForm7.FormCreate(Sender: TObject);
begin
- FRESTClient := TRESTClient.Create('localhost', 8080);
+ FRESTClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
end;
procedure TForm7.ListBox1Click(Sender: TObject);
diff --git a/samples/CustomAuth/MyWebModuleU.pas b/samples/CustomAuth/MyWebModuleU.pas
index d8e178e3..9cb60638 100644
--- a/samples/CustomAuth/MyWebModuleU.pas
+++ b/samples/CustomAuth/MyWebModuleU.pas
@@ -84,10 +84,10 @@ begin
TCustomAuth.Create,
'/system/users/logged'
));
- FMVC.AddMiddleware(TMVCStaticFilesMiddleware.Create(
- '/', { StaticFilesPath }
- ExtractFilePath(GetModuleName(HInstance)) + 'www' { DocumentRoot }
- ));
+// FMVC.AddMiddleware(TMVCStaticFilesMiddleware.Create(
+// '/app', { StaticFilesPath }
+// ExtractFilePath(GetModuleName(HInstance)) + 'www' { DocumentRoot }
+// ));
end;
procedure TMyWebModule.WebModuleDestroy(Sender: TObject);
diff --git a/samples/CustomRoleAuth/CustomRoleAuthClient.dproj b/samples/CustomRoleAuth/CustomRoleAuthClient.dproj
index 73da4b90..2cc38566 100644
--- a/samples/CustomRoleAuth/CustomRoleAuthClient.dproj
+++ b/samples/CustomRoleAuth/CustomRoleAuthClient.dproj
@@ -1,7 +1,7 @@

{B42B1969-7408-4E0A-8624-A48DADE46556}
- 18.8
+ 19.1
VCL
CustomRoleAuthClient.dpr
True
@@ -90,6 +90,7 @@
true
false
PerMonitor
+ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)
false
@@ -528,6 +529,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -660,6 +687,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -682,6 +719,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -781,6 +878,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -792,6 +899,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -836,6 +953,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -883,6 +1080,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
1
diff --git a/samples/CustomRoleAuth/CustomRoleAuthServer.dproj b/samples/CustomRoleAuth/CustomRoleAuthServer.dproj
index fccfa021..913e710a 100644
--- a/samples/CustomRoleAuth/CustomRoleAuthServer.dproj
+++ b/samples/CustomRoleAuth/CustomRoleAuthServer.dproj
@@ -1,7 +1,7 @@

{0293A1B2-2793-41CE-9099-8B24A46AA8CF}
- 18.8
+ 19.1
VCL
CustomRoleAuthServer.dpr
True
@@ -492,6 +492,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -624,6 +650,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -646,6 +682,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -745,6 +841,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -756,6 +862,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -800,6 +916,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -821,6 +1017,7 @@
+
1
diff --git a/samples/CustomRoleAuth/MainClientFormU.pas b/samples/CustomRoleAuth/MainClientFormU.pas
index ebdd3b62..5306c25f 100644
--- a/samples/CustomRoleAuth/MainClientFormU.pas
+++ b/samples/CustomRoleAuth/MainClientFormU.pas
@@ -32,7 +32,7 @@ uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.AppEvnts,
- MVCFramework.RESTClient,
+ MVCFramework.RESTClient.Intf, MVCFramework.RESTClient,
Vcl.ExtCtrls;
type
@@ -71,10 +71,10 @@ type
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
private
- FRESTClient: TRESTClient;
+ FRESTClient: IMVCRESTClient;
FLogoutUrl: string;
FLogoutMethod: string;
- procedure FillMemo(Response: IRESTResponse);
+ procedure FillMemo(Response: IMVCRESTResponse);
{ Private declarations }
public
{ Public declarations }
@@ -113,7 +113,7 @@ end;
procedure TForm7.btnLogInLogOutClick(Sender: TObject);
var
lJObj: TJSONObject;
- lRes: IRESTResponse;
+ lRes: IMVCRESTResponse;
begin
if btnLogInLogOut.Caption = 'LOGIN' then
begin
@@ -121,11 +121,10 @@ begin
try
lJObj.AddPair('username', edtUsername.Text);
lJObj.AddPair('password', edtPassword.Text);
- lRes := FRESTClient.doPOST('/system/users/logged', [],
- TSystemJSON.JSONValueToString(lJObj, False));
- if lRes.HasError then
+ lRes := FRESTClient.Post('/system/users/logged', TSystemJSON.JSONValueToString(lJObj, False));
+ if not lRes.Success then
begin
- ShowMessage(lRes.Error.ExceptionMessage);
+ ShowMessage(lRes.Content);
end;
FLogoutUrl := lRes.HeaderValue('X-LOGOUT-URL');
FLogoutMethod := lRes.HeaderValue('X-LOGOUT-METHOD');
@@ -136,79 +135,79 @@ begin
else
begin
Assert(FLogoutMethod = 'DELETE');
- lRes := FRESTClient.doDELETE(FLogoutUrl, []);
- if lRes.HasError then
+ lRes := FRESTClient.Delete(FLogoutUrl);
+ if not lRes.Success then
begin
- ShowMessage(lRes.Error.ExceptionMessage);
+ ShowMessage(lRes.Content);
end;
end;
end;
procedure TForm7.Button1Click(Sender: TObject);
var
- lRes: IRESTResponse;
+ lRes: IMVCRESTResponse;
begin
- lRes := FRESTClient.doGET('/private/public/action', []);
+ lRes := FRESTClient.Get('/private/public/action');
FillMemo(lRes);
end;
procedure TForm7.Button2Click(Sender: TObject);
var
- lRes: IRESTResponse;
+ lRes: IMVCRESTResponse;
begin
- lRes := FRESTClient.doGET('/private/role1', []);
+ lRes := FRESTClient.Get('/private/role1');
FillMemo(lRes);
end;
procedure TForm7.Button3Click(Sender: TObject);
var
- lRes: IRESTResponse;
+ lRes: IMVCRESTResponse;
begin
- lRes := FRESTClient.doGET('/private/role2', []);
+ lRes := FRESTClient.Get('/private/role2');
FillMemo(lRes);
end;
procedure TForm7.Button4Click(Sender: TObject);
var
- lRes: IRESTResponse;
+ lRes: IMVCRESTResponse;
begin
- lRes := FRESTClient.doGET('/private/role1and2', []);
+ lRes := FRESTClient.Get('/private/role1and2');
FillMemo(lRes);
end;
procedure TForm7.Button5Click(Sender: TObject);
var
- lRes: IRESTResponse;
+ lRes: IMVCRESTResponse;
begin
- lRes := FRESTClient.doGET('/private/role/admin', []);
+ lRes := FRESTClient.Get('/private/role/admin');
FillMemo(lRes);
end;
procedure TForm7.Button6Click(Sender: TObject);
var
- lRes: IRESTResponse;
+ lRes: IMVCRESTResponse;
begin
- lRes := FRESTClient.doGET('/private/authenticatedOnly', []);
+ lRes := FRESTClient.Get('/private/authenticatedOnly');
FillMemo(lRes);
end;
procedure TForm7.Button7Click(Sender: TObject);
var
- lRes: IRESTResponse;
+ lRes: IMVCRESTResponse;
begin
- lRes := FRESTClient.doGET('/private/role1or2', []);
+ lRes := FRESTClient.Get('/private/role1or2');
FillMemo(lRes);
end;
-procedure TForm7.FillMemo(Response: IRESTResponse);
+procedure TForm7.FillMemo(Response: IMVCRESTResponse);
begin
Memo1.Lines.Add(Format('[%s] [%s] %s', [TimeToStr(Time),
- Response.ResponseText, Response.BodyAsString]));
+ Response.StatusText, Response.Content]));
end;
procedure TForm7.FormCreate(Sender: TObject);
begin
- FRESTClient := TRESTClient.Create('localhost', 8080);
+ FRESTClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
end;
procedure TForm7.ListBox1Click(Sender: TObject);
diff --git a/samples/CustomRoleAuth/MyWebModuleU.pas b/samples/CustomRoleAuth/MyWebModuleU.pas
index 5d99fd1c..c4ef2acf 100644
--- a/samples/CustomRoleAuth/MyWebModuleU.pas
+++ b/samples/CustomRoleAuth/MyWebModuleU.pas
@@ -84,10 +84,10 @@ begin
TCustomRoleAuth.Create,
'/system/users/logged'
));
- FMVC.AddMiddleware(TMVCStaticFilesMiddleware.Create(
- '/', { StaticFilesPath }
- ExtractFilePath(GetModuleName(HInstance)) + 'www' { DocumentRoot }
- ));
+// FMVC.AddMiddleware(TMVCStaticFilesMiddleware.Create(
+// '/', { StaticFilesPath }
+// ExtractFilePath(GetModuleName(HInstance)) + 'www' { DocumentRoot }
+// ));
end;
diff --git a/samples/articles_crud_vcl_client/MainFormU.pas b/samples/articles_crud_vcl_client/MainFormU.pas
index 0d8a0f99..0d1eff43 100644
--- a/samples/articles_crud_vcl_client/MainFormU.pas
+++ b/samples/articles_crud_vcl_client/MainFormU.pas
@@ -7,7 +7,7 @@ uses
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, FireDAC.Stan.Intf, FireDAC.Stan.Option,
FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf,
FireDAC.DApt.Intf, Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client,
- Vcl.Grids, Vcl.DBGrids, Vcl.ExtCtrls, Vcl.StdCtrls, MVCFramework.RESTClient,
+ Vcl.Grids, Vcl.DBGrids, Vcl.ExtCtrls, Vcl.StdCtrls, MVCFramework.RESTClient.Intf, MVCFramework.RESTClient,
Vcl.DBCtrls;
type
@@ -42,9 +42,9 @@ type
private
fFilter: string;
fLoading: Boolean;
- fRESTClient: TRESTClient;
+ fRESTClient: IMVCRESTClient;
{ Private declarations }
- procedure ShowError(const AResponse: IRESTResponse);
+ procedure ShowError(const AResponse: IMVCRESTResponse);
procedure SetFilter(const Value: string);
public
property Filter: string read fFilter write SetFilter;
@@ -87,19 +87,21 @@ end;
procedure TMainForm.dsArticlesAfterOpen(DataSet: TDataSet);
var
- Res: IRESTResponse;
+ Res: IMVCRESTResponse;
begin
if fFilter.IsEmpty then
begin
// this a simple sychronous request...
- Res := fRESTClient.doGET('/articles', []);
+ Res := fRESTClient.Get('/articles');
end
else
begin
- Res := fRESTClient.doGET('/articles/searches', [], ['q'], [fFilter]);
+ Res := fRESTClient
+ .AddQueryStringParam('q', fFilter)
+ .Get('/articles/searches');
end;
- if Res.HasError then
+ if not Res.Success then
begin
ShowError(Res);
Exit;
@@ -108,7 +110,7 @@ begin
DataSet.DisableControls;
try
fLoading := true;
- dsArticles.LoadJSONArrayFromJSONObjectProperty('data', Res.BodyAsString);
+ dsArticles.LoadJSONArrayFromJSONObjectProperty('data', Res.Content);
fLoading := false;
dsArticles.First;
finally
@@ -118,11 +120,11 @@ end;
procedure TMainForm.dsArticlesBeforeDelete(DataSet: TDataSet);
var
- Res: IRESTResponse;
+ Res: IMVCRESTResponse;
begin
if dsArticles.State = dsBrowse then
Res := fRESTClient.DataSetDelete('/articles', dsArticlesid.AsString);
- if not(Res.ResponseCode in [200]) then
+ if not(Res.StatusCode in [200]) then
begin
ShowError(Res);
Abort;
@@ -131,15 +133,15 @@ end;
procedure TMainForm.dsArticlesBeforePost(DataSet: TDataSet);
var
- Res: IRESTResponse;
+ Res: IMVCRESTResponse;
begin
if not fLoading then
begin
if dsArticles.State = dsInsert then
Res := fRESTClient.DataSetInsert('/articles', dsArticles)
else
- Res := fRESTClient.DataSetUpdate('/articles', dsArticles, dsArticlesid.AsString);
- if not(Res.ResponseCode in [200, 201]) then
+ Res := fRESTClient.DataSetUpdate('/articles', dsArticlesid.AsString, dsArticles);
+ if not(Res.StatusCode in [200, 201]) then
begin
ShowError(Res);
Abort;
@@ -159,22 +161,24 @@ end;
procedure TMainForm.dsArticlesBeforeRowRequest(DataSet: TFDDataSet);
var
- Res: IRESTResponse;
+ Res: IMVCRESTResponse;
begin
- Res := fRESTClient.doGET('/articles', [DataSet.FieldByName('id').AsString]);
+ Res := fRESTClient
+ .AddPathParam('param1', DataSet.FieldByName('id').AsString)
+ .Get('/articles/{param1}');
fLoading := true;
- DataSet.LoadJSONObjectFromJSONObjectProperty('data', Res.BodyAsString);
+ DataSet.LoadJSONObjectFromJSONObjectProperty('data', Res.Content);
fLoading := false;
end;
procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
- fRESTClient.Free;
+ fRESTClient := nil;
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
- fRESTClient := MVCFramework.RESTClient.TRESTClient.Create('localhost', 8080);
+ fRESTClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
end;
procedure TMainForm.SetFilter(const Value: string);
@@ -183,17 +187,17 @@ begin
EditFilter.Text := Value;
end;
-procedure TMainForm.ShowError(const AResponse: IRESTResponse);
+procedure TMainForm.ShowError(const AResponse: IMVCRESTResponse);
begin
- if AResponse.HasError then
+ if not AResponse.Success then
MessageDlg(
- AResponse.Error.HTTPError.ToString + ': ' + AResponse.Error.ExceptionMessage + sLineBreak +
- '[' + AResponse.Error.ExceptionClassname + ']',
+ AResponse.StatusCode.ToString + ': ' + AResponse.StatusText + sLineBreak +
+ '[' + AResponse.Content + ']',
mtError, [mbOK], 0)
else
MessageDlg(
- AResponse.ResponseCode.ToString + ': ' + AResponse.ResponseText + sLineBreak +
- AResponse.BodyAsString,
+ AResponse.StatusCode.ToString + ': ' + AResponse.StatusText + sLineBreak +
+ AResponse.Content,
mtError, [mbOK], 0);
end;
diff --git a/samples/articles_crud_vcl_client/ProjectGroup.groupproj b/samples/articles_crud_vcl_client/ProjectGroup.groupproj
index d29365ed..94412375 100644
--- a/samples/articles_crud_vcl_client/ProjectGroup.groupproj
+++ b/samples/articles_crud_vcl_client/ProjectGroup.groupproj
@@ -3,10 +3,10 @@
{AF04BD45-3137-4757-B1AC-147D4136E52C}
-
+
-
+
@@ -17,15 +17,6 @@
-
-
-
-
-
-
-
-
-
@@ -35,14 +26,23 @@
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
diff --git a/samples/articles_crud_vcl_client_api_binder/MainFormU.pas b/samples/articles_crud_vcl_client_api_binder/MainFormU.pas
index 41f4c4ab..459fdb75 100644
--- a/samples/articles_crud_vcl_client_api_binder/MainFormU.pas
+++ b/samples/articles_crud_vcl_client_api_binder/MainFormU.pas
@@ -7,7 +7,7 @@ uses
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, FireDAC.Stan.Intf, FireDAC.Stan.Option,
FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf,
FireDAC.DApt.Intf, Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client,
- Vcl.Grids, Vcl.DBGrids, Vcl.ExtCtrls, Vcl.StdCtrls, MVCFramework.RESTClient,
+ Vcl.Grids, Vcl.DBGrids, Vcl.ExtCtrls, Vcl.StdCtrls, MVCFramework.RESTClient.Intf, MVCFramework.RESTClient,
Vcl.DBCtrls, MVCFramework.DataSet.Utils;
type
@@ -42,10 +42,10 @@ type
private
fFilter: string;
fLoading: Boolean;
- fRESTClient: TRESTClient;
+ fRESTClient: IMVCRESTClient;
fAPIBinder: TMVCAPIBinder;
{ Private declarations }
- procedure ShowError(const AResponse: IRESTResponse);
+ procedure ShowError(const AResponse: IMVCRESTResponse);
procedure SetFilter(const Value: string);
public
property Filter: string read fFilter write SetFilter;
@@ -88,19 +88,21 @@ end;
procedure TMainForm.dsArticlesAfterOpen(DataSet: TDataSet);
var
- Res: IRESTResponse;
+ Res: IMVCRESTResponse;
begin
if fFilter.IsEmpty then
begin
// this a simple sychronous request...
- Res := fRESTClient.doGET('/articles', []);
+ Res := fRESTClient.Get('/articles');
end
else
begin
- Res := fRESTClient.doGET('/articles/searches', [], ['q'], [fFilter]);
+ Res := fRESTClient
+ .AddQueryStringParam('q', fFilter)
+ .Get('/articles/searches');
end;
- if Res.HasError then
+ if not Res.Success then
begin
ShowError(Res);
Exit;
@@ -109,7 +111,7 @@ begin
DataSet.DisableControls;
try
fLoading := true;
- dsArticles.LoadJSONArrayFromJSONObjectProperty('data', Res.BodyAsString);
+ dsArticles.LoadJSONArrayFromJSONObjectProperty('data', Res.Content);
fLoading := false;
dsArticles.First;
finally
@@ -119,11 +121,11 @@ end;
procedure TMainForm.dsArticlesBeforeDelete(DataSet: TDataSet);
var
- Res: IRESTResponse;
+ Res: IMVCRESTResponse;
begin
if dsArticles.State = dsBrowse then
Res := fRESTClient.DataSetDelete('/articles', dsArticlesid.AsString);
- if not(Res.ResponseCode in [200]) then
+ if not(Res.StatusCode in [200]) then
begin
ShowError(Res);
Abort;
@@ -132,15 +134,15 @@ end;
procedure TMainForm.dsArticlesBeforePost(DataSet: TDataSet);
var
- Res: IRESTResponse;
+ Res: IMVCRESTResponse;
begin
if not fLoading then
begin
if dsArticles.State = dsInsert then
Res := fRESTClient.DataSetInsert('/articles', dsArticles)
else
- Res := fRESTClient.DataSetUpdate('/articles', dsArticles, dsArticlesid.AsString);
- if not(Res.ResponseCode in [200, 201]) then
+ Res := fRESTClient.DataSetUpdate('/articles', dsArticlesid.AsString, dsArticles);
+ if not(Res.StatusCode in [200, 201]) then
begin
ShowError(Res);
Abort;
@@ -160,23 +162,25 @@ end;
procedure TMainForm.dsArticlesBeforeRowRequest(DataSet: TFDDataSet);
var
- Res: IRESTResponse;
+ Res: IMVCRESTResponse;
begin
- Res := fRESTClient.doGET('/articles', [DataSet.FieldByName('id').AsString]);
+ Res := fRESTClient
+ .AddPathParam('param1', DataSet.FieldByName('id').AsString)
+ .Get('/articles/{param1}');
fLoading := true;
- DataSet.LoadJSONObjectFromJSONObjectProperty('data', Res.BodyAsString);
+ DataSet.LoadJSONObjectFromJSONObjectProperty('data', Res.Content);
fLoading := false;
end;
procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
fAPIBinder.Free;
- fRESTClient.Free;
+ fRESTClient := nil;
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
- fRESTClient := MVCFramework.RESTClient.TRESTClient.Create('localhost', 8080);
+ fRESTClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
fAPIBinder := TMVCAPIBinder.Create(fRESTClient);
fAPIBinder.BindDataSetToAPI(dsArticles, '/articles', 'id');
end;
@@ -187,17 +191,17 @@ begin
EditFilter.Text := Value;
end;
-procedure TMainForm.ShowError(const AResponse: IRESTResponse);
+procedure TMainForm.ShowError(const AResponse: IMVCRESTResponse);
begin
- if AResponse.HasError then
+ if not AResponse.Success then
MessageDlg(
- AResponse.Error.HTTPError.ToString + ': ' + AResponse.Error.ExceptionMessage + sLineBreak +
- '[' + AResponse.Error.ExceptionClassname + ']',
+ AResponse.StatusCode.ToString + ': ' + AResponse.StatusText + sLineBreak +
+ '[' + AResponse.Content + ']',
mtError, [mbOK], 0)
else
MessageDlg(
- AResponse.ResponseCode.ToString + ': ' + AResponse.ResponseText + sLineBreak +
- AResponse.BodyAsString,
+ AResponse.StatusCode.ToString + ': ' + AResponse.StatusText + sLineBreak +
+ AResponse.Content,
mtError, [mbOK], 0);
end;
diff --git a/samples/articles_crud_vcl_client_api_binder/articles_crud_vcl_client_api_binder.dproj b/samples/articles_crud_vcl_client_api_binder/articles_crud_vcl_client_api_binder.dproj
index 4fc2daab..b005a03a 100644
--- a/samples/articles_crud_vcl_client_api_binder/articles_crud_vcl_client_api_binder.dproj
+++ b/samples/articles_crud_vcl_client_api_binder/articles_crud_vcl_client_api_binder.dproj
@@ -1,7 +1,7 @@

{B180E3D7-5F42-49CE-84F1-042196300A37}
- 18.8
+ 19.1
VCL
articles_crud_vcl_client_api_binder.dpr
True
@@ -82,7 +82,6 @@
1033
true
true
- CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
Debug
false
@@ -527,6 +526,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -659,6 +684,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -681,6 +716,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -780,6 +875,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -791,6 +896,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -835,6 +950,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -882,6 +1077,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
1
diff --git a/samples/articles_crud_vcl_client_meta/MainFormU.dfm b/samples/articles_crud_vcl_client_meta/MainFormU.dfm
index b3af38c9..c85f68fc 100644
--- a/samples/articles_crud_vcl_client_meta/MainFormU.dfm
+++ b/samples/articles_crud_vcl_client_meta/MainFormU.dfm
@@ -41,7 +41,6 @@ object MainForm: TMainForm
Caption = 'Open'
TabOrder = 0
OnClick = btnOpenClick
- ExplicitTop = 1
end
object btnRefreshRecord: TButton
AlignWithMargins = True
diff --git a/samples/articles_crud_vcl_client_meta/MainFormU.pas b/samples/articles_crud_vcl_client_meta/MainFormU.pas
index e4978de2..8ed0c01f 100644
--- a/samples/articles_crud_vcl_client_meta/MainFormU.pas
+++ b/samples/articles_crud_vcl_client_meta/MainFormU.pas
@@ -7,7 +7,7 @@ uses
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, FireDAC.Stan.Intf, FireDAC.Stan.Option,
FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf,
FireDAC.DApt.Intf, Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client,
- Vcl.Grids, Vcl.DBGrids, Vcl.ExtCtrls, Vcl.StdCtrls, MVCFramework.RESTClient,
+ Vcl.Grids, Vcl.DBGrids, Vcl.ExtCtrls, Vcl.StdCtrls, MVCFramework.RESTClient.Intf, MVCFramework.RESTClient,
Vcl.DBCtrls;
type
@@ -38,9 +38,9 @@ type
private
fFilter: string;
fLoading: Boolean;
- fRESTClient: TRESTClient;
+ fRESTClient: IMVCRESTClient;
{ Private declarations }
- procedure ShowError(const AResponse: IRESTResponse);
+ procedure ShowError(const AResponse: IMVCRESTResponse);
procedure SetFilter(const Value: string);
public
property Filter: string read fFilter write SetFilter;
@@ -72,19 +72,19 @@ end;
procedure TMainForm.btnOpenClick(Sender: TObject);
var
- Res: IRESTResponse;
+ Res: IMVCRESTResponse;
lJMeta: TJSONObject;
begin
dsArticles.Close;
- Res := fRESTClient.doGET('/articles/meta', []);
- if Res.HasError then
+ Res := fRESTClient.Get('/articles/meta');
+ if not Res.Success then
begin
ShowError(Res);
Exit;
end;
- Log.Debug(Res.BodyAsString, 'trace');
- lJMeta := StrToJSONObject(Res.BodyAsString);
+ Log.Debug(Res.Content, 'trace');
+ lJMeta := StrToJSONObject(Res.Content);
try
TFireDACUtils.CreateDatasetFromMetadata(dsArticles, lJMeta.O['data']);
// dsArticles.CreateDatasetFromMetadata(lJMeta);
@@ -103,30 +103,32 @@ end;
procedure TMainForm.dsArticlesAfterOpen(DataSet: TDataSet);
var
- Res: IRESTResponse;
+ Res: IMVCRESTResponse;
begin
if fFilter.IsEmpty then
begin
// this a simple sychronous request...
- Res := fRESTClient.doGET('/articles', []);
+ Res := fRESTClient.Get('/articles');
end
else
begin
- Res := fRESTClient.doGET('/articles/searches', [], ['q'], [fFilter]);
+ Res := fRESTClient
+ .AddQueryStringParam('q', fFilter)
+ .Get('/articles/searches');
end;
- if Res.HasError then
+ if not Res.Success then
begin
ShowError(Res);
Exit;
end;
- Log.Debug(Res.BodyAsString, 'trace');
+ Log.Debug(Res.Content, 'trace');
DataSet.DisableControls;
try
fLoading := true;
- dsArticles.LoadJSONArrayFromJSONObjectProperty('data', Res.BodyAsString);
+ dsArticles.LoadJSONArrayFromJSONObjectProperty('data', Res.Content);
fLoading := false;
dsArticles.First;
finally
@@ -136,11 +138,11 @@ end;
procedure TMainForm.dsArticlesBeforeDelete(DataSet: TDataSet);
var
- Res: IRESTResponse;
+ Res: IMVCRESTResponse;
begin
if dsArticles.State = dsBrowse then
Res := fRESTClient.DataSetDelete('/articles', dsArticles.FieldByName('id').AsString);
- if not(Res.ResponseCode in [200]) then
+ if not(Res.StatusCode in [200]) then
begin
ShowError(Res);
Abort;
@@ -149,15 +151,15 @@ end;
procedure TMainForm.dsArticlesBeforePost(DataSet: TDataSet);
var
- Res: IRESTResponse;
+ Res: IMVCRESTResponse;
begin
if not fLoading then
begin
if dsArticles.State = dsInsert then
Res := fRESTClient.DataSetInsert('/articles', dsArticles)
else
- Res := fRESTClient.DataSetUpdate('/articles', dsArticles, dsArticles.FieldByName('id').AsString);
- if not(Res.ResponseCode in [200, 201]) then
+ Res := fRESTClient.DataSetUpdate('/articles', dsArticles.FieldByName('id').AsString, dsArticles);
+ if not(Res.StatusCode in [200, 201]) then
begin
ShowError(Res);
Abort;
@@ -177,22 +179,24 @@ end;
procedure TMainForm.dsArticlesBeforeRowRequest(DataSet: TFDDataSet);
var
- Res: IRESTResponse;
+ Res: IMVCRESTResponse;
begin
- Res := fRESTClient.doGET('/articles', [DataSet.FieldByName('id').AsString]);
+ Res := fRESTClient
+ .AddPathParam('param1', DataSet.FieldByName('id').AsString)
+ .Get('/articles/{param1}');
fLoading := true;
- DataSet.LoadJSONObjectFromJSONObjectProperty('data', Res.BodyAsString);
+ DataSet.LoadJSONObjectFromJSONObjectProperty('data', Res.Content);
fLoading := false;
end;
procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
- fRESTClient.Free;
+ fRESTClient := nil;
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
- fRESTClient := MVCFramework.RESTClient.TRESTClient.Create('localhost', 8080);
+ fRESTClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
end;
procedure TMainForm.SetFilter(const Value: string);
@@ -201,17 +205,17 @@ begin
EditFilter.Text := Value;
end;
-procedure TMainForm.ShowError(const AResponse: IRESTResponse);
+procedure TMainForm.ShowError(const AResponse: IMVCRESTResponse);
begin
- if AResponse.HasError then
+ if AResponse.Success then
MessageDlg(
- AResponse.Error.HTTPError.ToString + ': ' + AResponse.Error.ExceptionMessage + sLineBreak +
- '[' + AResponse.Error.ExceptionClassname + ']',
+ AResponse.StatusCode.ToString + ': ' + AResponse.StatusText + sLineBreak +
+ '[' + AResponse.Content + ']',
mtError, [mbOK], 0)
else
MessageDlg(
- AResponse.ResponseCode.ToString + ': ' + AResponse.ResponseText + sLineBreak +
- AResponse.BodyAsString,
+ AResponse.StatusCode.ToString + ': ' + AResponse.StatusText + sLineBreak +
+ AResponse.Content,
mtError, [mbOK], 0);
end;
diff --git a/samples/authenticationauthorization/AuthenticateAuthorize.dpr b/samples/authenticationauthorization/AuthenticateAuthorize.dpr
index e29efc0d..2067422f 100644
--- a/samples/authenticationauthorization/AuthenticateAuthorize.dpr
+++ b/samples/authenticationauthorization/AuthenticateAuthorize.dpr
@@ -30,7 +30,7 @@ begin
LServer.Active := True;
Writeln('Press RETURN to stop the server');
{$IFDEF MSWINDOWS}
- ShellExecute(0, 'open', PChar('http://localhost:' + IntToStr(APort)), nil, nil, SW_SHOW);
+ ShellExecute(0, 'open', PChar('http://localhost:' + IntToStr(APort) + '/app'), nil, nil, SW_SHOW);
{$ENDIF}
ReadLn;
finally
diff --git a/samples/authenticationauthorization/AuthenticateAuthorize.dproj b/samples/authenticationauthorization/AuthenticateAuthorize.dproj
index 49dc1943..30387c68 100644
--- a/samples/authenticationauthorization/AuthenticateAuthorize.dproj
+++ b/samples/authenticationauthorization/AuthenticateAuthorize.dproj
@@ -1,7 +1,7 @@

{7B54055A-5749-4136-9FE2-35FDBEEA874C}
- 18.8
+ 19.1
VCL
AuthenticateAuthorize.dpr
True
@@ -541,6 +541,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -673,6 +699,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -695,6 +731,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -794,6 +890,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -805,6 +911,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -849,6 +965,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -870,6 +1066,7 @@
+
1
diff --git a/samples/authenticationauthorization/WebModuleUnit1.pas b/samples/authenticationauthorization/WebModuleUnit1.pas
index d8bff330..b85e5e18 100644
--- a/samples/authenticationauthorization/WebModuleUnit1.pas
+++ b/samples/authenticationauthorization/WebModuleUnit1.pas
@@ -48,7 +48,7 @@ begin
.AddController(TAdminController)
.AddMiddleware(TMVCBasicAuthenticationMiddleware.Create(TAuthenticationSample.Create))
.AddMiddleware(TMVCStaticFilesMiddleware.Create(
- '/', { StaticFilesPath }
+ '/app', { StaticFilesPath }
'..\..\www', { DocumentRoot }
'index.html',
False { not serving a SPA }
diff --git a/samples/authenticationauthorization/vclclient/AuthenticationAuthorizationClient.dproj b/samples/authenticationauthorization/vclclient/AuthenticationAuthorizationClient.dproj
index 5c713889..fda121a9 100644
--- a/samples/authenticationauthorization/vclclient/AuthenticationAuthorizationClient.dproj
+++ b/samples/authenticationauthorization/vclclient/AuthenticationAuthorizationClient.dproj
@@ -1,7 +1,7 @@

{E7317702-64D3-4A65-8734-030F3AE3DBBC}
- 18.8
+ 19.1
VCL
AuthenticationAuthorizationClient.dpr
True
@@ -536,6 +536,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -668,6 +694,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -690,6 +726,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -789,6 +885,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -800,6 +906,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -844,6 +960,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -891,6 +1087,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
1
diff --git a/samples/authenticationauthorization/vclclient/MainClientFormU.pas b/samples/authenticationauthorization/vclclient/MainClientFormU.pas
index 61a936c8..1b8177c1 100644
--- a/samples/authenticationauthorization/vclclient/MainClientFormU.pas
+++ b/samples/authenticationauthorization/vclclient/MainClientFormU.pas
@@ -25,21 +25,18 @@ implementation
{$R *.dfm}
uses
+ MVCFramework.RESTClient.Intf,
MVCFramework.RESTClient;
procedure TForm5.btnGetClick(Sender: TObject);
var
- lClient: TRESTClient;
- lRest: IRESTResponse;
+ lClient: IMVCRESTClient;
+ lRest: IMVCRESTResponse;
begin
- lClient := TRESTClient.Create('localhost', 8080);
- try
- lClient.Authentication('user1', 'user1');
- lRest := lClient.doGET('/admin/role1?par1=daniele', []);
- ShowMessage(lRest.BodyAsString);
- finally
- lClient.Free;
- end;
+ lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClient.SetBasicAuthorization('user1', 'user1');
+ lRest := lClient.Get('/admin/role1?par1=daniele');
+ ShowMessage(lRest.Content);
end;
end.
diff --git a/samples/basicdemo_server/WebModuleUnit1.pas b/samples/basicdemo_server/WebModuleUnit1.pas
index a97ec670..932da25d 100644
--- a/samples/basicdemo_server/WebModuleUnit1.pas
+++ b/samples/basicdemo_server/WebModuleUnit1.pas
@@ -41,7 +41,7 @@ begin
end);
// Web files
- MVC.AddMiddleware(TMVCStaticFilesMiddleware.Create('/', '.\www\public_html'));
+ MVC.AddMiddleware(TMVCStaticFilesMiddleware.Create('/app', '.\www\public_html'));
// Image files
MVC.AddMiddleware(TMVCStaticFilesMiddleware.Create('/images', '.\www\public_images', 'database.png'));
diff --git a/samples/basicdemo_vclclient/Unit1.pas b/samples/basicdemo_vclclient/Unit1.pas
index 290434c5..ae2cef6d 100644
--- a/samples/basicdemo_vclclient/Unit1.pas
+++ b/samples/basicdemo_vclclient/Unit1.pas
@@ -25,6 +25,7 @@ var
implementation
uses
+ MVCFramework.RESTClient.Intf,
MVCFramework.RESTClient;
{$R *.dfm}
@@ -32,28 +33,18 @@ uses
procedure TForm1.Button1Click(Sender: TObject);
var
- Clt: TRestClient;
+ Clt: IMVCRESTClient;
begin
- Clt := MVCFramework.RESTClient.TRestClient.Create('http://localhost', 8080, nil);
- try
- // Clt.ProxyServer := 'localhost';
- // Clt.ProxyPort := 8888;
- ShowMessage(Clt.doGET('/div/10/20', []).BodyAsString);
- finally
- Clt.Free;
- end;
+ Clt := TMVCRESTClient.New.BaseURL('http://localhost', 8080);
+ ShowMessage(Clt.Get('/div/10/20').Content);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
- Clt: TRestClient;
+ Clt: IMVCRESTClient;
begin
- Clt := MVCFramework.RESTClient.TRestClient.Create('http://localhost', 8080, nil);
- try
- ShowMessage(Clt.doPOST('/hello', [], '{"name":"Bob äöüß"}').BodyAsString);
- finally
- Clt.Free;
- end;
+ Clt := TMVCRESTClient.New.BaseURL('http://localhost', 8080);
+ ShowMessage(Clt.Post('/hello', '{"name":"Bob äöüß"}').Content);
end;
end.
diff --git a/samples/data/ORDERSMANAGER_FB30.FDB b/samples/data/ORDERSMANAGER_FB30.FDB
index 1310f5ea..7cee3a01 100644
Binary files a/samples/data/ORDERSMANAGER_FB30.FDB and b/samples/data/ORDERSMANAGER_FB30.FDB differ
diff --git a/samples/jsonwebtoken/JWTServer.dproj b/samples/jsonwebtoken/JWTServer.dproj
index e42e56f2..db26f2fa 100644
--- a/samples/jsonwebtoken/JWTServer.dproj
+++ b/samples/jsonwebtoken/JWTServer.dproj
@@ -1,7 +1,7 @@

{7B54055A-5749-4136-9FE2-35FDBEEA874C}
- 18.8
+ 19.1
VCL
JWTServer.dpr
True
@@ -541,6 +541,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -673,6 +699,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -695,6 +731,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -794,6 +890,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -805,6 +911,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -849,6 +965,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -870,6 +1066,7 @@
+
1
diff --git a/samples/jsonwebtoken/WebModuleUnit1.pas b/samples/jsonwebtoken/WebModuleUnit1.pas
index de7b4cae..593fde53 100644
--- a/samples/jsonwebtoken/WebModuleUnit1.pas
+++ b/samples/jsonwebtoken/WebModuleUnit1.pas
@@ -63,7 +63,7 @@ begin
lClaimsSetup,
[TJWTCheckableClaim.ExpirationTime, TJWTCheckableClaim.NotBefore, TJWTCheckableClaim.IssuedAt], 300))
.AddMiddleware(TMVCStaticFilesMiddleware.Create(
- '/', { StaticFilesPath }
+ '/app', { StaticFilesPath }
'..\..\www' { DocumentRoot }
));
end;
diff --git a/samples/jsonwebtoken/vclclient/JWTClient.dproj b/samples/jsonwebtoken/vclclient/JWTClient.dproj
index 3518ee45..1d38bfb3 100644
--- a/samples/jsonwebtoken/vclclient/JWTClient.dproj
+++ b/samples/jsonwebtoken/vclclient/JWTClient.dproj
@@ -1,7 +1,7 @@

{E7317702-64D3-4A65-8734-030F3AE3DBBC}
- 18.8
+ 19.1
VCL
JWTClient.dpr
True
@@ -85,12 +85,12 @@
true
- CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
1033
Debug
true
false
PerMonitor
+ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)
false
@@ -536,6 +536,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -668,6 +694,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -690,6 +726,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -789,6 +885,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -800,6 +906,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -844,6 +960,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -891,6 +1087,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
1
diff --git a/samples/jsonwebtoken/vclclient/MainClientFormU.pas b/samples/jsonwebtoken/vclclient/MainClientFormU.pas
index 6c6de04e..0798cbf2 100644
--- a/samples/jsonwebtoken/vclclient/MainClientFormU.pas
+++ b/samples/jsonwebtoken/vclclient/MainClientFormU.pas
@@ -49,157 +49,123 @@ implementation
uses
+ MVCFramework.RESTClient.Intf,
MVCFramework.RESTClient,
MVCFramework.SystemJSONUtils,
System.JSON;
procedure TForm5.btnGetClick(Sender: TObject);
var
- lClient: TRESTClient;
- lResp: IRESTResponse;
- lQueryStringParams: TStringList;
+ lClient: IMVCRESTClient;
+ lResp: IMVCRESTResponse;
begin
{ Getting JSON response }
- lClient := TRESTClient.Create('localhost', 8080);
- try
- lClient.UseBasicAuthentication := False;
- lClient.ReadTimeOut(0);
- if not FJWT.IsEmpty then
- begin
- lClient.RequestHeaders.Values[TMVCJWTDefaults.AUTHORIZATION_HEADER] := 'Bearer ' + FJWT;
- end;
- lQueryStringParams := TStringList.Create;
- try
- lQueryStringParams.Values['firstname'] := 'Daniele';
- lQueryStringParams.Values['lastname'] := 'Teti';
- lResp := lClient.doGET('/admin/role1', [], lQueryStringParams);
- if lResp.HasError then
- ShowMessage(lResp.Error.ExceptionMessage);
- finally
- lQueryStringParams.Free;
- end;
- Memo2.Lines.Text := lResp.BodyAsString;
- finally
- lClient.Free;
+ lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClient.ReadTimeOut(0);
+ if not FJWT.IsEmpty then
+ begin
+ lClient.SetBearerAuthorization(FJWT);
end;
+ lClient
+ .AddQueryStringParam('firstname', 'Daniele')
+ .AddQueryStringParam('lastname', 'Teti');
+ lResp := lClient.Get('/admin/role1');
+ if not lResp.Success then
+ ShowMessage(lResp.Content);
+
+ Memo2.Lines.Text := lResp.Content;
+
{ Getting HTML response }
- lClient := TRESTClient.Create('localhost', 8080);
- try
- // when the JWT authorization header is named "Authorization", the basic authorization must be disabled
- lClient.UseBasicAuthentication := False;
-
- lClient.ReadTimeOut(0);
- if not FJWT.IsEmpty then
- lClient.RequestHeaders.Values[TMVCJWTDefaults.AUTHORIZATION_HEADER] := 'Bearer ' + FJWT;
- lQueryStringParams := TStringList.Create;
- try
- lQueryStringParams.Values['firstname'] := 'Daniele';
- lQueryStringParams.Values['lastname'] := 'Teti';
- lResp := lClient.Accept('text/html').doGET('/admin/role1', [], lQueryStringParams);
- if lResp.HasError then
- ShowMessage(lResp.Error.ExceptionMessage);
- finally
- lQueryStringParams.Free;
- end;
- Memo3.Lines.Text := lResp.BodyAsString;
- finally
- lClient.Free;
- end;
+ lClient
+ .AddQueryStringParam('firstname', 'Daniele')
+ .AddQueryStringParam('lastname', 'Teti');
+ lResp := lClient.Accept('text/html').Get('/admin/role1');
+ if not lResp.Success then
+ ShowMessage(lResp.Content);
+ Memo3.Lines.Text := lResp.Content;
end;
procedure TForm5.btnLOGINClick(Sender: TObject);
var
- lClient: TRESTClient;
- lRest: IRESTResponse;
+ lClient: IMVCRESTClient;
+ lRest: IMVCRESTResponse;
lJSON: TJSONObject;
begin
- lClient := TRESTClient.Create('localhost', 8080);
+ lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClient.ReadTimeOut(0);
+ lClient.SetBasicAuthorization('user1', 'user1');
+ lRest := lClient.Post('/login');
+ if not lRest.Success then
+ begin
+ ShowMessage(
+ 'HTTP ERROR: ' + lRest.StatusCode.ToString + sLineBreak +
+ 'HTTP ERROR MESSAGE: ' + lRest.StatusText + sLineBreak +
+ 'ERROR MESSAGE: ' + lRest.Content);
+ Exit;
+ end;
+
+ lJSON := TSystemJSON.StringAsJSONObject(lRest.Content);
try
- lClient.ReadTimeOut(0);
- lClient.Authentication('user1', 'user1');
- lRest := lClient.doPOST('/login', []);
- if lRest.HasError then
- begin
- ShowMessage(
- 'HTTP ERROR: ' + lRest.Error.HTTPError.ToString + sLineBreak +
- 'APPLICATION ERROR CODE: ' + lRest.Error.ErrorNumber.ToString + sLineBreak +
- 'EXCEPTION MESSAGE: ' + lRest.Error.ExceptionMessage);
-
- Exit;
- end;
-
- lJSON := TSystemJSON.StringAsJSONObject(lRest.BodyAsString);
- try
- JWT := lJSON.GetValue('token').Value;
- finally
- lJSON.Free;
- end;
+ JWT := lJSON.GetValue('token').Value;
finally
- lClient.Free;
+ lJSON.Free;
end;
end;
procedure TForm5.btnLoginJsonObjectClick(Sender: TObject);
var
- lClient: TRESTClient;
- lRest: IRESTResponse;
+ lClient: IMVCRESTClient;
+ lRest: IMVCRESTResponse;
lJSON: TJSONObject;
begin
- lClient := TRESTClient.Create('localhost', 8080);
+ lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClient.ReadTimeOut(0);
+ lRest := lClient.Post('/login', '{"jwtusername":"user1","jwtpassword":"user1"}');
+
+ if not lRest.Success then
+ begin
+ ShowMessage(
+ 'HTTP ERROR: ' + lRest.StatusCode.ToString + sLineBreak +
+ 'HTTP ERROR MESSAGE: ' + lRest.StatusText + sLineBreak +
+ 'ERROR MESSAGE: ' + lRest.Content);
+
+ Exit;
+ end;
+
+ lJSON := TSystemJSON.StringAsJSONObject(lRest.Content);
try
- lClient.ReadTimeOut(0);
- lRest := lClient.doPOST('/login', [], '{"jwtusername":"user1","jwtpassword":"user1"}');
- if lRest.HasError then
- begin
- ShowMessage(
- 'HTTP ERROR: ' + lRest.Error.HTTPError.ToString + sLineBreak +
- 'APPLICATION ERROR CODE: ' + lRest.Error.ErrorNumber.ToString + sLineBreak +
- 'EXCEPTION MESSAGE: ' + lRest.Error.ExceptionMessage);
-
- Exit;
- end;
-
- lJSON := TSystemJSON.StringAsJSONObject(lRest.BodyAsString);
- try
- JWT := lJSON.GetValue('token').Value;
- finally
- lJSON.Free;
- end;
+ JWT := lJSON.GetValue('token').Value;
finally
- lClient.Free;
+ lJSON.Free;
end;
end;
procedure TForm5.btnLoginWithExceptionClick(Sender: TObject);
var
- lClient: TRESTClient;
- lRest: IRESTResponse;
+ lClient: IMVCRESTClient;
+ lRest: IMVCRESTResponse;
lJSON: TJSONObject;
begin
- lClient := TRESTClient.Create('localhost', 8080);
- try
- lClient.ReadTimeOut(0);
- lClient.Authentication('user_raise_exception', 'user_raise_exception');
- lRest := lClient.doPOST('/login', []);
- if lRest.HasError then
- begin
- ShowMessage(
- 'HTTP ERROR: ' + lRest.Error.HTTPError.ToString + sLineBreak +
- 'APPLICATION ERROR CODE: ' + lRest.Error.ErrorNumber.ToString + sLineBreak +
- 'EXCEPTION MESSAGE: ' + lRest.Error.ExceptionMessage);
- Exit;
- end;
+ lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClient.ReadTimeOut(0);
+ lClient.SetBasicAuthorization('user_raise_exception', 'user_raise_exception');
+ lRest := lClient.Post('/login');
+ if not lRest.Success then
+ begin
+ ShowMessage(
+ 'HTTP ERROR: ' + lRest.StatusCode.ToString + sLineBreak +
+ 'HTTP ERROR MESSAGE: ' + lRest.StatusText + sLineBreak +
+ 'ERROR MESSAGE: ' + lRest.Content);
+ Exit;
+ end;
- lJSON := TSystemJSON.StringAsJSONObject(lRest.BodyAsString);
- try
- JWT := lJSON.GetValue('token').Value;
- finally
- lJSON.Free;
- end;
+ lJSON := TSystemJSON.StringAsJSONObject(lRest.Content);
+ try
+ JWT := lJSON.GetValue('token').Value;
finally
- lClient.Free;
+ lJSON.Free;
end;
end;
diff --git a/samples/jsonwebtoken_livevaliditywindow/JWTServer.dproj b/samples/jsonwebtoken_livevaliditywindow/JWTServer.dproj
index d43b3d16..f24af40d 100644
--- a/samples/jsonwebtoken_livevaliditywindow/JWTServer.dproj
+++ b/samples/jsonwebtoken_livevaliditywindow/JWTServer.dproj
@@ -1,7 +1,7 @@

{7B54055A-5749-4136-9FE2-35FDBEEA874C}
- 18.8
+ 19.1
VCL
JWTServer.dpr
True
@@ -13,16 +13,6 @@
true
-
- true
- Base
- true
-
-
- true
- Base
- true
-
true
Base
@@ -73,67 +63,6 @@
false
false
-
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
- true
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
- true
- $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
- true
- $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
- $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
- true
- true
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
- true
- true
- android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
- package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
- $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
- true
- Debug
- true
- true
- $(BDS)\bin\Artwork\Android\FM_NotificationIcon_24x24.png
- $(BDS)\bin\Artwork\Android\FM_NotificationIcon_36x36.png
- $(BDS)\bin\Artwork\Android\FM_NotificationIcon_48x48.png
- $(BDS)\bin\Artwork\Android\FM_NotificationIcon_72x72.png
- $(BDS)\bin\Artwork\Android\FM_NotificationIcon_96x96.png
-
-
- package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
- Debug
- true
- Base
- true
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
- true
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
- true
- $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
- true
- $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
- $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
- true
- true
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
- true
- true
- android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
- $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
- true
- true
- true
- $(BDS)\bin\Artwork\Android\FM_NotificationIcon_24x24.png
- $(BDS)\bin\Artwork\Android\FM_NotificationIcon_36x36.png
- $(BDS)\bin\Artwork\Android\FM_NotificationIcon_48x48.png
- $(BDS)\bin\Artwork\Android\FM_NotificationIcon_72x72.png
- $(BDS)\bin\Artwork\Android\FM_NotificationIcon_96x96.png
-
Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
1033
@@ -611,6 +540,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -743,6 +698,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -765,6 +730,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -864,6 +889,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -875,6 +910,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -919,6 +964,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -940,6 +1065,7 @@
+
1
@@ -1041,8 +1167,6 @@
- False
- False
True
False
diff --git a/samples/jsonwebtoken_livevaliditywindow/WebModuleUnit1.pas b/samples/jsonwebtoken_livevaliditywindow/WebModuleUnit1.pas
index 3f92143e..f6b98a10 100644
--- a/samples/jsonwebtoken_livevaliditywindow/WebModuleUnit1.pas
+++ b/samples/jsonwebtoken_livevaliditywindow/WebModuleUnit1.pas
@@ -67,11 +67,11 @@ begin
TAuthenticationSample.Create, lClaimsSetup, 'mys3cr37', '/login',
[TJWTCheckableClaim.ExpirationTime, TJWTCheckableClaim.NotBefore, TJWTCheckableClaim.IssuedAt], 0
// just for test, Leeway seconds is zero.
- ))
- .AddMiddleware(TMVCStaticFilesMiddleware.Create(
- '/', { StaticFilesPath }
- '..\..\www' { DocumentRoot }
));
+// .AddMiddleware(TMVCStaticFilesMiddleware.Create(
+// '/', { StaticFilesPath }
+// '..\..\www' { DocumentRoot }
+// ));
end;
end.
diff --git a/samples/jsonwebtoken_livevaliditywindow/vclclient/JWTClient.dproj b/samples/jsonwebtoken_livevaliditywindow/vclclient/JWTClient.dproj
index 97af7565..17ee4b0d 100644
--- a/samples/jsonwebtoken_livevaliditywindow/vclclient/JWTClient.dproj
+++ b/samples/jsonwebtoken_livevaliditywindow/vclclient/JWTClient.dproj
@@ -1,7 +1,7 @@

{E7317702-64D3-4A65-8734-030F3AE3DBBC}
- 18.8
+ 19.1
VCL
JWTClient.dpr
True
@@ -85,12 +85,12 @@
true
- CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
1033
Debug
true
false
PerMonitor
+ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)
false
@@ -536,6 +536,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -668,6 +694,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -690,6 +726,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -789,6 +885,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -800,6 +906,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -844,6 +960,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -891,6 +1087,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
1
diff --git a/samples/jsonwebtoken_livevaliditywindow/vclclient/MainClientFormU.dfm b/samples/jsonwebtoken_livevaliditywindow/vclclient/MainClientFormU.dfm
index 2cd2ebb0..b13e09f3 100644
--- a/samples/jsonwebtoken_livevaliditywindow/vclclient/MainClientFormU.dfm
+++ b/samples/jsonwebtoken_livevaliditywindow/vclclient/MainClientFormU.dfm
@@ -36,8 +36,7 @@ object MainForm: TMainForm
Font.Style = []
ParentFont = False
ReadOnly = True
- TabOrder = 0
- ExplicitWidth = 721
+ TabOrder = 1
end
object Memo2: TMemo
Left = 0
@@ -52,8 +51,7 @@ object MainForm: TMainForm
Font.Style = []
ParentFont = False
ReadOnly = True
- TabOrder = 1
- ExplicitWidth = 721
+ TabOrder = 2
end
object Panel1: TPanel
Left = 0
@@ -61,14 +59,13 @@ object MainForm: TMainForm
Width = 908
Height = 81
Align = alTop
- TabOrder = 2
- ExplicitWidth = 721
+ TabOrder = 0
object Label1: TLabel
AlignWithMargins = True
Left = 540
Top = 4
- Width = 355
- Height = 65
+ Width = 364
+ Height = 73
Align = alClient
Caption =
'At each authenticated request, the server increments the "exp" p' +
@@ -77,6 +74,8 @@ object MainForm: TMainForm
'alidityWindowInSeconds seconds. It is useful to mimic the classi' +
'c session cookie with the semplicity of the JWT.'
WordWrap = True
+ ExplicitWidth = 355
+ ExplicitHeight = 65
end
object btnGet: TButton
AlignWithMargins = True
@@ -86,10 +85,9 @@ object MainForm: TMainForm
Height = 73
Align = alLeft
Caption = 'Get a protected resource (with an updated JWT)'
- TabOrder = 0
+ TabOrder = 3
WordWrap = True
OnClick = btnGetClick
- ExplicitLeft = 250
end
object btnLOGIN: TButton
AlignWithMargins = True
@@ -99,7 +97,7 @@ object MainForm: TMainForm
Height = 73
Align = alLeft
Caption = 'Login (Custom headers)'
- TabOrder = 1
+ TabOrder = 0
WordWrap = True
OnClick = btnLOGINClick
end
@@ -111,7 +109,7 @@ object MainForm: TMainForm
Height = 73
Align = alLeft
Caption = 'Login (with Basic Schema)'
- TabOrder = 2
+ TabOrder = 1
WordWrap = True
OnClick = btnLoginWithHeaderBasicClick
end
@@ -123,11 +121,9 @@ object MainForm: TMainForm
Height = 73
Align = alLeft
Caption = 'Login (with JSON Object)'
- TabOrder = 3
+ TabOrder = 2
WordWrap = True
OnClick = Button1Click
- ExplicitLeft = 311
- ExplicitTop = 2
end
end
end
diff --git a/samples/jsonwebtoken_livevaliditywindow/vclclient/MainClientFormU.pas b/samples/jsonwebtoken_livevaliditywindow/vclclient/MainClientFormU.pas
index 7a7710d1..df1d8267 100644
--- a/samples/jsonwebtoken_livevaliditywindow/vclclient/MainClientFormU.pas
+++ b/samples/jsonwebtoken_livevaliditywindow/vclclient/MainClientFormU.pas
@@ -39,6 +39,7 @@ implementation
uses
+ MVCFramework.RESTClient.Intf,
MVCFramework.RESTClient,
MVCFramework.Middleware.JWT,
MVCFramework.Commons,
@@ -48,117 +49,94 @@ uses
procedure TMainForm.btnGetClick(Sender: TObject);
var
- lClient: TRESTClient;
- lResp: IRESTResponse;
- lQueryStringParams: TStringList;
+ lClient: IMVCRESTClient;
+ lResp: IMVCRESTResponse;
tokenOld, tokenNew: string; // NEW CODE
begin
tokenOld := FJWT; // NEW CODE
- lClient := TRESTClient.Create('localhost', 8080);
- try
- lClient.ReadTimeOut(0);
- if not FJWT.IsEmpty then
- begin
- lClient.RequestHeaders.Values[TMVCJWTDefaults.AUTHORIZATION_HEADER] := 'Bearer ' + FJWT;
- end;
- lQueryStringParams := TStringList.Create;
- try
- lQueryStringParams.Values['firstname'] := 'Daniele';
- lQueryStringParams.Values['lastname'] := 'Teti';
- lResp := lClient.doGET('/admin/role1', [], lQueryStringParams);
-
- if lResp.HasError then
- ShowMessage(lResp.Error.Status + sLineBreak + lResp.Error.ExceptionMessage);
-
- finally
- lQueryStringParams.Free;
- end;
- Memo2.Lines.Text := lResp.BodyAsString;
-
- // NEW CODE
- tokenNew := lResp.HeaderValue(TMVCJWTDefaults.AUTHORIZATION_HEADER);
- if tokenNew.StartsWith('Bearer', True) then
- begin
- tokenNew := tokenNew.Remove(0, 'Bearer'.Length).Trim;
- tokenNew := TNetEncoding.URL.URLDecode(tokenNew).Trim;
- JWT := tokenNew;
- end; // END NEW CODE
- finally
- lClient.Free;
+ lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClient.ReadTimeOut(0);
+ if not FJWT.IsEmpty then
+ begin
+ lClient.SetBearerAuthorization(FJWT);
end;
+ lClient
+ .AddQueryStringParam('firstname', 'Daniele')
+ .AddQueryStringParam('lastname', 'Teti');
+ lResp := lClient.Get('/admin/role1');
+
+ if not lResp.Success then
+ ShowMessage(lResp.StatusCode.ToString + sLineBreak + lResp.Content);
+
+ Memo2.Lines.Text := lResp.Content;
+
+ // NEW CODE
+ tokenNew := lResp.HeaderValue(TMVCJWTDefaults.AUTHORIZATION_HEADER);
+ if tokenNew.StartsWith('Bearer', True) then
+ begin
+ tokenNew := tokenNew.Remove(0, 'Bearer'.Length).Trim;
+ tokenNew := TNetEncoding.URL.URLDecode(tokenNew).Trim;
+ JWT := tokenNew;
+ end; // END NEW CODE
end;
procedure TMainForm.btnLOGINClick(Sender: TObject);
var
- lClient: TRESTClient;
- lRest: IRESTResponse;
+ lClient: IMVCRESTClient;
+ lRest: IMVCRESTResponse;
lJSON: TJSONObject;
begin
- lClient := TRESTClient.Create('localhost', 8080);
+ lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClient.ReadTimeOut(0);
+ lClient.AddHeader(TMVCJWTDefaults.USERNAME_HEADER, 'user1').AddHeader(TMVCJWTDefaults.PASSWORD_HEADER, 'user1');
+ lRest := lClient.Get('/login'); { any HTTP verbs is OK }
+ lJSON := StrToJSONObject(lRest.Content);
try
- lClient.ReadTimeOut(0);
- lClient.Header(TMVCJWTDefaults.USERNAME_HEADER, 'user1').Header(TMVCJWTDefaults.PASSWORD_HEADER, 'user1');
- lRest := lClient.doGET('/login', []); { any HTTP verbs is OK }
- lJSON := StrToJSONObject(lRest.BodyAsString);
- try
- JWT := lJSON.S['token'];
- finally
- lJSON.Free;
- end;
+ JWT := lJSON.S['token'];
finally
- lClient.Free;
+ lJSON.Free;
end;
end;
procedure TMainForm.btnLoginWithHeaderBasicClick(Sender: TObject);
var
- lClient: TRESTClient;
- lRest: IRESTResponse;
+ lClient: IMVCRESTClient;
+ lRest: IMVCRESTResponse;
lJSON: TJSONObject;
begin
- lClient := TRESTClient.Create('localhost', 8080);
+ lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClient.ReadTimeOut(0);
+ lClient.SetBasicAuthorization('user1', 'user1');
+ lRest := lClient.Post('/login');
+ lJSON := StrToJSONObject(lRest.Content);
try
- lClient.ReadTimeOut(0);
- lClient.Authentication('user1', 'user1');
- lRest := lClient.doPOST('/login', []);
- lJSON := StrToJSONObject(lRest.BodyAsString);
- try
- JWT := lJSON.S['token'];
- finally
- lJSON.Free;
- end;
+ JWT := lJSON.S['token'];
finally
- lClient.Free;
+ lJSON.Free;
end;
end;
procedure TMainForm.Button1Click(Sender: TObject);
var
- lClient: TRESTClient;
- lRest: IRESTResponse;
+ lClient: IMVCRESTClient;
+ lRest: IMVCRESTResponse;
lJSON: TJSONObject;
begin
- lClient := TRESTClient.Create('localhost', 8080);
+ lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClient.ReadTimeOut(0);
+ lRest := lClient.Post('/login', '{"jwtusername":"user1","jwtpassword":"user1"}');
+ lJSON := StrToJSONObject(lRest.Content);
try
- lClient.ReadTimeOut(0);
- lRest := lClient.doPOST('/login', [], '{"jwtusername":"user1","jwtpassword":"user1"}');
- lJSON := StrToJSONObject(lRest.BodyAsString);
- try
- JWT := lJSON.S['token'];
- finally
- lJSON.Free;
- end;
+ JWT := lJSON.S['token'];
finally
- lClient.Free;
+ lJSON.Free;
end;
-
end;
procedure TMainForm.SetJWT(const Value: string);
begin
FJWT := Value;
Memo1.Lines.Text := Value;
-
end;
end.
diff --git a/samples/jsonwebtoken_roleauth/JWTRoleAuthServer.dproj b/samples/jsonwebtoken_roleauth/JWTRoleAuthServer.dproj
index 954d2fdc..bd2868de 100644
--- a/samples/jsonwebtoken_roleauth/JWTRoleAuthServer.dproj
+++ b/samples/jsonwebtoken_roleauth/JWTRoleAuthServer.dproj
@@ -1,7 +1,7 @@

{7B54055A-5749-4136-9FE2-35FDBEEA874C}
- 18.8
+ 19.1
VCL
JWTRoleAuthServer.dpr
True
@@ -540,6 +540,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -672,6 +698,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -694,6 +730,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -793,6 +889,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -804,6 +910,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -848,6 +964,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -869,6 +1065,7 @@
+
1
diff --git a/samples/jsonwebtoken_roleauth/WebModuleUnit1.pas b/samples/jsonwebtoken_roleauth/WebModuleUnit1.pas
index 5af0b8bf..8d27936f 100644
--- a/samples/jsonwebtoken_roleauth/WebModuleUnit1.pas
+++ b/samples/jsonwebtoken_roleauth/WebModuleUnit1.pas
@@ -58,11 +58,11 @@ begin
.AddController(TAdminController)
.AddMiddleware(TMVCJWTAuthenticationMiddleware.Create(TAuthenticationSample.Create, 'mys3cr37', '/login',
lClaimsSetup,
- [TJWTCheckableClaim.ExpirationTime, TJWTCheckableClaim.NotBefore, TJWTCheckableClaim.IssuedAt], 300))
- .AddMiddleware(TMVCStaticFilesMiddleware.Create(
- '/', { StaticFilesPath }
- '..\..\www' { DocumentRoot }
- ));
+ [TJWTCheckableClaim.ExpirationTime, TJWTCheckableClaim.NotBefore, TJWTCheckableClaim.IssuedAt], 300));
+// .AddMiddleware(TMVCStaticFilesMiddleware.Create(
+// '/', { StaticFilesPath }
+// '..\..\www' { DocumentRoot }
+// ));
end;
procedure TWebModule1.WebModuleDestroy(Sender: TObject);
diff --git a/samples/jsonwebtoken_roleauth/vclclient/JWTClient.dproj b/samples/jsonwebtoken_roleauth/vclclient/JWTClient.dproj
index 3518ee45..1d38bfb3 100644
--- a/samples/jsonwebtoken_roleauth/vclclient/JWTClient.dproj
+++ b/samples/jsonwebtoken_roleauth/vclclient/JWTClient.dproj
@@ -1,7 +1,7 @@

{E7317702-64D3-4A65-8734-030F3AE3DBBC}
- 18.8
+ 19.1
VCL
JWTClient.dpr
True
@@ -85,12 +85,12 @@
true
- CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
1033
Debug
true
false
PerMonitor
+ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)
false
@@ -536,6 +536,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -668,6 +694,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -690,6 +726,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -789,6 +885,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -800,6 +906,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -844,6 +960,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -891,6 +1087,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
1
diff --git a/samples/jsonwebtoken_roleauth/vclclient/MainClientFormU.pas b/samples/jsonwebtoken_roleauth/vclclient/MainClientFormU.pas
index 6c6de04e..82bd7a37 100644
--- a/samples/jsonwebtoken_roleauth/vclclient/MainClientFormU.pas
+++ b/samples/jsonwebtoken_roleauth/vclclient/MainClientFormU.pas
@@ -49,157 +49,120 @@ implementation
uses
+ MVCFramework.RESTClient.Intf,
MVCFramework.RESTClient,
MVCFramework.SystemJSONUtils,
System.JSON;
procedure TForm5.btnGetClick(Sender: TObject);
var
- lClient: TRESTClient;
- lResp: IRESTResponse;
- lQueryStringParams: TStringList;
+ lClient: IMVCRESTClient;
+ lResp: IMVCRESTResponse;
begin
{ Getting JSON response }
- lClient := TRESTClient.Create('localhost', 8080);
- try
- lClient.UseBasicAuthentication := False;
- lClient.ReadTimeOut(0);
- if not FJWT.IsEmpty then
- begin
- lClient.RequestHeaders.Values[TMVCJWTDefaults.AUTHORIZATION_HEADER] := 'Bearer ' + FJWT;
- end;
- lQueryStringParams := TStringList.Create;
- try
- lQueryStringParams.Values['firstname'] := 'Daniele';
- lQueryStringParams.Values['lastname'] := 'Teti';
- lResp := lClient.doGET('/admin/role1', [], lQueryStringParams);
- if lResp.HasError then
- ShowMessage(lResp.Error.ExceptionMessage);
- finally
- lQueryStringParams.Free;
- end;
- Memo2.Lines.Text := lResp.BodyAsString;
- finally
- lClient.Free;
+ lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClient.ReadTimeOut(0);
+ if not FJWT.IsEmpty then
+ begin
+ lClient.SetBearerAuthorization(FJWT);
end;
+ lClient
+ .AddQueryStringParam('firstname', 'Daniele')
+ .AddQueryStringParam('lastname', 'Teti');
+ lResp := lClient.Get('/admin/role1');
+ if not lResp.Success then
+ ShowMessage(lResp.Content);
+ Memo2.Lines.Text := lResp.Content;
{ Getting HTML response }
- lClient := TRESTClient.Create('localhost', 8080);
- try
- // when the JWT authorization header is named "Authorization", the basic authorization must be disabled
- lClient.UseBasicAuthentication := False;
-
- lClient.ReadTimeOut(0);
- if not FJWT.IsEmpty then
- lClient.RequestHeaders.Values[TMVCJWTDefaults.AUTHORIZATION_HEADER] := 'Bearer ' + FJWT;
- lQueryStringParams := TStringList.Create;
- try
- lQueryStringParams.Values['firstname'] := 'Daniele';
- lQueryStringParams.Values['lastname'] := 'Teti';
- lResp := lClient.Accept('text/html').doGET('/admin/role1', [], lQueryStringParams);
- if lResp.HasError then
- ShowMessage(lResp.Error.ExceptionMessage);
- finally
- lQueryStringParams.Free;
- end;
- Memo3.Lines.Text := lResp.BodyAsString;
- finally
- lClient.Free;
- end;
+ lClient
+ .AddQueryStringParam('firstname', 'Daniele')
+ .AddQueryStringParam('lastname', 'Teti');
+ lResp := lClient.Accept('text/html').Get('/admin/role1');
+ if not lResp.Success then
+ ShowMessage(lResp.Content);
+ Memo3.Lines.Text := lResp.Content;
end;
procedure TForm5.btnLOGINClick(Sender: TObject);
var
- lClient: TRESTClient;
- lRest: IRESTResponse;
+ lClient: IMVCRESTClient;
+ lRest: IMVCRESTResponse;
lJSON: TJSONObject;
begin
- lClient := TRESTClient.Create('localhost', 8080);
+ lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClient.ReadTimeOut(0);
+ lClient.SetBasicAuthorization('user1', 'user1');
+ lRest := lClient.Post('/login');
+ if not lRest.Success then
+ begin
+ ShowMessage(
+ 'HTTP ERROR: ' + lRest.StatusCode.ToString + sLineBreak +
+ 'HTTP ERROR MESSAGE: ' + lRest.StatusText + sLineBreak +
+ 'ERROR MESSAGE: ' + lRest.Content);
+ Exit;
+ end;
+
+ lJSON := TSystemJSON.StringAsJSONObject(lRest.Content);
try
- lClient.ReadTimeOut(0);
- lClient.Authentication('user1', 'user1');
- lRest := lClient.doPOST('/login', []);
- if lRest.HasError then
- begin
- ShowMessage(
- 'HTTP ERROR: ' + lRest.Error.HTTPError.ToString + sLineBreak +
- 'APPLICATION ERROR CODE: ' + lRest.Error.ErrorNumber.ToString + sLineBreak +
- 'EXCEPTION MESSAGE: ' + lRest.Error.ExceptionMessage);
-
- Exit;
- end;
-
- lJSON := TSystemJSON.StringAsJSONObject(lRest.BodyAsString);
- try
- JWT := lJSON.GetValue('token').Value;
- finally
- lJSON.Free;
- end;
+ JWT := lJSON.GetValue('token').Value;
finally
- lClient.Free;
+ lJSON.Free;
end;
end;
procedure TForm5.btnLoginJsonObjectClick(Sender: TObject);
var
- lClient: TRESTClient;
- lRest: IRESTResponse;
+ lClient: IMVCRESTClient;
+ lRest: IMVCRESTResponse;
lJSON: TJSONObject;
begin
- lClient := TRESTClient.Create('localhost', 8080);
+ lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClient.ReadTimeOut(0);
+ lRest := lClient.Post('/login', '{"jwtusername":"user1","jwtpassword":"user1"}');
+ if not lRest.Success then
+ begin
+ ShowMessage(
+ 'HTTP ERROR: ' + lRest.StatusCode.ToString + sLineBreak +
+ 'HTTP ERROR MESSAGE: ' + lRest.StatusText + sLineBreak +
+ 'ERROR MESSAGE: ' + lRest.Content);
+
+ Exit;
+ end;
+
+ lJSON := TSystemJSON.StringAsJSONObject(lRest.Content);
try
- lClient.ReadTimeOut(0);
- lRest := lClient.doPOST('/login', [], '{"jwtusername":"user1","jwtpassword":"user1"}');
- if lRest.HasError then
- begin
- ShowMessage(
- 'HTTP ERROR: ' + lRest.Error.HTTPError.ToString + sLineBreak +
- 'APPLICATION ERROR CODE: ' + lRest.Error.ErrorNumber.ToString + sLineBreak +
- 'EXCEPTION MESSAGE: ' + lRest.Error.ExceptionMessage);
-
- Exit;
- end;
-
- lJSON := TSystemJSON.StringAsJSONObject(lRest.BodyAsString);
- try
- JWT := lJSON.GetValue('token').Value;
- finally
- lJSON.Free;
- end;
+ JWT := lJSON.GetValue('token').Value;
finally
- lClient.Free;
+ lJSON.Free;
end;
end;
procedure TForm5.btnLoginWithExceptionClick(Sender: TObject);
var
- lClient: TRESTClient;
- lRest: IRESTResponse;
+ lClient: IMVCRESTClient;
+ lRest: IMVCRESTResponse;
lJSON: TJSONObject;
begin
- lClient := TRESTClient.Create('localhost', 8080);
- try
- lClient.ReadTimeOut(0);
- lClient.Authentication('user_raise_exception', 'user_raise_exception');
- lRest := lClient.doPOST('/login', []);
- if lRest.HasError then
- begin
- ShowMessage(
- 'HTTP ERROR: ' + lRest.Error.HTTPError.ToString + sLineBreak +
- 'APPLICATION ERROR CODE: ' + lRest.Error.ErrorNumber.ToString + sLineBreak +
- 'EXCEPTION MESSAGE: ' + lRest.Error.ExceptionMessage);
- Exit;
- end;
+ lClient := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClient.ReadTimeOut(0);
+ lClient.SetBasicAuthorization('user_raise_exception', 'user_raise_exception');
+ lRest := lClient.Post('/login');
+ if not lRest.Success then
+ begin
+ ShowMessage(
+ 'HTTP ERROR: ' + lRest.StatusCode.ToString + sLineBreak +
+ 'HTTP ERROR MESSAGE: ' + lRest.StatusText + sLineBreak +
+ 'ERROR MESSAGE: ' + lRest.Content);
+ Exit;
+ end;
- lJSON := TSystemJSON.StringAsJSONObject(lRest.BodyAsString);
- try
- JWT := lJSON.GetValue('token').Value;
- finally
- lJSON.Free;
- end;
+ lJSON := TSystemJSON.StringAsJSONObject(lRest.Content);
+ try
+ JWT := lJSON.GetValue('token').Value;
finally
- lClient.Free;
+ lJSON.Free;
end;
end;
diff --git a/samples/jsonwebtokenplain/MainClientFormU.pas b/samples/jsonwebtokenplain/MainClientFormU.pas
index 97128115..d27d3c07 100644
--- a/samples/jsonwebtokenplain/MainClientFormU.pas
+++ b/samples/jsonwebtokenplain/MainClientFormU.pas
@@ -35,42 +35,33 @@ var
implementation
uses
- mvcframework.restclient;
+ MVCFramework.RESTClient.Intf,
+ MVCFramework.RESTClient;
{$R *.dfm}
procedure TForm7.Button1Click(Sender: TObject);
var
- lClt: TRESTClient;
- lResp: IRESTResponse;
+ lClt: IMVCRESTClient;
+ lResp: IMVCRESTResponse;
begin
- lClt := TRESTClient.Create('localhost', 8080);
- try
- lResp := lClt.doPOST('/login', [], '');
- Token := lResp.BodyAsString;
- finally
- lClt.Free;
- end;
- ShowMessage
- ('In the next 15 seconds you can request protected resources. After your token will expires!');
+ lClt := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lResp := lClt.Post('/login');
+ Token := lResp.Content;
+ ShowMessage('In the next 15 seconds you can request protected resources. After your token will expires!');
end;
procedure TForm7.Button2Click(Sender: TObject);
var
- lClt: TRESTClient;
- lResp: IRESTResponse;
+ lClt: IMVCRESTClient;
+ lResp: IMVCRESTResponse;
begin
- lClt := TRESTClient.Create('localhost', 8080);
- try
- lClt.Header('Authentication', 'bearer ' + FToken);
- lResp := lClt.doGET('/', []);
- ShowMessage(lResp.ResponseText + sLineBreak +
- lResp.BodyAsString);
- finally
- lClt.Free;
- end;
-
+ lClt := TMVCRESTClient.New.BaseURL('localhost', 8080);
+ lClt.AddHeader('Authentication', 'bearer ' + FToken);
+ lResp := lClt.Get('/');
+ ShowMessage(lResp.StatusText + sLineBreak +
+ lResp.Content);
end;
procedure TForm7.SetToken(const Value: String);
diff --git a/samples/jsonwebtokenplain/MainWebModuleU.pas b/samples/jsonwebtokenplain/MainWebModuleU.pas
index be80e1be..a65fec6a 100644
--- a/samples/jsonwebtokenplain/MainWebModuleU.pas
+++ b/samples/jsonwebtokenplain/MainWebModuleU.pas
@@ -50,10 +50,10 @@ begin
Config[TMVCConfigKey.ExposeServerSignature] := 'true';
end);
FMVC.AddController(TMyController);
- FMVC.AddMiddleware(TMVCStaticFilesMiddleware.Create(
- '/', { StaticFilesPath }
- ExtractFilePath(GetModuleName(HInstance)) + '\www' { DocumentRoot }
- ));
+// FMVC.AddMiddleware(TMVCStaticFilesMiddleware.Create(
+// '/', { StaticFilesPath }
+// ExtractFilePath(GetModuleName(HInstance)) + '\www' { DocumentRoot }
+// ));
end;
procedure TMyWebModule.WebModuleDestroy(Sender: TObject);
diff --git a/samples/jsonwebtokenplain/jwtplainclient.dproj b/samples/jsonwebtokenplain/jwtplainclient.dproj
index d55dea43..fdf228c0 100644
--- a/samples/jsonwebtokenplain/jwtplainclient.dproj
+++ b/samples/jsonwebtokenplain/jwtplainclient.dproj
@@ -1,7 +1,7 @@

{4ED511D7-CDE6-4B08-BE53-3CDA175959DC}
- 18.8
+ 19.1
VCL
jwtplainclient.dpr
True
@@ -87,9 +87,9 @@
Debug
true
1033
- CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
true
false
+ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)
PerMonitor
@@ -535,6 +535,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -667,6 +693,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -689,6 +725,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -788,6 +884,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -799,6 +905,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -843,6 +959,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -890,6 +1086,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
1
diff --git a/samples/jsonwebtokenplain/jwtplainserver.dproj b/samples/jsonwebtokenplain/jwtplainserver.dproj
index ed4dc929..581ac6c5 100644
--- a/samples/jsonwebtokenplain/jwtplainserver.dproj
+++ b/samples/jsonwebtokenplain/jwtplainserver.dproj
@@ -1,7 +1,7 @@

{AEC8E5FC-43FF-4A30-979F-66F976F9172B}
- 18.8
+ 19.1
VCL
jwtplainserver.dpr
True
@@ -496,6 +496,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -628,6 +654,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -650,6 +686,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -749,6 +845,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -760,6 +866,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -804,6 +920,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -825,6 +1021,7 @@
+
1
diff --git a/samples/sslclient/MainFormU.dfm b/samples/sslclient/MainFormU.dfm
index e83d8ec8..e5e8c7eb 100644
--- a/samples/sslclient/MainFormU.dfm
+++ b/samples/sslclient/MainFormU.dfm
@@ -80,14 +80,4 @@ object Form9: TForm9
Left = 32
Top = 112
end
- object IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL
- MaxLineAction = maException
- Port = 0
- DefaultPort = 0
- SSLOptions.Mode = sslmUnassigned
- SSLOptions.VerifyMode = []
- SSLOptions.VerifyDepth = 0
- Left = 264
- Top = 64
- end
end
diff --git a/samples/sslclient/MainFormU.pas b/samples/sslclient/MainFormU.pas
index a2273ae4..88b020f8 100644
--- a/samples/sslclient/MainFormU.pas
+++ b/samples/sslclient/MainFormU.pas
@@ -14,20 +14,12 @@ uses
Vcl.Dialogs,
IPPeerClient,
Vcl.StdCtrls,
+ MVCFramework.RESTClient.Intf,
MVCFramework.RESTClient,
REST.Client,
Data.Bind.Components,
Data.Bind.ObjectScope,
- IdIOHandler,
- IdIOHandlerSocket,
- IdIOHandlerStack,
- IdSSL,
- IdSSLOpenSSL,
- IdBaseComponent,
- IdComponent,
- IdTCPConnection,
- IdTCPClient,
- IdHTTP;
+ REST.Types;
type
TForm9 = class(TForm)
@@ -36,13 +28,11 @@ type
Button1: TButton;
Memo1: TMemo;
Button2: TButton;
- IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
- Clt: MVCFramework.RESTClient.TRESTClient;
+ Clt: IMVCRESTClient;
{ Private declarations }
public
{ Public declarations }
@@ -66,29 +56,31 @@ end;
procedure TForm9.Button2Click(Sender: TObject);
begin
- Clt.Asynch(
- procedure(Resp: IRESTResponse)
+ Clt
+ .SetValidateServerCertificateProc(
+ procedure(const Sender: TObject; const ARequest: TURLRequest;
+ const Certificate: TCertificate; var Accepted: Boolean)
begin
- Memo1.Lines.Text := Resp.BodyAsString;
+ //
+ Accepted := True;
+ end
+ )
+ .Async(
+ procedure(Resp: IMVCRESTResponse)
+ begin
+ Memo1.Lines.Text := Resp.Content;
+ Memo1.Lines.Add('Request Terminated successfully')
end,
procedure(E: Exception)
begin
ShowMessage(E.Message);
- end,
- procedure
- begin
- Memo1.Lines.Add('Request Terminated');
- end, true).doGET('/people', []);
-end;
-
-procedure TForm9.FormClose(Sender: TObject; var Action: TCloseAction);
-begin
- Clt.Free;
+ Memo1.Lines.Add('Request Terminated with errors')
+ end, True).Get('/people');
end;
procedure TForm9.FormCreate(Sender: TObject);
begin
- Clt := MVCFramework.RESTClient.TRESTClient.Create('https://localhost', 443, IdSSLIOHandlerSocketOpenSSL1);
+ Clt := TMVCRESTClient.New.BaseURL('https://localhost');
end;
end.
diff --git a/samples/sslclient/sslclient.dproj b/samples/sslclient/sslclient.dproj
index cbef91e3..50674f8d 100644
--- a/samples/sslclient/sslclient.dproj
+++ b/samples/sslclient/sslclient.dproj
@@ -1,7 +1,7 @@

{1C98038B-43FA-4CF4-8324-F08C1BC9D191}
- 18.8
+ 19.1
VCL
sslclient.dpr
True
@@ -556,6 +556,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -688,6 +714,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -710,6 +746,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -809,6 +905,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -820,6 +926,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -864,6 +980,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -911,6 +1107,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
1
diff --git a/samples/sslserver/SSLSample.dproj b/samples/sslserver/SSLSample.dproj
index 1cef31c0..992d1de5 100644
--- a/samples/sslserver/SSLSample.dproj
+++ b/samples/sslserver/SSLSample.dproj
@@ -1,7 +1,7 @@

{C6A43575-0F1C-4BE1-AC97-88DD0821D55E}
- 18.8
+ 19.1
VCL
SSLSample.dpr
True
@@ -13,16 +13,6 @@
true
-
- true
- Base
- true
-
-
- true
- Base
- true
-
true
Base
@@ -72,39 +62,6 @@
false
false
-
- true
- Base
- true
- $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
- true
- true
- android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
- true
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
- $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
- $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
- $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
- true
- true
- true
- true
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
- true
- $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
- true
- true
- Debug
- package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
-
-
- true
- Base
- true
- Debug
-
Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
FireDACSqliteDriver;TsiLang_XE5r;DBXSqliteDriver;FireDACPgDriver;fmx;TreeViewPresenter;IndySystem;i18n;TeeDB;frx19;vclib;inetdbbde;DBXInterBaseDriver;DataSnapClient;DataSnapCommon;DataSnapServer;DataSnapProviderClient;DPFAndroidPackagesXE5;DBXSybaseASEDriver;DbxCommonDriver;vclimg;dbxcds;DatasnapConnectorsFreePascal;MetropolisUILiveTile;vcldb;vcldsnap;fmxFireDAC;DBXDb2Driver;DBXOracleDriver;CustomIPTransport;vclribbon;dsnap;IndyIPServer;i18nDB;fmxase;vcl;IndyCore;IndyIPCommon;CloudService;DBXMSSQLDriver;FmxTeeUI;FireDACIBDriver;CodeSiteExpressPkg;DataSnapFireDAC;FireDACDBXDriver;inetdbxpress;FireDACDb2Driver;adortl;CustomAdaptersMDPackage;DataBindingsVCL;FireDACASADriver;bindcompfmx;vcldbx;FireDACODBCDriver;rtl;dbrtl;DbxClientDriver;FireDACCommon;bindcomp;inetdb;Tee;DataBindings;DBXOdbcDriver;vclFireDAC;CPortLibDXE;xmlrtl;svnui;ibxpress;IndyProtocols;DBXMySQLDriver;FireDACCommonDriver;bindengine;vclactnband;soaprtl;bindcompdbx;FMXTee;TeeUI;bindcompvcl;vclie;FireDACADSDriver;vcltouch;fmxinfopower;VclSmp;FireDACMSSQLDriver;FireDAC;VCLRESTComponents;Intraweb;DBXInformixDriver;DataSnapConnectors;FireDACDataSnapDriver;dsnapcon;DBXFirebirdDriver;inet;fmxobj;FireDACMySQLDriver;vclx;svn;DBXSybaseASADriver;FireDACOracleDriver;fmxdae;RESTComponents;bdertl;VirtualTreesR;FireDACMSAccDriver;DataSnapIndy10ServerTransport;dbexpress;IndyIPClient;$(DCC_UsePackage)
@@ -588,6 +545,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -720,6 +703,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -742,6 +735,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -841,6 +894,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -852,6 +915,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -896,6 +969,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -917,6 +1070,7 @@
+
1
@@ -1018,8 +1172,6 @@
- False
- False
True
False
diff --git a/samples/winecellarclient/MainFormU.pas b/samples/winecellarclient/MainFormU.pas
index 5ca464a3..bd0b13f2 100644
--- a/samples/winecellarclient/MainFormU.pas
+++ b/samples/winecellarclient/MainFormU.pas
@@ -8,7 +8,7 @@ uses
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Grids, Vcl.DBGrids, Vcl.ComCtrls, FireDAC.Stan.Intf,
FireDAC.Stan.Option, FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf,
Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client, Vcl.Mask, Vcl.DBCtrls, Vcl.ExtCtrls,
- MVCFramework.RESTClient;
+ MVCFramework.RESTClient.Intf, MVCFramework.RESTClient;
type
TForm5 = class(TForm)
@@ -49,7 +49,7 @@ type
procedure FDMemTable1BeforeDelete(DataSet: TDataSet);
private
- RESTClient: TRESTClient;
+ RESTClient: IMVCRESTClient;
Loading: Boolean;
{ Private declarations }
public
@@ -69,14 +69,14 @@ uses
procedure TForm5.Button1Click(Sender: TObject);
var
- response: IRESTResponse;
+ response: IMVCRESTResponse;
begin
- response := RESTClient.doGET('/api/wines', []);
- Memo1.Lines.Text := response.BodyAsString;
+ response := RESTClient.Get('/api/wines');
+ Memo1.Lines.Text := response.Content;
FDMemTable1.Close;
FDMemTable1.Open;
Loading := True;
- FDMemTable1.AppendFromJSONArrayString(response.BodyAsString);
+ FDMemTable1.AppendFromJSONArrayString(response.Content);
FDMemTable1.First;
Loading := False;
end;
@@ -88,37 +88,37 @@ end;
procedure TForm5.FDMemTable1BeforeDelete(DataSet: TDataSet);
var
- Resp: IRESTResponse;
+ Resp: IMVCRESTResponse;
begin
Resp := RESTClient.DataSetDelete('/api/wines', FDMemTable1id.AsString);
- if not Resp.ResponseCode in [200] then
- raise Exception.Create(Resp.ResponseText);
+ if not Resp.StatusCode in [200] then
+ raise Exception.Create(Resp.Content);
end;
procedure TForm5.FDMemTable1BeforePost(DataSet: TDataSet);
var
- Resp: IRESTResponse;
+ Resp: IMVCRESTResponse;
begin
if Loading then
Exit;
case FDMemTable1.State of
dsEdit:
- Resp := RESTClient.DataSetUpdate('/api/wines', FDMemTable1, FDMemTable1id.AsString);
+ Resp := RESTClient.DataSetUpdate('/api/wines', FDMemTable1id.AsString, FDMemTable1);
dsInsert:
Resp := RESTClient.DataSetInsert('/api/wines', FDMemTable1);
end;
- if not Resp.ResponseCode in [200, 201] then
- raise Exception.Create(Resp.ResponseText);
+ if not Resp.StatusCode in [200, 201] then
+ raise Exception.Create(Resp.Content);
end;
procedure TForm5.FormClose(Sender: TObject; var Action: TCloseAction);
begin
- RESTClient.free;
+ RESTClient := nil;
end;
procedure TForm5.FormCreate(Sender: TObject);
begin
- RESTClient := TRESTClient.Create('localhost', 3000);
+ RESTClient := TMVCRESTClient.New.BaseURL('localhost', 3000);
end;
end.
diff --git a/samples/winecellarclient/WineCellarClient.dproj b/samples/winecellarclient/WineCellarClient.dproj
index 9903b9e4..4fe4bc89 100644
--- a/samples/winecellarclient/WineCellarClient.dproj
+++ b/samples/winecellarclient/WineCellarClient.dproj
@@ -1,7 +1,7 @@

{92D799DE-2A65-48F8-96D8-08C51166B50F}
- 18.8
+ 19.1
VCL
WineCellarClient.dpr
True
@@ -80,10 +80,10 @@
Debug
- CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
true
true
1033
+ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(ModuleName);FileDescription=$(ModuleName);ProductName=$(ModuleName)
false
@@ -555,6 +555,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -687,6 +713,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -709,6 +745,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -808,6 +904,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -819,6 +925,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -863,6 +979,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -910,6 +1106,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
1
diff --git a/samples/winecellarclient_withlivebinding/MainFormU.dfm b/samples/winecellarclient_withlivebinding/MainFormU.dfm
index f86d448c..0e9e3b69 100644
--- a/samples/winecellarclient_withlivebinding/MainFormU.dfm
+++ b/samples/winecellarclient_withlivebinding/MainFormU.dfm
@@ -35,7 +35,7 @@ object Form5: TForm5
Height = 370
ActivePage = TabSheet1
Anchors = [akLeft, akTop, akRight, akBottom]
- TabOrder = 1
+ TabOrder = 2
object TabSheet1: TTabSheet
Caption = 'Wines'
object ListView1: TListView
@@ -194,7 +194,7 @@ object Form5: TForm5
Height = 33
DataSource = PrototypeBindSource1
Orientation = orHorizontal
- TabOrder = 2
+ TabOrder = 1
BeforeAction = BindNavigator1BeforeAction
end
object PrototypeBindSource1: TPrototypeBindSource
diff --git a/samples/winecellarclient_withlivebinding/MainFormU.pas b/samples/winecellarclient_withlivebinding/MainFormU.pas
index 1b006d3d..e39e62d8 100644
--- a/samples/winecellarclient_withlivebinding/MainFormU.pas
+++ b/samples/winecellarclient_withlivebinding/MainFormU.pas
@@ -3,18 +3,48 @@ unit MainFormU;
interface
uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
- System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Grids, Vcl.DBGrids, Vcl.ComCtrls,
+ Winapi.Windows,
+ Winapi.Messages,
+ System.SysUtils,
+ System.Variants,
+ System.Classes,
+ Vcl.Graphics,
+ Vcl.Controls,
+ Vcl.Forms,
+ Vcl.Dialogs,
+ Vcl.StdCtrls,
+ Vcl.Grids,
+ Vcl.DBGrids,
+ Vcl.ComCtrls,
FireDAC.Stan.Intf,
- FireDAC.Stan.Option, FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf,
+ FireDAC.Stan.Option,
+ FireDAC.Stan.Param,
+ FireDAC.Stan.Error,
+ FireDAC.DatS,
+ FireDAC.Phys.Intf,
FireDAC.DApt.Intf,
- Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client, Vcl.Mask, Vcl.DBCtrls, Vcl.ExtCtrls,
- MVCFramework.RESTClient, Data.Bind.GenData, Vcl.Bind.GenData, Data.Bind.Components,
+ Data.DB,
+ FireDAC.Comp.DataSet,
+ FireDAC.Comp.Client,
+ Vcl.Mask,
+ Vcl.DBCtrls,
+ Vcl.ExtCtrls,
+ MVCFramework.RESTClient.Intf,
+ MVCFramework.RESTClient,
+ Data.Bind.GenData,
+ Vcl.Bind.GenData,
+ Data.Bind.Components,
Data.Bind.ObjectScope,
- System.Rtti, System.Bindings.Outputs, Vcl.Bind.Editors, Data.Bind.EngExt, Vcl.Bind.DBEngExt,
+ System.Rtti,
+ System.Bindings.Outputs,
+ Vcl.Bind.Editors,
+ Data.Bind.EngExt,
+ Vcl.Bind.DBEngExt,
Vcl.Buttons,
- Vcl.Bind.Navigator, WinesBO, Generics.Collections, Data.Bind.Controls;
+ Vcl.Bind.Navigator,
+ WinesBO,
+ Generics.Collections,
+ Data.Bind.Controls;
type
TForm5 = class(TForm)
@@ -56,7 +86,7 @@ type
procedure BindNavigator1BeforeAction(Sender: TObject; Button: TNavigateButton);
private
- RESTClient: TRESTClient;
+ RESTClient: IMVCRESTClient;
WinesAdapter: TListBindSourceAdapter;
FWines: TObjectList;
public
@@ -76,15 +106,18 @@ uses
{$R *.dfm}
+
procedure TForm5.BindNavigator1BeforeAction(Sender: TObject; Button: TNavigateButton);
var
- Resp: IRESTResponse;
+ Resp: IMVCRESTResponse;
begin
Resp := nil;
case Button of
nbDelete:
begin
- Resp := RESTClient.doDELETE('/wines', [(WinesAdapter.Current as TWine).id.ToString]);
+ Resp := RESTClient
+ .AddPathParam('id',(WinesAdapter.Current as TWine).id.ToString)
+ .Delete('/wines/{id}');
end;
nbPost:
begin
@@ -92,46 +125,47 @@ begin
seEdit:
begin
WinesAdapter.Post;
- Resp := RESTClient.doPUT('/wines', [(WinesAdapter.Current as TWine).id.ToString],
+ Resp := RESTClient
+ .AddPathParam('id', (WinesAdapter.Current as TWine).id.ToString)
+ .Put('/wines/{id}',
GetDefaultSerializer.SerializeObject(WinesAdapter.Current));
Abort;
end;
seInsert:
begin
WinesAdapter.Post;
- Resp := RESTClient.doPOST('/wines', [],
- GetDefaultSerializer.SerializeObject(WinesAdapter.Current));
+ Resp := RESTClient.Post('/wines', GetDefaultSerializer.SerializeObject(WinesAdapter.Current));
Abort;
end;
end;
end;
end;
- if Assigned(Resp) and (not Resp.ResponseCode in [200, 201]) then
- raise Exception.Create(Resp.ResponseText);
+ if Assigned(Resp) and (not Resp.StatusCode in [200, 201]) then
+ raise Exception.Create(Resp.StatusText);
end;
procedure TForm5.Button1Click(Sender: TObject);
var
- response: IRESTResponse;
+ response: IMVCRESTResponse;
begin
- response := RESTClient.doGET('/wines', []);
- Memo1.Lines.Text := response.BodyAsString;
+ response := RESTClient.Get('/wines');
+ Memo1.Lines.Text := response.Content;
FWines.Clear;
- GetDefaultSerializer.DeserializeCollection(response.BodyAsString, FWines, TWine);
+ GetDefaultSerializer.DeserializeCollection(response.Content, FWines, TWine);
WinesAdapter.SetList(FWines, false);
WinesAdapter.Active := True;
end;
procedure TForm5.FormClose(Sender: TObject; var Action: TCloseAction);
begin
- RESTClient.free;
+ RESTClient := nil;
FWines.free;
end;
procedure TForm5.FormCreate(Sender: TObject);
begin
- RESTClient := TRESTClient.Create('localhost', 3000);
+ RESTClient := TMVCRESTClient.New.BaseURL('localhost', 3000);
FWines := TObjectList.Create(True);
PrototypeBindSource1.Active := True;
end;
diff --git a/samples/winecellarclient_withlivebinding/WineCellarClientLiveBinding.dproj b/samples/winecellarclient_withlivebinding/WineCellarClientLiveBinding.dproj
index 98bd70fc..920bed75 100644
--- a/samples/winecellarclient_withlivebinding/WineCellarClientLiveBinding.dproj
+++ b/samples/winecellarclient_withlivebinding/WineCellarClientLiveBinding.dproj
@@ -1,7 +1,7 @@

{FB43C995-572F-45E6-8600-AD01C440C753}
- 18.8
+ 19.1
VCL
WineCellarClientLiveBinding.dpr
True
@@ -549,6 +549,32 @@
0
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -681,6 +707,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -703,6 +739,66 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -802,6 +898,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -813,6 +919,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
1
@@ -857,6 +973,86 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
+ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset
+ 1
+
+
1
@@ -904,6 +1100,16 @@
1
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
+ ..\$(PROJECTNAME).launchscreen
+ 64
+
+
1
diff --git a/samples/winecellarserver/WINES_FB30.FDB b/samples/winecellarserver/WINES_FB30.FDB
index 1403319c..40ed9bfb 100644
Binary files a/samples/winecellarserver/WINES_FB30.FDB and b/samples/winecellarserver/WINES_FB30.FDB differ