Skip to content

Commit 15e075d

Browse files
committed
Feature #16: Fix compilation warnings
- fix default streams configuration to disable DYNAMIC by default so that we have the compatibility with existing operations
1 parent d1bbf01 commit 15e075d

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/servlet-rest-operation.ads

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
-- Written by Stephane Carrez ([email protected])
55
-- SPDX-License-Identifier: Apache-2.0
66
-----------------------------------------------------------------------
7+
with Servlet.Streams.Dynamic;
78
generic
89
Handler : Operation_Access;
910
Method : Method_Type := GET;
1011
URI : String;
1112
Permission : Security.Permissions.Permission_Index := Security.Permissions.NONE;
1213
Mimes : Mime_List_Access := null;
13-
Streams : Stream_Modes := (others => True);
14+
Streams : Stream_Modes := (Servlet.Streams.Dynamic.DYNAMIC => False, others => True);
1415
package Servlet.Rest.Operation is
1516

1617
function Definition return Descriptor_Access;

src/servlet-rest.adb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ with Util.Http.Headers;
88
with Servlet.Routes;
99
with Servlet.Routes.Servlets.Rest;
1010
with Servlet.Core.Rest;
11-
with Servlet.Streams.Dynamic;
1211
with EL.Contexts.Default;
1312
with Util.Log.Loggers;
1413
package body Servlet.Rest is
@@ -217,22 +216,25 @@ package body Servlet.Rest is
217216
procedure Choose_Content_Type (Req : in out Servlet.Rest.Request'Class;
218217
Reply : in out Servlet.Rest.Response'Class;
219218
Stream : in out Servlet.Rest.Output_Stream'Class) is
219+
use Servlet.Streams;
220220
begin
221221
declare
222222
Accept_Header : constant String := Req.Get_Header ("Accept");
223223
Mime : Mime_Access;
224224
begin
225-
Mime := Util.Http.Headers.Get_Accepted (Accept_Header, (1 => Util.Http.Mimes.Json'Access));
225+
Mime := Util.Http.Headers.Get_Accepted (Accept_Header,
226+
(1 => Util.Http.Mimes.Json'Access));
226227
if Mime /= null then
227228
Set_Content_Type (Reply, Mime.all, Stream);
228229
return;
229230
end if;
230-
Mime := Util.Http.Headers.Get_Accepted (Accept_Header, (1 => Util.Http.Mimes.Xml'Access));
231+
Mime := Util.Http.Headers.Get_Accepted (Accept_Header,
232+
(1 => Util.Http.Mimes.Xml'Access));
231233
if Mime /= null then
232234
Set_Content_Type (Reply, Mime.all, Stream);
233235
return;
234236
end if;
235-
Servlet.Streams.Dynamic.Print_Stream'Class (Stream).Set_Stream_Type (Servlet.Streams.Dynamic.RAW);
237+
Dynamic.Print_Stream'Class (Stream).Set_Stream_Type (Dynamic.RAW);
236238
end;
237239
end Choose_Content_Type;
238240

src/servlet-streams-raw.ads

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ with Ada.Calendar;
99
with Ada.Finalization;
1010
with Util.Beans.Objects;
1111
with Util.Serialize.IO;
12-
with Util.Http.Mimes;
1312
package Servlet.Streams.Raw is
1413

1514
type Print_Stream is limited new Ada.Finalization.Limited_Controlled

0 commit comments

Comments
 (0)