Search in sources :

Example 1 with Scheme

use of org.apache.knox.gateway.util.urltemplate.Scheme in project knox by apache.

the class ServiceSchemeFunctionProcessor method resolve.

@Override
public List<String> resolve(UrlRewriteContext context, List<String> parameters) throws Exception {
    List<String> results = null;
    if (parameters != null) {
        results = new ArrayList<String>(parameters.size());
        for (String parameter : parameters) {
            String url = lookupServiceUrl(parameter);
            if (url != null && !url.equals(parameter)) {
                Template template = Parser.parseLiteral(url);
                Scheme scheme = template.getScheme();
                if (scheme != null) {
                    parameter = scheme.getFirstValue().getPattern();
                }
            }
            results.add(parameter);
        }
    }
    return results;
}
Also used : Scheme(org.apache.knox.gateway.util.urltemplate.Scheme) Template(org.apache.knox.gateway.util.urltemplate.Template)

Aggregations

Scheme (org.apache.knox.gateway.util.urltemplate.Scheme)1 Template (org.apache.knox.gateway.util.urltemplate.Template)1