What do I do with URIs that SPRINGMVC interceptors can't intercept?

Source: Internet
Author: User

This project encountered a normal no attention to the problem, that is SPRINGMVC interceptor.

<mvc:mapping path= "/**"/>

This configuration should be familiar to everyone, and this configuration will intercept all requests that match/**.
such as Http://localhost:8080/xx, HTTP://LOCALHOST:8080/XX/XX, HTTP://LOCALHOST:8080/YY/XX/AA

But will such a request be intercepted? http://localhost:8080/xx/ http://localhost:8080/xx/xx/


No, he is not able to intercept all requests with/to end, so this is the case for the user, if some user maliciously sends such a request, it can cause a reflection type XSS attack.


In particular, when a project refers to velocity technology, such a request is sent through Velocityviewservlet and then caught to an exception that cannot find the resource.
However, this exception is not thrown out, but is directly reponse out of the page resulting in uniform exception handling in the system does not work.

So how do we intercept such a request ?

This way I chose filter inside the filter to do an illegal request for all "/" Results of the request processing. Solved the problem.

What do I do with URIs that SPRINGMVC interceptors can't intercept?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.