/usr/share/ada/adainclude/aws/aws-services-dispatchers-uri.ads is in libaws2.10.2-dev 2.10.2-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | ------------------------------------------------------------------------------
-- Ada Web Server --
-- --
-- Copyright (C) 2000-2009, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify --
-- it under the terms of the GNU General Public License as published by --
-- the Free Software Foundation; either version 2 of the License, or (at --
-- your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, but --
-- WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public License --
-- along with this library; if not, write to the Free Software Foundation, --
-- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
-- --
------------------------------------------------------------------------------
-- Dispatch a specific request to a callback depending on the URI
private with Ada.Containers.Vectors;
private with Ada.Strings.Unbounded;
with AWS.Dispatchers;
with AWS.Response;
with AWS.Status;
with AWS.Utils;
package AWS.Services.Dispatchers.URI is
type Handler is new AWS.Dispatchers.Handler with private;
procedure Register
(Dispatcher : in out Handler;
URI : String;
Action : AWS.Dispatchers.Handler'Class;
Prefix : Boolean := False);
-- Register URI to use the specified dispatcher. URI is the full string
-- that must match the ressource requested (with the leading /). If Prefix
-- is True, only the URI prefix is checked.
procedure Register
(Dispatcher : in out Handler;
URI : String;
Action : Response.Callback;
Prefix : Boolean := False);
-- Idem as above but take a callback procedure as parameter
procedure Register_Regexp
(Dispatcher : in out Handler;
URI : String;
Action : AWS.Dispatchers.Handler'Class);
-- Register URI to use the specified dispatcher. URI is a regular
-- expression that must match the ressource requested (with the leading /).
procedure Register_Regexp
(Dispatcher : in out Handler;
URI : String;
Action : Response.Callback);
-- Idem as above but take a callback procedure as parameter
procedure Unregister
(Dispatcher : in out Handler;
URI : String);
-- Removes URI from the list. URI is either a name or a regexp and must
-- have exactaly the value used with Register.
procedure Register_Default_Callback
(Dispatcher : in out Handler;
Action : AWS.Dispatchers.Handler'Class);
-- Register the default callback. This will be used if no URI match
-- the request.
private
use Ada.Strings.Unbounded;
overriding procedure Initialize (Dispatcher : in out Handler);
overriding procedure Finalize (Dispatcher : in out Handler);
overriding function Dispatch
(Dispatcher : Handler;
Request : Status.Data) return Response.Data;
-- Dispatch will return the value returned by the first callback matching
-- the request. Note that if a callback returns the Response.Empty message,
-- Dispatch will just continue to the next matching callback. In any case,
-- if no handler matches it will call the default callback. If no default
-- callback is registered an error (code 404) HTML message is returned.
overriding function Clone (Dispatcher : Handler) return Handler;
-- Returns a deep copy of the dispatcher
type Std_URI is new Utils.Clonable with record
Action : AWS.Dispatchers.Handler_Class_Access;
URI : Unbounded_String;
Prefix : Boolean;
end record;
overriding function Clone (URI : Std_URI) return Std_URI;
function Match (URI : Std_URI; Value : String) return Boolean;
type URI_Class_Access is access all Std_URI'Class;
package URI_Table is
new Ada.Containers.Vectors (Positive, URI_Class_Access, "=");
type Handler is new AWS.Dispatchers.Handler with record
Action : AWS.Dispatchers.Handler_Class_Access;
Table : URI_Table.Vector;
end record;
end AWS.Services.Dispatchers.URI;
|