开发者

What will tomcat do after I type the root link of a spring application?

Let's say I have an application written with spring framework, and I want to know, when I typed in :

http://localhost:8080/test

link, what tomcat will do to generate response for this request ?

Should it have to pass all filters first, then ????

And after I type开发者_StackOverflow中文版d in the url, it always be directed to another link like http://localhost:8080/test/login, where was this redirection implemented ?

If it is hard to explain to me, then please recommend me a book for that, thanks very much !


what tomcat will do to generate response for this request ?

Tomcat will typically send the the request to the relevant DispatcherServlet instance, as configured in your "web.xml" file. This is described in the Spring documentation.

Should it have to pass all filters first, then ????

Yes. Filters are applied before (and after) requests are passed to the Servlet.

And after I typed in the url, it always be directed to another link like http://localhost:8080/test/login, where was this redirection implemented ?

That depends on how you have implemented security. It could be done at the Tomcat level (I think), using SpringSecurity, or hard-wired logic in your Spring MVC controller, or in a plain (non-Spring) Servlet, Filter or (Tomcat specific) Valve.

If you are looking for advice on the best way to implement login / security, I'd recommend using SpringSecurity. SpringSecurity works using Filters.

If it is hard to explain to me, then please recommend me a book for that, thanks very much !

The online Spring and SpringSecurity documentation is as good a place as any. This documentation tends not to spell out exactly how requests get processed in the context of a particular web container, but you should be able to figure the details from the Tomcat docs and the Servlet specification.


If there's a controller that's mapped to that URL, the Spring DispatcherServlet will send the request to it for handling.

If the controller determines that the next view ought to be the one that corresponds to /test/login, then it'll specify so when it sets the ModelAndView.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜