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.
5 from cron_servlet
import CronServlet
6 from instance_servlet
import InstanceServlet
7 from patch_servlet
import PatchServlet
8 from servlet
import Servlet
, Request
, Response
9 from test_servlet
import TestServlet
11 _DEFAULT_SERVLET
= InstanceServlet
.GetConstructor()
14 'patch': PatchServlet
,
18 class Handler(Servlet
):
20 path
= self
._request
.path
22 if path
.startswith('_'):
23 servlet_path
= path
[1:]
24 if not '/' in servlet_path
:
26 servlet_name
, servlet_path
= servlet_path
.split('/', 1)
27 servlet
= _SERVLETS
.get(servlet_name
)
29 return Response
.NotFound('"%s" servlet not found' % servlet_path
)
32 servlet
= _DEFAULT_SERVLET
35 Request(servlet_path
, self
._request
.host
, self
._request
.headers
)).Get()