1 19 20 package org.netbeans.modules.j2ee.oc4j; 21 22 import java.io.File ; 23 import javax.enterprise.deploy.shared.ModuleType ; 24 import javax.enterprise.deploy.spi.TargetModuleID ; 25 import org.netbeans.modules.j2ee.deployment.plugins.api.FindJSPServlet; 26 import org.netbeans.modules.j2ee.oc4j.util.OC4JPluginProperties; 27 import org.openide.ErrorManager; 28 29 33 public class OC4JFindJSPServlet implements FindJSPServlet { 34 35 private OC4JDeploymentManager dm; 36 37 38 public OC4JFindJSPServlet(OC4JDeploymentManager dm) { 39 this.dm = dm; 40 } 41 42 public File getServletTempDirectory(String moduleContextPath) { 43 String deploymentDir = dm.getInstanceProperties().getProperty(OC4JPluginProperties.PROPERTY_OC4J_HOME) + 44 "j2ee" + File.separator + "home" + File.separator + "application-deployments"; String pagesDir = "persistence" + File.separator + "_pages"; try { 47 for(TargetModuleID application : dm.getAvailableModules(ModuleType.EAR, dm.getTargets())) { 48 String parentModuleID = application.getModuleID(); 49 for(TargetModuleID webApps: application.getChildTargetModuleID()) { 50 if(webApps.getWebURL().equals(moduleContextPath)) { 51 return new File (deploymentDir + File.separator + parentModuleID + 52 File.separator + webApps.getModuleID() + pagesDir); 53 } 54 } 55 } 56 } catch(Exception ex) { 57 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); 58 } 59 return null; 60 } 61 62 public String getServletResourcePath(String moduleContextPath, 63 String jspResourcePath) { 64 return "_" + jspResourcePath.substring(0, jspResourcePath.lastIndexOf(".")) + ".java"; 65 } 66 67 public String getServletEncoding(String moduleContextPath, 68 String jspResourcePath) { 69 return "UTF8"; } 71 72 } 73 | Popular Tags |