cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / chrome / common / extensions / docs / server2 / handler.py
blob736e352a3b7138f60f8653170a49cedf9214861e
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 import time
7 from admin_servlets import (QueryCommitServlet, FlushMemcacheServlet,
8 UpdateCacheServlet)
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()
18 _SERVLETS = {
19 'patch': PatchServlet,
20 'query_commit': QueryCommitServlet,
21 'flush_memcache': FlushMemcacheServlet,
22 'update_cache': UpdateCacheServlet,
23 'test': TestServlet,
27 class Handler(Servlet):
28 def Get(self):
29 path = self._request.path
31 if path.startswith('_'):
32 servlet_path = path[1:]
33 if not '/' in servlet_path:
34 servlet_path += '/'
35 servlet_name, servlet_path = servlet_path.split('/', 1)
36 servlet = _SERVLETS.get(servlet_name)
37 if servlet is None:
38 return Response.NotFound('"%s" servlet not found' % servlet_path)
39 else:
40 servlet_path = path
41 servlet = _DEFAULT_SERVLET
43 return servlet(Request(servlet_path,
44 self._request.host,
45 self._request.headers,
46 self._request.arguments)).Get()