Question

I have configured Broadleaf demo site to run with tomcat server directly from eclipse (not by using ant task). I tried to visit login, register and cart page but the link got redirected. Since in demosite for tomcat, login page must be at /mycompany/login when i click on login link i get redirected to /mycompany/mycompany/login.

I tried to directly hit the url http://localhost:8181/mycompany/login but it also gets redirected/changed to http://localhost:8181/mycompany/mycompany/login. This same issue repeats on clicking register and cart link also.

In LoginController i can see request mapping as "@RequestMapping("/mycompany/login")".

In logs i can see "No mapping found for HTTP request with URI [/mycompany/mycompany/login] in DispatcherServlet with name 'mycompany'" which is true as we do not have a mapping for this url.

Any pointer to where i can look for error.

Was it helpful?

Solution

I'm going to assume that you are actually seeing it redirect to https://localhost:8081 (as opposed to 8181 and http).

Those URLs specifically are marked as requiring SSL in applicationContext-security.xml:

<sec:intercept-url pattern="/register*" requires-channel="https" />
<sec:intercept-url pattern="/login*/**" requires-channel="https" />
<sec:intercept-url pattern="/account/**" access="ROLE_USER" requires-channel="https" />
<sec:intercept-url pattern="/checkout/**" requires-channel="https" />
<sec:intercept-url pattern="/null-checkout/**" requires-channel="https" />
<sec:intercept-url pattern="/null-giftcard/**" requires-channel="https" />
<sec:intercept-url pattern="/confirmation/**" requires-channel="https" />

If you comment those out (or remove them) then you will no longer see redirects. The alternative is to just configure SSL on your Tomcat instance.

Furthermore, the @RequestMapping that you mentioned on LoginController should just be @RequestMapping("/login"). There is no need to include the /mycompany part of that (which I assume is the Tomcat context) since Spring URLs ignore it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top