Fixed various bugs in methods enabling CCM installed into any arbitrary context. Still needs testing!

git-svn-id: https://svn.libreccm.org/ccm/trunk@2564 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2014-03-11 09:09:20 +00:00
parent 6fac837678
commit 549e3e3723
5 changed files with 60 additions and 15 deletions

View File

@ -12,7 +12,12 @@ import java.util.Iterator;
import java.util.Map;
/**
*
* Provides the system name of the CCM Spin off (eg aplaws or ScientificCMS) and
* the version number. It's primary use is to provide the theme engine with that
* information for display.
* It is currently stored as a (configurable) property, but should be retrieved
* from the build system in the future.
*
* @author Sören Bernstein <quasi@quasiweb.de>
* @author Jens Pelzetter
*/
@ -31,8 +36,8 @@ public class SystemInformation extends AbstractConfig { //implements Lockable {
private static SystemInformation INSTANCE;// = new SystemInformation();
public SystemInformation() {
register(sysInfoParam);
loadInfo();
}

View File

@ -619,8 +619,17 @@ public class Application extends Resource {
}
/**
* Provides the web application context path where this application is
* installed and executing.
* As of version 6.6 all CCM appplications are installed into one context
* and therefore are executing in the same one. The method then returns an
* empty string, denoting the main (default) CCM webapp context. So we
* currently can't differentiate whether the application is installed in
* ROOT context of CCM is resulting in a CCM application installed in its
* own context (separate from the main CCM context) not allowed in ROOT.
*
* @return
* @return webapp context installed or "" if no specific context of it's
* own but executing in main CCM context.
*/
public String getContextPath() {
return "";

View File

@ -410,10 +410,22 @@ public class CCMDispatcherServlet extends BaseServlet {
BigDecimal getAppID() { return m_id; }
/**
*
* @return
* Provides the context the application is executing. Usually all CCM
* applications will now execute in the samme webapp context. The
* app.getContextPath() return "" in this case where an application is
* executing in no specific context but CCM's default.
* @return The context path of the application's url, "" in case of
* executing in the ROOT context.
*/
String getTypeContextPath() { return m_typeContextPath; }
String getTypeContextPath() {
if (m_typeContextPath.equals("") ) {
// app is running in CCM's default context, determine the
// actual one
return Web.getWebappContextPath();
} else {
return m_typeContextPath;
}
}
/**
*

View File

@ -364,12 +364,20 @@ public class Web {
/**
* Follows the same rules as findResource(String), but instead returns a
* request dispatcher for serving the resource
* request dispatcher for serving the resource. It is mainly used to find
* an application's jsp template(s) stored in the file system (or war file
* in case of unexploded distribution) and provide a handle to execute it.
* These jsp templates used to be stored a directory named "templates" and
* there within a directory carrying the modules name. As example:
* "/templates/ccm-navigation/index.jsp". Inside the modules subdirectory
* there might by a module specific subdirectory structure. It's up to the
* module.
*
* @param resource Path to the resource as String. It may include the
* @param resourcePath Path to the resource as String. It may include the
* web context in its first part or may be relative to the
* current webapp document root (i.e. its context).
* Additionally, it the web application component (if any)
* LEGACY FORMAT:
* Additionally, the web application component (if any)
* may be a comma separate list of webapps to search for the
* rest of the path String.
* So, if the 'resource' is:
@ -381,16 +389,28 @@ public class Web {
* /myproj/themes/heirloom/admin/index.xsl
* /ccm-cms/themes/heirloom/admin/index.xsl
* </pre>
* LEGACY FORMAT SUPPORT NOT IMPLEMENTED YET!
* LEGACY FORMAT MAY BE COMPLETELY REMOVED IN FUTURE RELEASE
*
* @return the request dispatcher for the resource, or null
*/
public static RequestDispatcher findResourceDispatcher(String resource) {
public static RequestDispatcher findResourceDispatcher(String resourcePath) {
URL url = findResource(resource);
ServletContext ctx = s_urlContext;
String path = url.toString();
if (resourcePath == null) {
return null;
}
ServletContext ctx = getServletContext();
// Check for old style resource format including a comma seoarated list
// of webapps
if(resourcePath.indexOf(",") <= 0 ) {
// no comma separated list found, process as normal
return ctx == null ? null : ctx.getRequestDispatcher(resourcePath);
} else {
// old style format not implemented yet here
return null;
}
return ctx == null ? null : ctx.getRequestDispatcher(path);
}

View File

@ -97,7 +97,6 @@ public class ThemeXSLParameterGenerator implements XSLParameterGenerator,
String baseDir = null;
if (themeURL != null) {
// this means we are in a preview mode
if (s_log.isDebugEnabled()) {