Search code examples
springapplication-server

RequstMapping: How to catch anything that that begins with path '/view/*'?


its easy to intercept any request coming to a specific domain like

http://localhost/stuff

This would be something like

@Controller
@RequestMapping("/view")
public class JsController {

logger.info("Client hit stuff domain);

}

Easy enough

Question: How do you intercept ANYTHING that begins with domain view?

Example

http://localhost/view/someView1

logger.info("Client is within subdomain 'view");

http://localhost/view/someView2

logger.info("Client is within subdomain 'view");

http://localhost/view/js/helper.js

logger.info("Client is within subdomain 'view");


Solution

  • Maybe I misunderstood, but this mapping

    @RequestMapping(value = "/view/**")
    

    will catch every path starting with /view.