I am trying to use spring-security
Before all of the configuration
request, works as i expected.Code:http://localhost:9090/app/login2.xhtml
I added a controller:
I have in web.xml:Code:@Controller @RequestMapping("/auth") public class LoginController { @RequestMapping(value = "/login", method = RequestMethod.GET) public String getLoginPage(@RequestParam(value="error", required=false) boolean error, ModelMap model) { return "login2.xhtnml"; } }
With this configuration when i callCode:<servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:META-INF/spring-servlet.xml </param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping>
Error comesCode:http://localhost:9090/app/login2.xhtml
WARN org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/app/login2.xhtml] in DispatcherServlet with name 'spring'
BUT when i change configuration mapping to
Code:<servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/app/*</url-pattern> </servlet-mapping>works as i expectedCode:`http://localhost:9090/app/login2.xhtml`
but
gives no error, no exception, no redirection, i think dispatcher servlet can not know about this request.Code:http://localhost:9090/app/auth/login
works withCode:http://localhost:9090/app/app/auth/login
My understanding:Code:<servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>/app/*</url-pattern> </servlet-mapping>
dispatcher servlet use `"http://localhost:9090/"` as base for searching login2.xhtml
and usefor `/auth/login` URL.Code:`"http://localhost:9090/app"`
I do not know where to set this, and why they are different.


Reply With Quote
