Package org.apache.sling.rewriter

Examples of org.apache.sling.rewriter.ProcessingContext


        this.doTestAgainstProcessingContextWithSelector(configuration, false);
    }

    private void doTestAgainstProcessingContextWithSelector(ProcessorConfiguration configuration, boolean negate) {
        // setup processing context
        ProcessingContext context = createProcessingContext(this.mockRequestWithSelector);
        // test the given configuration
        doTest(configuration, context, negate);
    }
View Full Code Here


        doTest(configuration, context, negate);
    }

    private void doTestAgainstProcessingContextWithoutSelector(ProcessorConfiguration configuration, boolean negate) {
        // setup processing context
        ProcessingContext context = createProcessingContext(this.mockRequestWithoutSelector);
        // test the given configuration
        doTest(configuration, context, negate);
    }
View Full Code Here

            assertFalse(configuration.match(context));
        }
    }

    private ProcessingContext createProcessingContext(SlingHttpServletRequest request) {
        final ProcessingContext context = mock(ProcessingContext.class);
        when(context.getContentType()).thenReturn("text/xml");
        when(context.getRequest()).thenReturn(request);

        return context;
    }
View Full Code Here

    /**
     * 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) {
                    // if an exception occurs during setup of the pipeline and we are currently
                    // 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;
                    }
View Full Code Here

TOP

Related Classes of org.apache.sling.rewriter.ProcessingContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.