Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgkessler2007-04-18 03:13:17 +0000
committergkessler2007-04-18 03:13:17 +0000
commitce37865302b110ce0a00c97c64f0d7db5fe93672 (patch)
tree22f86432f1f0cc5899269fed55310061e53559b1
parent9b4ce3f7c3e42e43bd77fea30a2233d0f8547490 (diff)
downloadwebtools.jsf-ce37865302b110ce0a00c97c64f0d7db5fe93672.tar.gz
webtools.jsf-ce37865302b110ce0a00c97c64f0d7db5fe93672.tar.xz
webtools.jsf-ce37865302b110ce0a00c97c64f0d7db5fe93672.zip
[182226] Unable to create dynamic web project with JSF facet enabled
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDataModelProvider.java38
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils.java13
2 files changed, 21 insertions, 30 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDataModelProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDataModelProvider.java
index aacf5e235..8aa5f8f97 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDataModelProvider.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDataModelProvider.java
@@ -31,10 +31,8 @@ import org.eclipse.jst.jsf.core.IJSFCoreConstants;
import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
import org.eclipse.jst.jsf.core.internal.Messages;
import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryReference;
-import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryRegistryUtil;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary;
-import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
@@ -78,13 +76,13 @@ public class JSFFacetInstallDataModelProvider extends
} else if (propertyName.equals(DEPLOY_IMPLEMENTATION)) {
return Boolean.TRUE;
} else if (propertyName.equals(CONFIG_PATH)) {
- return JSFUtils.JSF_DEFAULT_CONFIG_PATH; //$NON-NLS-1$;
+ return JSFUtils.JSF_DEFAULT_CONFIG_PATH;
} else if (propertyName.equals(SERVLET_NAME)) {
- return JSFUtils.JSF_DEFAULT_SERVLET_NAME; //$NON-NLS-1$
+ return JSFUtils.JSF_DEFAULT_SERVLET_NAME;
} else if (propertyName.equals(SERVLET_CLASSNAME)) {
return JSFUtils.JSF_SERVLET_CLASS;
} else if (propertyName.equals(SERVLET_URL_PATTERNS)) {
- return new String[] { "*.faces" }; //$NON-NLS-1$
+ return new String[] {JSFUtils.JSF_DEFAULT_URL_MAPPING };
} else if (propertyName.equals(FACET_ID)) {
return IJSFCoreConstants.JSF_CORE_FACET_ID;
} else if (propertyName.equals(WEBCONTENT_DIR)){
@@ -98,16 +96,15 @@ public class JSFFacetInstallDataModelProvider extends
}
return super.getDefaultProperty(propertyName);
}
+
public IStatus validate(String name) {
errorMessage = null;
- if (name.equals(IMPLEMENTATION)) {//&& getBooleanProperty(DEPLOY_IMPLEMENTATION)
- List libs = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().getJSFLibrariesByName(getStringPropertyWithDefaultStripped(IMPLEMENTATION_LIBRARIES));
- JSFLibrary lib = ! libs.isEmpty() ? (JSFLibrary)libs.get(0) : null;
- IStatus status = validateImpl(lib);
+ if (name.equals(IMPLEMENTATION)) {
+ JSFLibraryReference lib = (JSFLibraryReference)getProperty(IMPLEMENTATION);
+ IStatus status = validateImpl(lib.getLibrary());
if (!OK_STATUS.equals(status))
- {
return status;
- }
+
return validateClasspath();
} else if (name.equals(CONFIG_PATH)) {
return validateConfigLocation(getStringProperty(CONFIG_PATH));
@@ -123,15 +120,6 @@ public class JSFFacetInstallDataModelProvider extends
private IStatus createErrorStatus(String msg) {
return new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID, msg);
}
-
- private String getStringPropertyWithDefaultStripped(String propertyName) {
- String val = getStringProperty(propertyName);
- if (val.endsWith(JSFLibraryRegistry.DEFAULT_IMPL_LABEL)){
- val = val.substring(0, val.indexOf(JSFLibraryRegistry.DEFAULT_IMPL_LABEL)).trim();
- setProperty(propertyName, val);
- }
- return val;
- }
private IStatus validateServletName(String servletName) {
if (servletName == null || servletName.trim().length() == 0) {
@@ -214,21 +202,13 @@ public class JSFFacetInstallDataModelProvider extends
if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY){
jars.add(entry.getPath().makeAbsolute().toString());
}
-// else if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER){
-// IClasspathContainer cont = (IClasspathContainer)entry;
-// for (int j=0;j<cont.getClasspathEntries().length;j++){
-// jars.add(cont.getClasspathEntries()[j].getPath().makeAbsolute().toString());
-// }
-// }
}
} catch (JavaModelException e) {
// FIXME: what should we do in this case?
JSFCorePlugin.log(e, "Error searching class path");
}
}
- else {//as we do not have a javaProject yet, all we can do is validate that there is no duplicate jars (absolute path)
-
- }
+ //else as we do not have a javaProject yet, all we can do is validate that there is no duplicate jars (absolute path)
IStatus status = null;
JSFLibraryReference ref = ((JSFLibraryReference)getProperty(IJSFFacetInstallDataModelProperties.IMPLEMENTATION));
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils.java
index 313d8a00a..e56ab597b 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils.java
@@ -61,10 +61,21 @@ public class JSFUtils {
* The name of the context parameter used for JSF configuration files
*/
public static final String JSF_CONFIG_CONTEXT_PARAM = "javax.faces.CONFIG_FILES"; //$NON-NLS-1$
+
+ /**
+ * The name of the context parameter used for defining the default JSP file extension
+ */
+ public static final String JSF_DEFAULT_SUFFIX_CONTEXT_PARAM = "javax.faces.DEFAULT_SUFFIX"; //$NON-NLS-1$
+
/**
* The path to the default application configuration file
*/
- public static final String JSF_DEFAULT_CONFIG_PATH = "/WEB-INF/faces-config.xml"; //$NON-NLS-1$
+ public static final String JSF_DEFAULT_CONFIG_PATH = "/WEB-INF/faces-config.xml";
+
+ /**
+ * Default URL mapping to faces servlet
+ */
+ public static final String JSF_DEFAULT_URL_MAPPING = "/faces/*"; //$NON-NLS-1$
/**
* the key for implementation libraries in persistent properties

Back to the top