private void contributeResource( DeploymentContext context, Service service, Route binding, Map<String, String> filterParams) throws URISyntaxException { List<FilterParamDescriptor> params = new ArrayList<FilterParamDescriptor>(); ResourceDescriptor resource = context.getGatewayDescriptor().addResource(); resource.role(service.getRole()); resource.pattern(binding.getPath()); List<Policy> policyBindings = binding.getPolicies(); if (policyBindings == null) { policyBindings = serviceDefinition.getPolicies(); } if (policyBindings == null) { // add default set addDefaultPolicies(context, service, filterParams, params, resource); } else { addPolicies(context, service, filterParams, params, resource, policyBindings); } addDispatchFilter(context, service, resource, binding); }
private void addRewriteFilter( DeploymentContext context, Service service, Map<String, String> filterParams, List<FilterParamDescriptor> params, ResourceDescriptor resource) throws URISyntaxException { if (!filterParams.isEmpty()) { for (Map.Entry<String, String> filterParam : filterParams.entrySet()) { params.add( resource.createFilterParam().name(filterParam.getKey()).value(filterParam.getValue())); } } addRewriteFilter(context, service, resource, params); }
private void addDispatchFilterForClass( DeploymentContext context, Service service, ResourceDescriptor resource, String className) { FilterDescriptor filter = resource.addFilter().name(getName()).role(DISPATCH_ROLE).impl(GatewayDispatchFilter.class); filter.param().name(DISPATCH_IMPL_PARAM).value(className); FilterParamDescriptor filterParam = filter.param().name(REPLAY_BUFFER_SIZE_PARAM).value(DEFAULT_REPLAY_BUFFER_SIZE); for (Map.Entry<String, String> serviceParam : service.getParams().entrySet()) { if (REPLAY_BUFFER_SIZE_PARAM.equals(serviceParam.getKey())) { filterParam.value(serviceParam.getValue()); } } if (context.getGatewayConfig().isHadoopKerberosSecured()) { filter.param().name("kerberos").value("true"); } else { // TODO: [sumit] Get rid of special case. Add config/param capabilities to service // definitions? // special case for hive filter.param().name("basicAuthPreemptive").value("true"); } }