http://git-wip-us.apache.org/repos/asf/knox/blob/7a7450b9/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java
----------------------------------------------------------------------
diff --git
a/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java
b/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java
index 1cfac54..81e0c75 100644
---
a/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java
+++
b/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java
@@ -105,26 +105,27 @@ public class TopologiesResource {
public Topology getTopology(@PathParam("id") String id) {
GatewayServices services =
(GatewayServices)
request.getServletContext().getAttribute(GatewayServices.GATEWAY_SERVICES_ATTRIBUTE);
- GatewayConfig config =
- (GatewayConfig)
request.getServletContext().getAttribute(GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE);
-
- TopologyService ts = services.getService(GatewayServices.TOPOLOGY_SERVICE);
-
- for (org.apache.knox.gateway.topology.Topology t : ts.getTopologies()) {
- if (t.getName().equals(id)) {
- try {
- t.setUri(new URI( buildURI(t, config, request) ));
- } catch (URISyntaxException se) {
- t.setUri(null);
- }
+ if (services != null) {
+ TopologyService ts =
services.getService(GatewayServices.TOPOLOGY_SERVICE);
- // For any read-only override topology, mark it as generated to
discourage modification.
- List<String> ambariManagedTopos =
config.getReadOnlyOverrideTopologyNames();
- if (ambariManagedTopos.contains(t.getName())) {
- t.setGenerated(true);
+ GatewayConfig config =
+ (GatewayConfig)
request.getServletContext().getAttribute(GatewayConfig.GATEWAY_CONFIG_ATTRIBUTE);
+ for (org.apache.knox.gateway.topology.Topology t : ts.getTopologies()) {
+ if (t.getName().equals(id)) {
+ try {
+ t.setUri(new URI( buildURI(t, config, request) ));
+ } catch (URISyntaxException se) {
+ t.setUri(null);
+ }
+
+ // For any read-only override topology, mark it as generated to
discourage modification.
+ List<String> ambariManagedTopos =
config.getReadOnlyOverrideTopologyNames();
+ if (ambariManagedTopos.contains(t.getName())) {
+ t.setGenerated(true);
+ }
+
+ return BeanConverter.getTopology(t);
}
-
- return BeanConverter.getTopology(t);
}
}
return null;