I'm currently trying to make a CMS project, where I will be making a so called "blogsite", something like wordpress. The problem that I'm facing is that I want to access the blogsite directly via url.
Something like local/CMS/site_name
normally it would be a 404 error since there is nothing that will be mapped there, so i catched it in the web.xml by
<error-page>
<error-code>404</error-code>
<location>/checkBlogUrl.action</location>
</error-page>
so I can process the URL request there, query the site, if it exists forward the page to there, if not error.jsp.
The code I'm currently trying to make it work is
HttpServletRequest request = ServletActionContext.getRequest();
String a = request.getServerName() +" : " + request.getRequestURI()
+ " : "+ request.getServletPath() +" : "+ request.getLocalName();
System.out.println(a);
which sadly returned this
mycms : /CMS/checkBlogUrl.action : /checkBlogUrl.action : mycms
How can I get the site_name? Or, is there a better way to "forward" the url for a database query?