1515except ImportError :
1616 from .utils import Callable
1717
18- def _make_serverproxy_handler (name , command , environment , timeout , absolute_url , port ):
18+ def _make_serverproxy_handler (name , command , environment , timeout , absolute_url , port , mappath ):
1919 """
2020 Create a SuperviseAndProxyHandler subclass with given parameters
2121 """
@@ -27,6 +27,7 @@ def __init__(self, *args, **kwargs):
2727 self .proxy_base = name
2828 self .absolute_url = absolute_url
2929 self .requested_port = port
30+ self .mappath = mappath
3031
3132 @property
3233 def process_args (self ):
@@ -88,6 +89,7 @@ def make_handlers(base_url, server_processes):
8889 sp .timeout ,
8990 sp .absolute_url ,
9091 sp .port ,
92+ sp .mappath ,
9193 )
9294 handlers .append ((
9395 ujoin (base_url , sp .name , r'(.*)' ), handler , dict (state = {}),
@@ -99,7 +101,7 @@ def make_handlers(base_url, server_processes):
99101
100102LauncherEntry = namedtuple ('LauncherEntry' , ['enabled' , 'icon_path' , 'title' ])
101103ServerProcess = namedtuple ('ServerProcess' , [
102- 'name' , 'command' , 'environment' , 'timeout' , 'absolute_url' , 'port' , 'launcher_entry' ])
104+ 'name' , 'command' , 'environment' , 'timeout' , 'absolute_url' , 'port' , 'mappath' , ' launcher_entry' ])
103105
104106def make_server_process (name , server_process_config ):
105107 le = server_process_config .get ('launcher_entry' , {})
@@ -110,6 +112,7 @@ def make_server_process(name, server_process_config):
110112 timeout = server_process_config .get ('timeout' , 5 ),
111113 absolute_url = server_process_config .get ('absolute_url' , False ),
112114 port = server_process_config .get ('port' , 0 ),
115+ mappath = server_process_config .get ('mappath' , {}),
113116 launcher_entry = LauncherEntry (
114117 enabled = le .get ('enabled' , True ),
115118 icon_path = le .get ('icon_path' ),
@@ -150,6 +153,11 @@ class ServerProxy(Configurable):
150153 port
151154 Set the port that the service will listen on. The default is to automatically select an unused port.
152155
156+ mappath
157+ Map request paths to proxied paths.
158+ Either a dictionary of request paths to proxied paths,
159+ or a callable that takes parameter ``path`` and returns the proxied path.
160+
153161 launcher_entry
154162 A dictionary of various options for entries in classic notebook / jupyterlab launchers.
155163
0 commit comments