text
stringlengths
0
234
R.Filters := Servlet_Route.Filters.all'Access;
end if;
if Servlet_Route.all in Routes.Servlets.Proxy_Route_Type'Class then
Proxy := Proxy_Route_Type'Class (Servlet_Route.all)'Access;
Routes.Change_Route (R.Context, Proxy.Route);
R.Servlet
:= Servlet_Route_Type'Class (Proxy.Route.Value.Element.all).Servlet;
else
R.Servlet := Servlet_Route.Servlet;
end if;
Function Definition: function Get_Name_Dispatcher (Context : in Servlet_Registry;
Function Body: Name : in String)
return Request_Dispatcher is
Pos : constant Servlet_Maps.Cursor := Context.Servlets.Find (Name);
begin
if not Servlet_Maps.Has_Element (Pos) then
raise Servlet_Error with "No servlet " & Name;
end if;
return R : Request_Dispatcher do
R.Servlet := Servlet_Maps.Element (Pos);
end return;
end Get_Name_Dispatcher;
-- ------------------------------
-- Returns the context path of the web application.
-- The context path is the portion of the request URI that is used to select the context
-- of the request. The context path always comes first in a request URI. The path starts
-- with a "/" character but does not end with a "/" character. For servlets in the default
-- (root) context, this method returns "".
-- ------------------------------
function Get_Context_Path (Context : in Servlet_Registry) return String is
begin
return To_String (Context.Context_Path);
end Get_Context_Path;
-- ------------------------------
-- Returns a String containing the value of the named context-wide initialization
-- parameter, or null if the parameter does not exist.
--
-- This method can make available configuration information useful to an entire
-- "web application". For example, it can provide a webmaster's email address
-- or the name of a system that holds critical data.
-- ------------------------------
function Get_Init_Parameter (Context : in Servlet_Registry;
Name : in String;
Default : in String := "") return String is
begin
return Context.Config.Get (Name, Default);
end Get_Init_Parameter;
function Get_Init_Parameter (Context : in Servlet_Registry;
Name : in String;
Default : in String := "")
return Ada.Strings.Unbounded.Unbounded_String is
begin
if Context.Config.Exists (Name) then
return Context.Config.Get (Name);
else
return Ada.Strings.Unbounded.To_Unbounded_String (Default);
end if;
end Get_Init_Parameter;
-- ------------------------------
-- Set the init parameter identified by <b>Name</b> to the value <b>Value</b>.
-- ------------------------------
procedure Set_Init_Parameter (Context : in out Servlet_Registry;
Name : in String;
Value : in String) is
begin
Log.Debug ("Set {0}={1}", Name, Value);
Context.Config.Set (Name, Value);
end Set_Init_Parameter;
-- ------------------------------
-- Set the init parameters by copying the properties defined in <b>Params</b>.
-- Existing parameters will be overriding by the new values.
-- ------------------------------
procedure Set_Init_Parameters (Context : in out Servlet_Registry;
Params : in Util.Properties.Manager'Class) is
begin
Context.Config.Copy (Params);
end Set_Init_Parameters;
-- ------------------------------
-- Get access to the init parameters.
-- ------------------------------
procedure Get_Init_Parameters (Context : in Servlet_Registry;
Process : not null access
procedure (Params : in Util.Properties.Manager'Class)) is
begin
Process (Context.Config);
end Get_Init_Parameters;
-- ------------------------------
-- Returns the absolute path of the resource identified by the given relative path.
-- The resource is searched in a list of directories configured by the application.
-- The path must begin with a "/" and is interpreted as relative to the current
-- context root.