|
76 | 76 | public class ProxyMappingManager { |
77 | 77 |
|
78 | 78 | private static final String PROXY_INTERNAL_ENDPOINT = "/proxy_endpoint"; |
79 | | - private static final AttachmentKey<ProxyMappingManager> ATTACHMENT_KEY_DISPATCHER = AttachmentKey.create(ProxyMappingManager.class); |
| 79 | + public static final AttachmentKey<ProxyMappingManager> ATTACHMENT_KEY_DISPATCHER = AttachmentKey.create(ProxyMappingManager.class); |
80 | 80 | private static final AttachmentKey<ProxyIdAttachment> ATTACHMENT_KEY_PROXY_ID = AttachmentKey.create(ProxyIdAttachment.class); |
81 | 81 | private static final AttachmentKey<OriginalUrlAttachmentKey> ATTACHMENT_ORIGINAL_URL = AttachmentKey.create(OriginalUrlAttachmentKey.class); |
82 | 82 |
|
83 | 83 | private final Logger logger = LoggerFactory.getLogger(getClass()); |
84 | 84 | private final StructuredLogger slogger = new StructuredLogger(logger); |
85 | 85 | // the current set of prefixPaths registered in the pathHandler |
86 | 86 | private final Map<String, List<String>> prefixPaths = new HashMap<>(); |
87 | | - private PathHandler pathHandler; |
| 87 | + private ProxyPathHandler pathHandler; |
88 | 88 | private volatile boolean isShuttingDown = false; |
89 | 89 |
|
90 | 90 | @Inject |
@@ -172,6 +172,11 @@ public synchronized void addMappings(Proxy proxy) { |
172 | 172 | prefixPaths.put(proxy.getId(), newPrefixPaths); |
173 | 173 | } |
174 | 174 |
|
| 175 | + public PathHandler getHttpHandler() { |
| 176 | + if (pathHandler == null) throw new IllegalStateException("Cannot change mappings: web server is not yet running."); |
| 177 | + return pathHandler; |
| 178 | + } |
| 179 | + |
175 | 180 | @SuppressWarnings("deprecation") |
176 | 181 | private synchronized String addMapping(Proxy proxy, String mapping, URI target) { |
177 | 182 | String prefixPath = getPrefixPath(proxy.getId(), mapping); |
|
0 commit comments