empire-db-jakarta-faces/src/main/java/org/apache/empire/jakarta/app/WebApplication.java [351:388]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void redirectDirectly(final FacesContext fc, String url)
    {
        try
        {   // check params
            if (fc==null)
                throw new InvalidArgumentException("fc", fc);
            if (fc.getResponseComplete())
                throw new InvalidOperationException("Unable to redirect. Response is already complete!");
            if (url==null)
                url = StringUtils.EMPTY; // redirect to root
            // Prepend Context-Path
            ExternalContext ec = fc.getExternalContext(); 
            String ctxPath = ec.getRequestContextPath();
            if (url.indexOf("://")>0)
            {   // Should not contain the context-path
                if (url.startsWith("http") && url.indexOf(ctxPath)>0)
                    log.warn("Redirect url \"{}\" contains protokoll and context-path. Please remove.", url);
                else
                    log.info("Redirecting to absolute url {}", url);
            }
            else if (!url.startsWith(ctxPath))
            {   // assemble url
                String sep = (url.length()>0 && url.charAt(0)!='/' ? "/" : null);
                url = StringUtils.concat(ctxPath, sep, url);
                // relative
                log.debug("Redirecting to relative url {}", url);
            }
            else
                log.warn("Redirect url \"{}\" already contains context-path. Please remove.", url);
            // redirectDirectly
            ec.redirect(url);
            fc.responseComplete();
        }
        catch (IOException e)
        {   // What can we do now?
            log.error("Failed to redirect to {}", url, e);
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



empire-db-jsf2/src/main/java/org/apache/empire/jsf2/app/WebApplication.java [350:387]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public void redirectDirectly(final FacesContext fc, String url)
    {
        try
        {   // check params
            if (fc==null)
                throw new InvalidArgumentException("fc", fc);
            if (fc.getResponseComplete())
                throw new InvalidOperationException("Unable to redirect. Response is already complete!");
            if (url==null)
                url = StringUtils.EMPTY; // redirect to root
            // Prepend Context-Path
            ExternalContext ec = fc.getExternalContext(); 
            String ctxPath = ec.getRequestContextPath();
            if (url.indexOf("://")>0)
            {   // Should not contain the context-path
                if (url.startsWith("http") && url.indexOf(ctxPath)>0)
                    log.warn("Redirect url \"{}\" contains protokoll and context-path. Please remove.", url);
                else
                    log.info("Redirecting to absolute url {}", url);
            }
            else if (!url.startsWith(ctxPath))
            {   // assemble url
                String sep = (url.length()>0 && url.charAt(0)!='/' ? "/" : null);
                url = StringUtils.concat(ctxPath, sep, url);
                // relative
                log.debug("Redirecting to relative url {}", url);
            }
            else
                log.warn("Redirect url \"{}\" already contains context-path. Please remove.", url);
            // redirectDirectly
            ec.redirect(url);
            fc.responseComplete();
        }
        catch (IOException e)
        {   // What can we do now?
            log.error("Failed to redirect to {}", url, e);
        }
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



