diff options
author | Endi S. Dewata <edewata@redhat.com> | 2014-02-25 12:01:55 -0500 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2014-03-07 22:50:31 -0500 |
commit | b944d31ef744a220f176bf7143e727223ad6b3b1 (patch) | |
tree | 845e86128c25df494e7b5a6bd378f8074f423423 /base/server/cms/src/com | |
parent | 60134cccd26eb872636427afe3fe1c07a253627f (diff) | |
download | pki-b944d31ef744a220f176bf7143e727223ad6b3b1.tar.gz pki-b944d31ef744a220f176bf7143e727223ad6b3b1.tar.xz pki-b944d31ef744a220f176bf7143e727223ad6b3b1.zip |
Direct deployment for TPS.
The deployment tool has been modified to deploy TPS directly from the
share folder. This way the TPS UI can be upgraded automatically with
RPM upgrade without having to write upgrade scripts.
For this to work, the TPS web application files cannot contain any slot
parameters. So, the cfgPath parameter has been removed from web.xml,
and the CMSStartServlet has been modified such that if the parameter is
missing it would generate a default path matching the original value in
web.xml. Also, the velocity.properties has been modified to use a fixed
value for the file.resource.loader.path parameter pointing to the share
folder.
In the future other subsystems may be modified to use the same
deployment mechanism.
Ticket #748, #752, #499
Diffstat (limited to 'base/server/cms/src/com')
-rw-r--r-- | base/server/cms/src/com/netscape/cms/servlet/base/CMSStartServlet.java | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/base/server/cms/src/com/netscape/cms/servlet/base/CMSStartServlet.java b/base/server/cms/src/com/netscape/cms/servlet/base/CMSStartServlet.java index 60230dbab..ab29e2603 100644 --- a/base/server/cms/src/com/netscape/cms/servlet/base/CMSStartServlet.java +++ b/base/server/cms/src/com/netscape/cms/servlet/base/CMSStartServlet.java @@ -21,7 +21,6 @@ import java.io.File; import java.io.IOException; import java.io.PrintWriter; -import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -46,9 +45,27 @@ public class CMSStartServlet extends HttpServlet { private static final long serialVersionUID = 515623839479425172L; public final static String PROP_CMS_CFG = "cfgPath"; - public void init(ServletConfig config) throws ServletException { - super.init(config); - String path = config.getInitParameter(PROP_CMS_CFG); + public void init() throws ServletException { + + // get web application context: /<subsystem> + String context = getServletContext().getContextPath(); + + // get subsystem name by removing the / prefix from the context + String subsystem = context.startsWith("/") ? context.substring(1) : context; + + // get config path from web.xml + String path = getServletConfig().getInitParameter(PROP_CMS_CFG); + + // if path not specified, use default path + if (path == null) { + // catalina.base points to instance dir + // it's defined as CATALINA_BASE in <instance>/conf/tomcat.conf + String instanceDir = System.getProperty("catalina.base"); + + // path: <instance>/conf/<subsystem>/CS.cfg + path = instanceDir + File.separator + "conf" + File.separator + + subsystem + File.separator + "CS.cfg"; + } File f = new File(path); String old_path = ""; @@ -88,6 +105,7 @@ public class CMSStartServlet extends HttpServlet { } } } catch (Exception e) { + e.printStackTrace(); } } } @@ -95,12 +113,11 @@ public class CMSStartServlet extends HttpServlet { try { CMS.start(path); } catch (EBaseException e) { + e.printStackTrace(); } // Register realm for this subsystem - String context = getServletContext().getContextPath(); - if (context.startsWith("/")) context = context.substring(1); - ProxyRealm.registerRealm(context, new PKIRealm()); + ProxyRealm.registerRealm(subsystem, new PKIRealm()); } public void doGet(HttpServletRequest req, HttpServletResponse res) |