KNOX-1049 - marshaling changes Project: http://git-wip-us.apache.org/repos/asf/knox/repo Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/3346d99e Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/3346d99e Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/3346d99e
Branch: refs/heads/KNOX-1049 Commit: 3346d99e361e1dab74fc8774d3089f9049529941 Parents: 222385b Author: Larry McCay <lmc...@hortonworks.com> Authored: Wed Oct 25 13:15:38 2017 -0400 Committer: Larry McCay <lmc...@hortonworks.com> Committed: Wed Oct 25 13:15:38 2017 -0400 ---------------------------------------------------------------------- .../xml/KnoxFormatXmlTopologyRules.java | 2 +- .../src/main/resources/conf/topology-v1.xsd | 2 +- .../services/ambariui/2.2.1/rewrite.xml | 104 +++++++++++++++++++ .../services/ambariui/2.2.1/service.xml | 92 ++++++++++++++++ .../gateway/topology/topology_binding-xml.xml | 4 +- 5 files changed, 200 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/knox/blob/3346d99e/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/xml/KnoxFormatXmlTopologyRules.java ---------------------------------------------------------------------- diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/xml/KnoxFormatXmlTopologyRules.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/xml/KnoxFormatXmlTopologyRules.java index e221507..cb30769 100644 --- a/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/xml/KnoxFormatXmlTopologyRules.java +++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/xml/KnoxFormatXmlTopologyRules.java @@ -32,7 +32,7 @@ public class KnoxFormatXmlTopologyRules extends AbstractRulesModule { private static final String ROOT_TAG = "topology"; private static final String NAME_TAG = "name"; private static final String VERSION_TAG = "version"; - private static final String DEFAULT_SERVICE_TAG = "default-service"; + private static final String DEFAULT_SERVICE_TAG = "path"; private static final String APPLICATION_TAG = "application"; private static final String SERVICE_TAG = "service"; private static final String ROLE_TAG = "role"; http://git-wip-us.apache.org/repos/asf/knox/blob/3346d99e/gateway-server/src/main/resources/conf/topology-v1.xsd ---------------------------------------------------------------------- diff --git a/gateway-server/src/main/resources/conf/topology-v1.xsd b/gateway-server/src/main/resources/conf/topology-v1.xsd index ab07caa..96c9ba2 100644 --- a/gateway-server/src/main/resources/conf/topology-v1.xsd +++ b/gateway-server/src/main/resources/conf/topology-v1.xsd @@ -21,7 +21,7 @@ limitations under the License. <h:sequence maxOccurs="1"> <h:element name="name" minOccurs="0" maxOccurs="1"/> - <h:element name="default-service" minOccurs="0" maxOccurs="1"/> + <h:element name="path" minOccurs="0" maxOccurs="1"/> <h:element name="gateway" minOccurs="0" maxOccurs="1"> <h:complexType> http://git-wip-us.apache.org/repos/asf/knox/blob/3346d99e/gateway-service-definitions/src/main/resources/services/ambariui/2.2.1/rewrite.xml ---------------------------------------------------------------------- diff --git a/gateway-service-definitions/src/main/resources/services/ambariui/2.2.1/rewrite.xml b/gateway-service-definitions/src/main/resources/services/ambariui/2.2.1/rewrite.xml new file mode 100644 index 0000000..0c99d76 --- /dev/null +++ b/gateway-service-definitions/src/main/resources/services/ambariui/2.2.1/rewrite.xml @@ -0,0 +1,104 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<rules> + <rule dir="IN" name="AMBARIUI/ambari/inbound/root" pattern="*://*:*/**/ambari/"> + <rewrite template="{$serviceUrl[AMBARIUI]}/"/> + </rule> + <rule dir="IN" name="AMBARIUI/ambari/inbound/path" pattern="*://*:*/**/ambari/{**}"> + <rewrite template="{$serviceUrl[AMBARIUI]}/{**}"/> + </rule> + <rule dir="IN" name="AMBARIUI/ambari/inbound/query" pattern="*://*:*/**/ambari/{**}?{**}"> + <rewrite template="{$serviceUrl[AMBARIUI]}/{**}?{**}"/> + </rule> + + <rule dir="OUT" name="AMBARIUI/ambari/outbound/sitepath"> + <rewrite template="{$frontend[path]}/"/> + </rule> + + <rule dir="OUT" name="AMBARIUI/ambari/outbound/extrapath"> + <rewrite template="{$frontend[path]}/api/v1"/> + </rule> + <rule dir="OUT" name="AMBARIUI/ambari/outbound/logohref"> + <rewrite template="#/main/dashboard"/> + </rule> + <rule dir="OUT" name="AMBARIUI/ambari/outbound/img" pattern="/img/{**}"> + <rewrite template="{$frontend[url]}/img/{**}"/> + </rule> + + <rule dir="OUT" name="AMBARIUI/ambari/outbound/css"> + <rewrite template="{$frontend[path]}/stylesheets/{**}"/> + </rule> + <rule dir="OUT" name="AMBARIUI/ambari/outbound/js"> + <rewrite template="{$frontend[path]}/javascripts/{**}"/> + </rule> + + <filter name="AMBARIUI/ambari/outbound/proxyroot"> + <content type="*/x-javascript"> + <apply path="\{proxy_root\}" rule="AMBARIUI/ambari/outbound/sitepath"/> + </content> + <content type="application/javascript"> + <apply path="\{proxy_root\}" rule="AMBARIUI/ambari/outbound/sitepath"/> + </content> + </filter> + + <!-- filter to rewrite api prefix defined in .js from root --> + <!-- e.g. /api/v1 --> + <filter name="AMBARIUI/ambari/outbound/apiendpoint"> + <content type="*/x-javascript"> + <apply path="/api/v1" rule="AMBARIUI/ambari/outbound/extrapath"/> + </content> + <content type="application/javascript"> + <apply path="/api/v1" rule="AMBARIUI/ambari/outbound/extrapath"/> + </content> + </filter> + + <filter name="AMBARIUI/ambari/outbound/apiendpoint/html"> + <content type="text/html"> + <apply path="/api/v1" rule="AMBARIUI/ambari/outbound/extrapath"/> + </content> + </filter> + + <filter name="AMBARIUI/ambari/outbound/apiendpoint/noroot"> + <content type="*/x-javascript"> + <apply path="api/v1" rule="AMBARIUI/ambari/outbound/extrapath"/> + </content> + <content type="application/javascript"> + <apply path="api/v1" rule="AMBARIUI/ambari/outbound/extrapath"/> + </content> + </filter> + + <filter name="AMBARIUI/ambari/outbound/links"> + <content type="*/x-javascript"> + <apply path="/api/v1" rule="AMBARIUI/ambari/outbound/extrapath"/> + <apply path="\{proxy_root\}" rule="AMBARIUI/ambari/outbound/sitepath"/> + <apply path="/#/main/dashboard" rule="AMBARIUI/ambari/outbound/logohref"/> + </content> + <content type="application/javascript"> + <apply path="/api/v1" rule="AMBARIUI/ambari/outbound/extrapath"/> + <apply path="\{proxy_root\}" rule="AMBARIUI/ambari/outbound/sitepath"/> + <apply path="/#/main/dashboard" rule="AMBARIUI/ambari/outbound/logohref"/> + </content> + <content type="*/html"> + </content> + </filter> + <filter name="AMBARIUI/ambari/outbound/mainpage"> + <content type="*/html"> + <apply path="stylesheets/{**}.css" rule="AMBARIUI/ambari/outbound/css" /> + <apply path="javascripts/{**}.js" rule="AMBARIUI/ambari/outbound/js" /> + </content> + </filter> +</rules> http://git-wip-us.apache.org/repos/asf/knox/blob/3346d99e/gateway-service-definitions/src/main/resources/services/ambariui/2.2.1/service.xml ---------------------------------------------------------------------- diff --git a/gateway-service-definitions/src/main/resources/services/ambariui/2.2.1/service.xml b/gateway-service-definitions/src/main/resources/services/ambariui/2.2.1/service.xml new file mode 100644 index 0000000..ab4ab2b --- /dev/null +++ b/gateway-service-definitions/src/main/resources/services/ambariui/2.2.1/service.xml @@ -0,0 +1,92 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<service role="AMBARIUI" name="ambariui" version="2.2.0"> + <policies> + <policy role="webappsec"/> + <policy role="authentication" name="Anonymous"/> + <policy role="rewrite"/> + <policy role="authorization"/> + </policies> + <routes> + <route path="/ambari"> + <rewrite apply="AMBARIUI/ambari/inbound/root" to="request.url"/> + <rewrite apply="AMBARIUI/ambari/outbound/mainpage" to="response.body"/> + </route> + <route path="/ambari/**"> + <rewrite apply="AMBARIUI/ambari/inbound/path" to="request.url"/> + </route> + <route path="/ambari/**?**"> + <rewrite apply="AMBARIUI/ambari/inbound/query" to="request.url"/> + </route> + <route path="/ambari/**/app.js"> + <rewrite apply="AMBARIUI/ambari/outbound/links" to="response.body"/> + </route> + + <!-- Admin View route --> + <route path="/ambari/views/ADMIN_VIEW/**/INSTANCE/**/main.js"> + <rewrite apply="AMBARIUI/ambari/outbound/proxyroot" to="response.body"/> + </route> + + <!-- Files view --> + <route path="/ambari/views/FILES/**/assets/files-view.js"> + <rewrite apply="AMBARIUI/ambari/outbound/apiendpoint/noroot" to="response.body"/> + </route> + + <!-- Capacity Scheduler view --> + <route path="/ambari/views/CAPACITY-SCHEDULER/**/javascripts/app.js"> + <rewrite apply="AMBARIUI/ambari/outbound/apiendpoint/noroot" to="response.body"/> + </route> + + <!-- Pig view --> + <route path="/ambari/views/PIG/**/javascripts/app.js"> + <rewrite apply="AMBARIUI/ambari/outbound/apiendpoint/noroot" to="response.body"/> + </route> + + <!-- Hive view route --> + <route path="/ambari/views/HIVE/**/assets/hive.js"> + <rewrite apply="AMBARIUI/ambari/outbound/apiendpoint" to="response.body"/> + </route> + + <!-- Storm View --> + <route path="/ambari/views/Storm_Monitoring/**/scripts/models/*.js"> + <rewrite apply="AMBARIUI/ambari/outbound/apiendpoint" to="response.body"/> + </route> + + <route path="/ambari/views/ZEPPELIN/*/*/"> + <rewrite apply="AMBARIUI/ambari/outbound/apiendpoint/html" to="response.body"/> + </route> + + <!-- Tez View --> + <route path="/ambari/views/TEZ/*/*/ambari-scripts/init-view.js"> + <rewrite apply="AMBARIUI/ambari/outbound/apiendpoint" to="response.body"/> + </route> + + <!-- Hive 2.0 view --> + <route path="/ambari/views/HIVE/**/assets/ui.js"> + <rewrite apply="AMBARIUI/ambari/outbound/apiendpoint/noroot" to="response.body"/> + </route> + + <!-- SmartSense view --> + <route path="/ambari/views/SMARTSENSE/**/assets/hstapp-*.js"> + <rewrite apply="AMBARIUI/ambari/outbound/apiendpoint" to="response.body"/> + </route> + + <!-- No need to rewrite Slider View --> + </routes> + <dispatch classname="org.apache.hadoop.gateway.dispatch.PassAllHeadersNoEncodingDispatch"/> +</service> + http://git-wip-us.apache.org/repos/asf/knox/blob/3346d99e/gateway-spi/src/main/resources/org/apache/hadoop/gateway/topology/topology_binding-xml.xml ---------------------------------------------------------------------- diff --git a/gateway-spi/src/main/resources/org/apache/hadoop/gateway/topology/topology_binding-xml.xml b/gateway-spi/src/main/resources/org/apache/hadoop/gateway/topology/topology_binding-xml.xml index 8c54ed7..4c89b5d 100644 --- a/gateway-spi/src/main/resources/org/apache/hadoop/gateway/topology/topology_binding-xml.xml +++ b/gateway-spi/src/main/resources/org/apache/hadoop/gateway/topology/topology_binding-xml.xml @@ -28,7 +28,7 @@ or more contributor license agreements. See the NOTICE file <xml-root-element/> <java-attributes> <xml-element java-attribute="name" name="name"/> - <xml-element java-attribute="defaultServicePath" name="default-service"/> + <xml-element java-attribute="defaultServicePath" name="path"/> <xml-elements java-attribute="providers"> <xml-element name="provider"/> <xml-element-wrapper name="gateway"/> @@ -61,4 +61,4 @@ or more contributor license agreements. See the NOTICE file </java-attributes> </java-type> </java-types> -</xml-bindings> \ No newline at end of file +</xml-bindings>