Skip to content

Commit 1354e23

Browse files
committed
Ref #34124: allow integrating Grafana
1 parent 237fe44 commit 1354e23

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/main/java/eu/openanalytics/containerproxy/util/ProxyMappingManager.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@
7676
public class ProxyMappingManager {
7777

7878
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);
8080
private static final AttachmentKey<ProxyIdAttachment> ATTACHMENT_KEY_PROXY_ID = AttachmentKey.create(ProxyIdAttachment.class);
8181
private static final AttachmentKey<OriginalUrlAttachmentKey> ATTACHMENT_ORIGINAL_URL = AttachmentKey.create(OriginalUrlAttachmentKey.class);
8282

8383
private final Logger logger = LoggerFactory.getLogger(getClass());
8484
private final StructuredLogger slogger = new StructuredLogger(logger);
8585
// the current set of prefixPaths registered in the pathHandler
8686
private final Map<String, List<String>> prefixPaths = new HashMap<>();
87-
private PathHandler pathHandler;
87+
private ProxyPathHandler pathHandler;
8888
private volatile boolean isShuttingDown = false;
8989

9090
@Inject
@@ -172,6 +172,11 @@ public synchronized void addMappings(Proxy proxy) {
172172
prefixPaths.put(proxy.getId(), newPrefixPaths);
173173
}
174174

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+
175180
@SuppressWarnings("deprecation")
176181
private synchronized String addMapping(Proxy proxy, String mapping, URI target) {
177182
String prefixPath = getPrefixPath(proxy.getId(), mapping);

0 commit comments

Comments
 (0)