/dir/fred.xdime
. On output the external path is also relative to the context, e.g. if in the above example the internal URL was file:/tomcat/webapps/volantis/dir/fred.xdime
then that would be mapped back to /dir/fred.xdime
.
This assumes that the application server consistently maps resource paths to URLs within a webapp, i.e. it uses the same URL scheme for them all and the URLs for two resources have the same relationship as the paths for those resources. e.g. /a/b.xdime
and /c.xdime
could map through to file:/foo/a/b.xdime
and file:/foo/c.xdime
.
It would be really nice if it was possible to get access to the context path for the servlet from the {@link ServletContext} so that the externalpath could be created relative to the host, i.e. by resolving it relative to the context and prefixing it with the context. Unfortunately, the only place it is possible to get access to the context path is from a {@link HttpServletRequest} which is not available at the point that we wantto use this class. One suggestion was to get the last path component from the URL to the root of the webapp. Unfortunately, that will not work if the webapp is the ROOT, or if the context is encoded in the URL in some other way. As it is we have to just make sure that anywhere that we need a host relative URL in the outputted page that we prefix it with the context while processing the page.
|
|
|
|