class AjaxThymeleafViewResolver 
        extends ThymeleafViewResolver {

    
    private static final Logger vrlogger = LoggerFactory.getLogger(AjaxThymeleafViewResolver.class);
    

    private AjaxHandler ajaxHandler = new DefaultAjaxHandler();



    public AjaxThymeleafViewResolver() {
        super();
    }


    /**
     * <p>
     *   Return the AJAX handler (from Spring Javascript) used
     *   to determine whether a request is an AJAX request or not 
     *   in views resolved by this resolver.
     * </p>
     * <p>
     *   An instance of {@link DefaultAjaxHandler} is set by default.
     * </p>
     * 
     * @return the AJAX handler.
     */
    public AjaxHandler getAjaxHandler() {
        return this.ajaxHandler;
    }

    
    /**
     * <p>
     *   Sets the AJAX handler (from Spring Javascript) used
     *   to determine whether a request is an AJAX request or not 
     *   in views resolved by this resolver.
     * </p>
     * <p>
     *   An instance of {@link DefaultAjaxHandler} is set by default.
     * </p>
     * 
     * @param ajaxHandler the AJAX handler.
     */
    public void setAjaxHandler(final AjaxHandler ajaxHandler) {
        this.ajaxHandler = ajaxHandler;
    }



    
    @Override
    protected View createView(final String viewName, final Locale locale) throws Exception {<FILL_FUNCTION_BODY>}

    
    

    
    private static class AjaxRedirectView extends RedirectView {
        
        private static final Logger vlogger = LoggerFactory.getLogger(AjaxRedirectView.class);

        private AjaxHandler ajaxHandler = new DefaultAjaxHandler();

        AjaxRedirectView(final AjaxHandler ajaxHandler, final String redirectUrl,
                final boolean redirectContextRelative, final boolean redirectHttp10Compatible) {
            super(redirectUrl, redirectContextRelative, redirectHttp10Compatible);
            this.ajaxHandler = ajaxHandler;
        }

        @Override
        protected void sendRedirect(final HttpServletRequest request, final HttpServletResponse response,
                final String targetUrl, final boolean http10Compatible) 
                throws IOException {
            
            if (this.ajaxHandler == null) {
                throw new ConfigurationException("[THYMELEAF] AJAX Handler set into " +
                        AjaxThymeleafViewResolver.class.getSimpleName() + " instance is null.");
            }
            
            if (this.ajaxHandler.isAjaxRequest(request, response)) {
                if (vlogger.isTraceEnabled()) { 
                    vlogger.trace(
                            "[THYMELEAF] RedirectView for URL \"{}\" is an AJAX request. AjaxHandler of class {} " +
                            "will be in charge of processing the request.", targetUrl, this.ajaxHandler.getClass().getName());
                }
                this.ajaxHandler.sendAjaxRedirect(targetUrl, request, response, false);
            } else {
                vlogger.trace(
                        "[THYMELEAF] RedirectView for URL \"{}\" is not an AJAX request. Request will be handled " +
                        "as a normal redirect", targetUrl);
                super.sendRedirect(request, response, targetUrl, http10Compatible);
            }
        }

    }
    
 
    
}


        if (!canHandle(viewName, locale)) {
            return null;
        }
        
        if (this.ajaxHandler == null) {
            throw new ConfigurationException("[THYMELEAF] AJAX Handler set into " +
                    AjaxThymeleafViewResolver.class.getSimpleName() + " instance is null.");
        }

        // Check for special "redirect:" prefix.
        if (viewName.startsWith(REDIRECT_URL_PREFIX)) {
            vrlogger.trace(
                    "[THYMELEAF] View {} is a redirect. An AJAX-enabled RedirectView implementation will " +
            		"be handling the request.", viewName);
            final String redirectUrl = viewName.substring(REDIRECT_URL_PREFIX.length());
            return new AjaxRedirectView(
                    this.ajaxHandler, redirectUrl, isRedirectContextRelative(), isRedirectHttp10Compatible());
        }
        
        final View view = super.createView(viewName, locale);
        
        if (view instanceof AjaxEnabledView) {
            // Set the AJAX handler into view, if it is an AjaxThymeleafView.

            final AjaxEnabledView ajaxEnabledView = (AjaxEnabledView) view;
            
            if (ajaxEnabledView.getAjaxHandler() == null && getAjaxHandler() != null) {
                ajaxEnabledView.setAjaxHandler(getAjaxHandler());
            }
            
        }
        
        return view;
        
    
<methods>public void <init>() ,public void addStaticVariable(java.lang.String, java.lang.Object) ,public boolean getAlwaysProcessRedirectAndForward() ,public java.lang.String getCharacterEncoding() ,public java.lang.String getContentType() ,public java.lang.String[] getExcludedViewNames() ,public boolean getForceContentType() ,public int getOrder() ,public boolean getProducePartialOutputWhileProcessing() ,public Map<java.lang.String,java.lang.Object> getStaticVariables() ,public org.thymeleaf.spring5.ISpringTemplateEngine getTemplateEngine() ,public java.lang.String[] getViewNames() ,public boolean isRedirectContextRelative() ,public boolean isRedirectHttp10Compatible() ,public void setAlwaysProcessRedirectAndForward(boolean) ,public void setCharacterEncoding(java.lang.String) ,public void setContentType(java.lang.String) ,public void setExcludedViewNames(java.lang.String[]) ,public void setForceContentType(boolean) ,public void setOrder(int) ,public void setProducePartialOutputWhileProcessing(boolean) ,public void setRedirectContextRelative(boolean) ,public void setRedirectHttp10Compatible(boolean) ,public void setStaticVariables(Map<java.lang.String,?>) ,public void setTemplateEngine(org.thymeleaf.spring5.ISpringTemplateEngine) ,public void setViewClass(Class<? extends org.thymeleaf.spring5.view.AbstractThymeleafView>) ,public void setViewNames(java.lang.String[]) <variables>public static final java.lang.String FORWARD_URL_PREFIX,public static final java.lang.String REDIRECT_URL_PREFIX,private boolean alwaysProcessRedirectAndForward,private java.lang.String characterEncoding,private java.lang.String contentType,private java.lang.String[] excludedViewNames,private boolean forceContentType,private int order,private boolean producePartialOutputWhileProcessing,private boolean redirectContextRelative,private boolean redirectHttp10Compatible,private final Map<java.lang.String,java.lang.Object> staticVariables,private org.thymeleaf.spring5.ISpringTemplateEngine templateEngine,private Class<? extends org.thymeleaf.spring5.view.AbstractThymeleafView> viewClass,private java.lang.String[] viewNames,private static final org.slf4j.Logger vrlogger