protected void mergeWebXml(String portalWebDir, String pluginWebDir) { if (!FileUtil.exists(pluginWebDir + "WEB-INF/ext-web/docroot/WEB-INF/web.xml")) { return; } String tmpDir = SystemProperties.get(SystemProperties.TMP_DIR) + StringPool.SLASH + Time.getTimestamp(); WebXMLBuilder.main( new String[] { portalWebDir + "WEB-INF/web.xml", pluginWebDir + "WEB-INF/ext-web/docroot/WEB-INF/web.xml", tmpDir + "/web.xml" }); File portalWebXml = new File(portalWebDir + "WEB-INF/web.xml"); File tmpWebXml = new File(tmpDir + "/web.xml"); tmpWebXml.setLastModified(portalWebXml.lastModified()); CopyTask.copyFile(tmpWebXml, new File(portalWebDir + "WEB-INF"), true, true); FileUtil.deltree(tmpDir); }
protected void installExt(ServletContext servletContext, ClassLoader portletClassLoader) throws Exception { String servletContextName = servletContext.getServletContextName(); String globalLibDir = PortalUtil.getGlobalLibDir(); String portalWebDir = PortalUtil.getPortalWebDir(); String portalLibDir = PortalUtil.getPortalLibDir(); String pluginWebDir = WebDirDetector.getRootDir(portletClassLoader); copyJar(servletContext, globalLibDir, "ext-service"); copyJar(servletContext, portalLibDir, "ext-impl"); copyJar(servletContext, portalLibDir, "ext-util-bridges"); copyJar(servletContext, portalLibDir, "ext-util-java"); copyJar(servletContext, portalLibDir, "ext-util-taglib"); mergeWebXml(portalWebDir, pluginWebDir); CopyTask.copyDirectory( pluginWebDir + "WEB-INF/ext-web/docroot", portalWebDir, StringPool.BLANK, "**/WEB-INF/web.xml", true, false); FileUtil.copyFile( pluginWebDir + "WEB-INF/ext-" + servletContextName + ".xml", portalWebDir + "WEB-INF/ext-" + servletContextName + ".xml"); ExtRegistry.registerExt(servletContext); }