Page 1 of 1

Broadleaf not running on root level

Posted: Wed Sep 16, 2015 4:38 am
by Timon
Hello

On my environment the app is not running on root but like this: mydomain.com/mycompany/

After I successfully register the "ajaxredirect:/" takes me to mydomain.com/ but it would be nice if it would take me to the mydomain.com/mycompany/ URL ...

Any ideas on how I can achieve that?

With many thanks
Timon

Re: Broadleaf not running on root level

Posted: Wed Sep 16, 2015 6:29 am
by phillipuniverse
Rename the .war file to ROOT.war instead of mycompany.war. You can modify the finalName property in the pom.xml to make this change permanent.

Re: Broadleaf not running on root level

Posted: Wed Sep 16, 2015 9:11 am
by Timon
Hi Phillip

Thank you very much for your reply.
There is another app running on ROOT so it's necessary in my case to have broadleaf running on a mydomain.com/mycompany.

While debugging I saw that the

Code: Select all

BroadleafRegisterController
returns

Code: Select all

    protected static String registerSuccessView = "ajaxredirect:/";
     ...
    /**
     * Returns the view that will be returned from this controller when the
     * registration is successful.   The success view should be a redirect (e.g. start with "redirect:" since
     * this will cause the entire SpringSecurity pipeline to be fulfilled.
     *
     * By default, returns "redirect:/"
     *
     * @return the register success view
     */
    public String getRegisterSuccessView() {
        return registerSuccessView;
    }


Any idea on how to 'easily' achieve that after successfully registering the mydomain.com/mycompany url is used?

Cheers
Timon

Re: Broadleaf not running on root level

Posted: Wed Sep 16, 2015 9:11 am
by Timon
Hi Phillip

Thank you very much for your reply.
There is another app running on ROOT so it's necessary in my case to have broadleaf running on a mydomain.com/mycompany.

While debugging I saw that the

Code: Select all

BroadleafRegisterController
returns

Code: Select all

    protected static String registerSuccessView = "ajaxredirect:/";
     ...
    /**
     * Returns the view that will be returned from this controller when the
     * registration is successful.   The success view should be a redirect (e.g. start with "redirect:" since
     * this will cause the entire SpringSecurity pipeline to be fulfilled.
     *
     * By default, returns "redirect:/"
     *
     * @return the register success view
     */
    public String getRegisterSuccessView() {
        return registerSuccessView;
    }


Any idea on how to 'easily' achieve that after successfully registering the mydomain.com/mycompany url is used?

Cheers
Timon

Re: Broadleaf not running on root level

Posted: Wed Sep 16, 2015 9:41 am
by phillipuniverse
Sorry, I was moving quickly and did not fully grep your original question.

Ok, so according to http://docs.spring.io/spring-framework/ ... tView.html, the RedirectView has an attribute called contextRelative which defaults to false, which means URLs starting with / get treated as absolute and not relative for the container.

The best fix is to override that method and instead return "redirect:" which should redirect to the context-relative root (e.g. mycompany.com/mycompany).

Please let me know if that works.

Re: Broadleaf not running on root level

Posted: Fri Sep 25, 2015 2:28 am
by Timon
Hello Phillip,

the solution you proposed worked fine.

Thank you very much for your help.

Best regards
Timon

Re: Broadleaf not running on root level

Posted: Thu Nov 05, 2015 12:34 pm
by chaitut715
Timon wrote:Hello

On my environment the app is not running on root but like this: mydomain.com/mycompany/

After I successfully register the "ajaxredirect:/" takes me to mydomain.com/ but it would be nice if it would take me to the mydomain.com/mycompany/ URL ...

Any ideas on how I can achieve that?

With many thanks
Timon


Hi,

Is there any alternative without mentioning domain name or atleast through spring dependency injection.
I don't want to hardcode domain name.

Thank you