Search in sources :

Example 1 with UrlRewriteStepFlow

use of org.apache.knox.gateway.filter.rewrite.api.UrlRewriteStepFlow in project knox by apache.

the class UrlRewriteStepProcessorHolder method process.

@Override
public UrlRewriteStepStatus process(UrlRewriteContext context) throws Exception {
    UrlRewriteStepStatus status = UrlRewriteStepStatus.SUCCESS;
    // If initialization failed then fail processing
    if (processor != null) {
        status = processor.process(context);
        if (UrlRewriteStepStatus.SUCCESS == status && descriptor instanceof UrlRewriteFlowDescriptor && !childProcessors.isEmpty()) {
            UrlRewriteFlowDescriptor flowDescriptor = (UrlRewriteFlowDescriptor) descriptor;
            UrlRewriteStepFlow flow = flowDescriptor.flow();
            if (flow == null) {
                flow = UrlRewriteStepFlow.AND;
            }
            switch(flow) {
                case ALL:
                    return processAllFlow(context);
                case AND:
                    return processAndFlow(context);
                case OR:
                    return processOrFlow(context);
            }
        }
    }
    return status;
}
Also used : UrlRewriteStepStatus(org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteStepStatus) UrlRewriteFlowDescriptor(org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFlowDescriptor) UrlRewriteStepFlow(org.apache.knox.gateway.filter.rewrite.api.UrlRewriteStepFlow)

Aggregations

UrlRewriteFlowDescriptor (org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFlowDescriptor)1 UrlRewriteStepFlow (org.apache.knox.gateway.filter.rewrite.api.UrlRewriteStepFlow)1 UrlRewriteStepStatus (org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteStepStatus)1