if (packages != null) {
props.put(PackagesResourceConfig.PROPERTY_PACKAGES, packages);
return new PackagesResourceConfig(props);
}
ResourceConfig defaultConfig = webConfig.getDefaultResourceConfig(props);
if (defaultConfig != null)
return defaultConfig;
return getDefaultResourceConfig(props, webConfig);
}
try {
Class resourceConfigClass = ReflectionHelper.
classForNameWithException(resourceConfigClassName);
if (resourceConfigClass == ClasspathResourceConfig.class) {
String[] paths = getPaths(webConfig.getInitParameter(
ClasspathResourceConfig.PROPERTY_CLASSPATH));
props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths);
return new ClasspathResourceConfig(props);
} else if (ResourceConfig.class.isAssignableFrom(resourceConfigClass)) {
try {
Constructor constructor = resourceConfigClass.getConstructor(Map.class);
if (ClasspathResourceConfig.class.isAssignableFrom(resourceConfigClass)) {
String[] paths = getPaths(webConfig.getInitParameter(
ClasspathResourceConfig.PROPERTY_CLASSPATH));
props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH, paths);
}
return (ResourceConfig)constructor.newInstance(props);
} catch (NoSuchMethodException ex) {
// Pass through and try the default constructor
} catch (Exception e) {
throw new ServletException(e);
}
try {
return (ResourceConfig)resourceConfigClass.newInstance();
} catch(Exception e) {
throw new ServletException(e);
}
} else if (Application.class.isAssignableFrom(resourceConfigClass)) {
try {
ResourceConfig rc = new ApplicationAdapter(
(Application)resourceConfigClass.newInstance());
rc.getProperties().putAll(props);
return rc;
} catch(Exception e) {
throw new ServletException(e);
}
} else {