incubator-wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r832873 - in /incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal: DeploymentConfiguration.java servlet/RestServlet.java
Date Wed, 04 Nov 2009 21:17:38 GMT
Author: rott
Date: Wed Nov  4 21:17:37 2009
New Revision: 832873

URL: http://svn.apache.org/viewvc?rev=832873&view=rev
Log:
WINK-226: need fallback for Class.forName in J2EE environments

Modified:
    incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/DeploymentConfiguration.java
    incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/servlet/RestServlet.java

Modified: incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/DeploymentConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/DeploymentConfiguration.java?rev=832873&r1=832872&r2=832873&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/DeploymentConfiguration.java
(original)
+++ incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/DeploymentConfiguration.java
Wed Nov  4 21:17:37 2009
@@ -36,6 +36,7 @@
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Application;
 
+import org.apache.commons.lang.ClassUtils;
 import org.apache.wink.common.internal.application.ApplicationValidator;
 import org.apache.wink.common.internal.i18n.Messages;
 import org.apache.wink.common.internal.lifecycle.LifecycleManagersRegistry;
@@ -360,8 +361,9 @@
         if (handlersFactoryClassName != null) {
             try {
                 logger.debug("Handlers Factory Class is: {}", handlersFactoryClassName);
+                // use ClassUtils.getClass instead of Class.forName so we have classloader
visibility into the Web module in J2EE environments
                 Class<HandlersFactory> handlerFactoryClass =
-                    (Class<HandlersFactory>)Class.forName(handlersFactoryClassName);
+                    (Class<HandlersFactory>)ClassUtils.getClass(handlersFactoryClassName);
                 HandlersFactory handlersFactory = handlerFactoryClass.newInstance();
                 if (requestUserHandlers == null) {
                     requestUserHandlers =

Modified: incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/servlet/RestServlet.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/servlet/RestServlet.java?rev=832873&r1=832872&r2=832873&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/servlet/RestServlet.java
(original)
+++ incubator/wink/trunk/wink-server/src/main/java/org/apache/wink/server/internal/servlet/RestServlet.java
Wed Nov  4 21:17:37 2009
@@ -29,6 +29,7 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.core.Application;
 
+import org.apache.commons.lang.ClassUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.wink.common.internal.i18n.Messages;
@@ -145,7 +146,8 @@
             logger.info(Messages.getMessage("restServletUseDeploymentConfigurationParam"),
                         initParameter,
                         DEPLYMENT_CONF_PARAM);
-            Class<?> confClass = Class.forName(initParameter);
+            // use ClassUtils.getClass instead of Class.forName so we have classloader visibility
into the Web module in J2EE environments
+            Class<?> confClass = ClassUtils.getClass(initParameter);
             return (DeploymentConfiguration)confClass.newInstance();
         }
         return new DeploymentConfiguration();
@@ -160,7 +162,8 @@
             logger.info(Messages.getMessage("restServletJAXRSApplicationInitParam"),
                         initParameter,
                         APPLICATION_INIT_PARAM);
-            appClass = (Class<Application>)Class.forName(initParameter);
+            // use ClassUtils.getClass instead of Class.forName so we have classloader visibility
into the Web module in J2EE environments
+            appClass = (Class<Application>)ClassUtils.getClass(initParameter);
             return appClass.newInstance();
         }
         String appLocationParameter = getInitParameter(APP_LOCATION_PARAM);



Mime
View raw message