use of org.apache.sling.rewriter.ProcessorConfiguration in project sling by apache.
the class ProcessorManagerImpl method printConfiguration.
synchronized void printConfiguration(final PrintWriter pw) {
pw.println("Current Apache Sling Rewriter Configuration");
pw.println("=================================================================");
pw.println("Active Configurations");
pw.println("-----------------------------------------------------------------");
// we process the configs in their order
for (final ProcessorConfiguration config : this.orderedProcessors) {
// search the corresponding full config
for (final Map.Entry<String, ConfigEntry[]> entry : this.processors.entrySet()) {
if (entry.getValue().length > 0 && entry.getValue()[0].config == config) {
pw.print("Configuration ");
pw.println(entry.getKey());
pw.println();
printConfiguration(pw, entry.getValue()[0]);
if (entry.getValue().length > 1) {
pw.println("Overriding configurations from the following resource paths: ");
for (int i = 1; i < entry.getValue().length; i++) {
pw.print("- ");
pw.println(entry.getValue()[i].path);
}
}
pw.println();
pw.println();
break;
}
}
}
}
use of org.apache.sling.rewriter.ProcessorConfiguration in project sling by apache.
the class RewriterResponse method getProcessor.
/**
* Search the first matching processor
*/
private Processor getProcessor() {
final ProcessingContext processorContext = new ServletProcessingContext(this.request, this, this.getSlingResponse(), this.contentType);
Processor found = null;
final List<ProcessorConfiguration> processorConfigs = this.processorManager.getProcessorConfigurations();
final Iterator<ProcessorConfiguration> i = processorConfigs.iterator();
while (found == null && i.hasNext()) {
final ProcessorConfiguration config = i.next();
if (config.match(processorContext)) {
try {
found = this.processorManager.getProcessor(config, processorContext);
this.request.getRequestProgressTracker().log("Found processor for post processing {0}", config);
} catch (final SlingException se) {
// already processing an error, we ignore this!
if (processorContext.getRequest().getAttribute("javax.servlet.error.status_code") != null) {
this.request.getRequestProgressTracker().log("Ignoring found processor for post processing {0}" + " as an error occured ({1}) during setup while processing another error.", config, se);
} else {
throw se;
}
}
}
}
return found;
}
Aggregations