My spring controller should take any get request of any URI type except a URI which started with /resources/*
as this is the call, if I am not wrong, done by spring container to load all the static content in view page.
Current configuration is like this
@RequestMapping(method = RequestMethod.GET, value="/*")
which working fine for request with URI /
or /example
but if someone make a typo in URI eg. /example/random/char
it is throwing exception trace page not found(404) which is pretty obvious and leads me to make value="/**"
@RequestMapping(method = RequestMethod.GET, value="/**")
then the request with URI /
or /example
are unable to load my static content .js, .css or .png
files in my view page. This lead me to the conclusion that spring internally make get call to load these files with an URL pattern eg. http://localhost:8080/resources/my.jpg
.
Note:- I intentionally removed my project name by configuring tomcat.
Update Okay @dimitrisli comment make me realize that I need to elaborate a little about my project.
It basically a URL redirecting component. A user simply call my application through get request and ended with redirecting to the actual page.
For example user request me throw their browser with URL let's say http://localhost:8080/sample
. Now my application needs to split the URL to get the string sample
and search in db for the actual URL against it(so sample
is the alias name for a really long URL). If URL exist it will redirect to the actual page else page does not exist message will show.