cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1303595 - in /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs: servlet/CXFNonSpringJaxrsServlet.java utils/ResourceUtils.java
Date Wed, 21 Mar 2012 21:56:31 GMT
Author: sergeyb
Date: Wed Mar 21 21:56:31 2012
New Revision: 1303595

URL: http://svn.apache.org/viewvc?rev=1303595&view=rev
Log:
[CXF-4171] Setting the static sub resolution flag earlier

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.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=1303595&r1=1303594&r2=1303595&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
Wed Mar 21 21:56:31 2012
@@ -90,6 +90,9 @@ public class CXFNonSpringJaxrsServlet ex
             address = "/";
         }
         bean.setAddress(address);
+        
+        bean.setStaticSubresourceResolution(getStaticSubResolutionValue(servletConfig));
+        
         String modelRef = servletConfig.getInitParameter(USER_MODEL_PARAM);
         if (modelRef != null) {
             bean.setModelRef(modelRef.trim());
@@ -111,15 +114,16 @@ public class CXFNonSpringJaxrsServlet ex
             bean.setResourceProvider(entry.getKey(), entry.getValue());
         }
         setExtensions(bean, servletConfig);
-        setStaticSubResolution(bean, servletConfig);
-        
+                
         bean.create();
     }
 
-    protected void setStaticSubResolution(JAXRSServerFactoryBean bean, ServletConfig servletConfig)
{
+    protected boolean getStaticSubResolutionValue(ServletConfig servletConfig) {
         String param = servletConfig.getInitParameter(STATIC_SUB_RESOLUTION_PARAM);
         if (param != null) {
-            bean.setStaticSubresourceResolution(Boolean.valueOf(param.trim()));
+            return Boolean.valueOf(param.trim());
+        } else {
+            return false;
         }
     }
     
@@ -357,11 +361,13 @@ public class CXFNonSpringJaxrsServlet ex
         Application app = (Application)createSingletonInstance(appClass, props, servletConfig);
         
         String ignoreParam = servletConfig.getInitParameter(IGNORE_APP_PATH_PARAM);
-        JAXRSServerFactoryBean bean = ResourceUtils.createApplication(app, MessageUtils.isTrue(ignoreParam));
+        JAXRSServerFactoryBean bean = ResourceUtils.createApplication(app, 
+                                            MessageUtils.isTrue(ignoreParam),
+                                            getStaticSubResolutionValue(servletConfig));
         setAllInterceptors(bean, servletConfig);
         setExtensions(bean, servletConfig);
         setSchemasLocations(bean, servletConfig);
-        setStaticSubResolution(bean, servletConfig);
+        
         bean.setBus(getBus());
         bean.create();
     }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java?rev=1303595&r1=1303594&r2=1303595&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
Wed Mar 21 21:56:31 2012
@@ -572,8 +572,11 @@ public final class ResourceUtils {
         }
         return values;
     }
-    
     public static JAXRSServerFactoryBean createApplication(Application app, boolean ignoreAppPath)
{
+        return createApplication(app, ignoreAppPath, false);
+    }
+    public static JAXRSServerFactoryBean createApplication(Application app, boolean ignoreAppPath,
+                                                           boolean staticSubresourceResolution)
{
         
         Set<Object> singletons = app.getSingletons();
         verifySingletons(singletons);
@@ -619,6 +622,7 @@ public final class ResourceUtils {
             }
         }
         bean.setAddress(address);
+        bean.setStaticSubresourceResolution(staticSubresourceResolution);
         bean.setResourceClasses(resourceClasses);
         bean.setProviders(providers);
         for (Map.Entry<Class<?>, ResourceProvider> entry : map.entrySet()) {



Mime
View raw message