1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
7 from admin_servlets
import (QueryCommitServlet
, FlushMemcacheServlet
,
9 from instance_servlet
import InstanceServlet
10 from patch_servlet
import PatchServlet
11 from servlet
import Servlet
, Request
, Response
12 from test_servlet
import TestServlet
15 _DEFAULT_SERVLET
= InstanceServlet
.GetConstructor()
19 'patch': PatchServlet
,
20 'query_commit': QueryCommitServlet
,
21 'flush_memcache': FlushMemcacheServlet
,
22 'update_cache': UpdateCacheServlet
,
27 class Handler(Servlet
):
29 path
= self
._request
.path
31 if path
.startswith('_'):
32 servlet_path
= path
[1:]
33 if not '/' in servlet_path
:
35 servlet_name
, servlet_path
= servlet_path
.split('/', 1)
36 servlet
= _SERVLETS
.get(servlet_name
)
38 return Response
.NotFound('"%s" servlet not found' % servlet_path
)
41 servlet
= _DEFAULT_SERVLET
43 return servlet(Request(servlet_path
,
45 self
._request
.headers
,
46 self
._request
.arguments
)).Get()