NOTE on use of apache ErrorDocument

If you use the apache configuration: ErrorDocument 404 /ittrium/visit you may have problems with page displays if the browser ever asks for a component (image, css) that happens to be missing. Rather than getting a polite 404, the browser gets a redirect. So where the browser is expecting a stylesheet or a picture, it is getting the redirected home page instead. A much better solution is to use the ittrium internal redirect: ErrorDocument 404 /ittrium/redirect. In this case, AgStaticServlet will field the request, and will typically come back through the http redirect handler for the appropriate target. What we want to do is still respond with a 404 for /site file requests, but redirect to the home page for any other bogus url the user entered. We can configure the error code map (see site.xml for an example) to respond appropriately BUT apache will be doing a redirect to reach back to the servlet, and the request context/path will be whatever is on the ErrorDoc line. HOWEVER apache does provide an extra set of attributes with the request, specifically REDIRECT_URL, REDIRECT_QUERY_STRING, REDIRECT_SERVER_NAME. So if we detect these, then use them instead of what is directly on the request. REMEMBER that the apache mod_jk setting must be set to pass these extra attributes through. Be sure to include the following: JkEnvVar REDIRECT_URL JkEnvVar REDIRECT_QUERY_STRING JkEnvVar REDIRECT_SERVER_NAME. The redirect servlet is serviced by AgStaticServlet. You must define an appropriate mapping in your site/subsite.xml file so that /site based requests still return a 404, while other bogus paths take you to the home page. Use something like the following: /site 404 / /a1/visit and don't forget your cross-context setting in server.xml.