text
stringlengths
0
234
Function Definition: procedure Make_Route is
Function Body: Context : aliased EL.Contexts.Default.Default_Context;
Iter : Util.Strings.Vectors.Cursor := Registry.Filter_Patterns.First;
begin
while Util.Strings.Vectors.Has_Element (Iter) loop
declare
use Routes.Servlets;
procedure Insert (Ref : in out Routes.Route_Type_Ref);
Pattern : constant String := Util.Strings.Vectors.Element (Iter);
Route : Routes.Route_Context_Type;
procedure Insert (Ref : in out Routes.Route_Type_Ref) is
Proxy : Routes.Servlets.Proxy_Route_Type_Access;
begin
if Ref.Is_Null then
Proxy := new Routes.Servlets.Proxy_Route_Type;
Proxy.Route := Route.Get_Route;
-- If the route is also a proxy, get the real route pointed to by the proxy.
if Proxy.Route.Value in Proxy_Route_Type'Class then
Proxy.Route
:= Proxy_Route_Type'Class (Proxy.Route.Value.Element.all).Route;
end if;
Ref := Routes.Route_Type_Refs.Create (Proxy.all'Access);
end if;
end Insert;
begin
Registry.Routes.Find_Route (Pattern, Route);
if not Route.Is_Null then
Registry.Routes.Add_Route (Pattern, Context, Insert'Access);
end if;
Function Definition: procedure Disable (Registry : in out Servlet_Registry) is
Function Body: begin
case Registry.Status is
when Ready =>
Registry.Status := Disabled;
when Started =>
Registry.Status := Suspended;
when Disabled | Suspended | Stopped =>
null;
end case;
end Disable;
-- ------------------------------
-- Enable the application.
-- ------------------------------
procedure Enable (Registry : in out Servlet_Registry) is
begin
case Registry.Status is
when Disabled =>
Registry.Status := Ready;
when Suspended =>
Registry.Status := Started;
when Ready | Started | Stopped =>
null;
end case;
end Enable;
-- ------------------------------
-- Stop the application.
-- ------------------------------
procedure Stop (Registry : in out Servlet_Registry) is
begin
case Registry.Status is
when Ready | Disabled | Stopped =>
null;
when Started | Suspended =>
Registry.Status := Stopped;
end case;
end Stop;
procedure Free is
new Ada.Unchecked_Deallocation (Object => Filters.Filter_List,
Name => Filter_List_Access);
-- ------------------------------
-- Add a filter mapping with the given pattern
-- If the URL pattern is already mapped to a different servlet,
-- no updates will be performed.
-- ------------------------------
procedure Add_Filter_Mapping (Registry : in out Servlet_Registry;
Pattern : in String;
Name : in String) is
procedure Append (Key : in String;
List : in out Filter_List_Access);
Pos : constant Filter_Maps.Cursor := Registry.Filters.Find (Name);
Rule : constant Filter_List_Maps.Cursor := Registry.Filter_Rules.Find (Pattern);