diff options
author | Kegan Dougal <kegan@matrix.org> | 2014-08-14 09:52:20 +0100 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2014-08-14 09:55:16 +0100 |
commit | 9f863d34663a4d58cf59cd15e0b0aa4a8e8581a5 (patch) | |
tree | 9a5058698cf4a43b1257596a82c622dca30cdbc1 /synapse/rest | |
parent | grammar fix (diff) | |
download | synapse-9f863d34663a4d58cf59cd15e0b0aa4a8e8581a5.tar.xz |
Start phasing out HttpServer: we should be using Resources instead. Added resource_for_client/federation/web_client to the HomeServer and hooked the C-S servlets to operate on resource_for_client. Dynamically construct the Resource tree.
Diffstat (limited to 'synapse/rest')
-rw-r--r-- | synapse/rest/__init__.py | 24 | ||||
-rw-r--r-- | synapse/rest/base.py | 4 |
2 files changed, 13 insertions, 15 deletions
diff --git a/synapse/rest/__init__.py b/synapse/rest/__init__.py index 74a372e2ff..82c09f4c4a 100644 --- a/synapse/rest/__init__.py +++ b/synapse/rest/__init__.py @@ -32,19 +32,15 @@ class RestServletFactory(object): """ def __init__(self, hs): - http_server = hs.get_http_server() + client_resource = hs.get_resource_for_client() # TODO(erikj): There *must* be a better way of doing this. - room.register_servlets(hs, http_server) - events.register_servlets(hs, http_server) - register.register_servlets(hs, http_server) - login.register_servlets(hs, http_server) - profile.register_servlets(hs, http_server) - public.register_servlets(hs, http_server) - presence.register_servlets(hs, http_server) - im.register_servlets(hs, http_server) - directory.register_servlets(hs, http_server) - - def register_web_client(self, hs): - http_server = hs.get_http_server() - webclient.register_servlets(hs, http_server) + room.register_servlets(hs, client_resource) + events.register_servlets(hs, client_resource) + register.register_servlets(hs, client_resource) + login.register_servlets(hs, client_resource) + profile.register_servlets(hs, client_resource) + public.register_servlets(hs, client_resource) + presence.register_servlets(hs, client_resource) + im.register_servlets(hs, client_resource) + directory.register_servlets(hs, client_resource) diff --git a/synapse/rest/base.py b/synapse/rest/base.py index 65d417f757..124b3a2e0c 100644 --- a/synapse/rest/base.py +++ b/synapse/rest/base.py @@ -16,6 +16,8 @@ """ This module contains base REST classes for constructing REST servlets. """ import re +CLIENT_PREFIX = "/matrix/client/api/v1" + def client_path_pattern(path_regex): """Creates a regex compiled client path with the correct client path @@ -27,7 +29,7 @@ def client_path_pattern(path_regex): Returns: SRE_Pattern """ - return re.compile("^/matrix/client/api/v1" + path_regex) + return re.compile("^" + CLIENT_PREFIX + path_regex) class RestServlet(object): |