Charles Severance wrote:
On Dec 2, 2006, at 8:29 PM, David H. DeWolf wrote:
1) if a getContextPath() method exists on the ServletContext, invoke
it using reflection (so as to not fail in <= 2.4 environments) and use
the return value as the applicationId
2) if not, check to see if a init parameter or context attribute named
org.apache.pluto.CONTEXT_PATH has been set. If so, use it's value as
the applicationId
3) if not, check to see if the web app has been given a name
(ServletContext.getServletContextName()). If so, retrieve it's value
and use a hex string version of it for the applicationId.
4) if not, generate a random string and us it. This final fallback
allows the portlet to only be used temporarily. (If anyone has any
better ideas on what else we can use, please let me know - perhaps a
unique string derived off of the portlets available within the app).
(4) seems like it is worth it to come up with something based on portlet
id(s) - at a minimum - if the random number is generated (for me this
would be step 5 now) - a loud/nasty log message should happen to insure
no nasty surprise later.
Allready done, I now calculate the context path using the url from
ServletContext.getResource(). This approach replaces 2-4. See the
other post for more details.
/Chuck