cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1423026 - /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
Date Mon, 17 Dec 2012 17:22:09 GMT
Author: sergeyb
Date: Mon Dec 17 17:22:08 2012
New Revision: 1423026

URL: http://svn.apache.org/viewvc?rev=1423026&view=rev
Log:
[CXF-2704] Adding CXFNonSpringJaxrsServlet classloader property for extending classes to set
when needed

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java?rev=1423026&r1=1423025&r2=1423026&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
Mon Dec 17 17:22:08 2012
@@ -89,6 +89,7 @@ public class CXFNonSpringJaxrsServlet ex
     
     private static final String JAXRS_APPLICATION_PARAM = "javax.ws.rs.Application";
     
+    private ClassLoader classLoader;
     
     @Override
     public void init(ServletConfig servletConfig) throws ServletException {
@@ -456,17 +457,26 @@ public class CXFNonSpringJaxrsServlet ex
         bean.create();
     }
     
-    private Class<?> loadClass(String cName) throws ServletException {
+    protected Class<?> loadClass(String cName) throws ServletException {
         return loadClass(cName, "Resource");
     }
     
-    private Class<?> loadClass(String cName, String classType) throws ServletException
{
+    protected Class<?> loadClass(String cName, String classType) throws ServletException
{
         try {
-            return ClassLoaderUtils.loadClass(cName, CXFNonSpringJaxrsServlet.class);
+            
+            Class<?> cls = null;
+            if (classLoader == null) {
+                cls = ClassLoaderUtils.loadClass(cName, CXFNonSpringJaxrsServlet.class);
+            } else {
+                cls = classLoader.loadClass(cName); 
+            }
+            return cls;
         } catch (ClassNotFoundException ex) {
             throw new ServletException("No " + classType + " class " + cName.trim() + " can
be found", ex); 
         }
     }
     
-    
+    public void setClassLoader(ClassLoader loader) {
+        this.classLoader = loader;
+    }
 }



Mime
View raw message