cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1174408 - in /cxf/branches/2.4.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
Date Thu, 22 Sep 2011 21:56:58 GMT
Author: sergeyb
Date: Thu Sep 22 21:56:58 2011
New Revision: 1174408

URL: http://svn.apache.org/viewvc?rev=1174408&view=rev
Log:
Merged revisions 1174404 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1174404 | sergeyb | 2011-09-22 22:55:24 +0100 (Thu, 22 Sep 2011) | 1 line
  
  [CXF-3743] Configuration of extension and language mappings in a non spring servlet
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 22 21:56:58 2011
@@ -1 +1 @@
-/cxf/trunk:1173863-1173871,1174109,1174210
+/cxf/trunk:1173863-1173871,1174109,1174210,1174404

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java?rev=1174408&r1=1174407&r2=1174408&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
Thu Sep 22 21:56:58 2011
@@ -56,6 +56,8 @@ public class CXFNonSpringJaxrsServlet ex
     private static final String OUT_INTERCEPTORS_PARAM = "jaxrs.outInterceptors";
     private static final String IN_INTERCEPTORS_PARAM = "jaxrs.inInterceptors";
     private static final String SERVICE_SCOPE_PARAM = "jaxrs.scope";
+    private static final String EXTENSIONS_PARAM = "jaxrs.extensions";
+    private static final String LANGUAGES_PARAM = "jaxrs.languages";
     private static final String SCHEMAS_PARAM = "jaxrs.schemaLocations";
     private static final String SERVICE_SCOPE_SINGLETON = "singleton";
     private static final String SERVICE_SCOPE_REQUEST = "prototype";
@@ -99,9 +101,37 @@ public class CXFNonSpringJaxrsServlet ex
         for (Map.Entry<Class, ResourceProvider> entry : resourceProviders.entrySet())
{
             bean.setResourceProvider(entry.getKey(), entry.getValue());
         }
+        setExtensions(bean, servletConfig);
+        
         bean.create();
     }
 
+    protected void setExtensions(JAXRSServerFactoryBean bean, ServletConfig servletConfig)
{
+        doSetExtensions(bean, servletConfig, EXTENSIONS_PARAM);
+        doSetExtensions(bean, servletConfig, LANGUAGES_PARAM);
+    }
+    
+    protected void doSetExtensions(JAXRSServerFactoryBean bean, ServletConfig servletConfig,

+            String extParamName) {
+        String extParam = servletConfig.getInitParameter(extParamName);
+        if (extParam != null) {
+            Map<Object, Object> extensions = new HashMap<Object, Object>();
+            String[] pairs = extParam.split(" ");
+            for (String pair : pairs) {
+                String[] value = pair.split(":");
+                if (value.length == 2) {
+                    extensions.put(value[0].trim(), value[1].trim());
+                }
+            }
+            if (EXTENSIONS_PARAM.equals(extParamName)) {
+                bean.setExtensionMappings(extensions);
+            } else {
+                bean.setLanguageMappings(extensions);
+            }
+        }
+        
+    }
+    
     protected void setAllInterceptors(JAXRSServerFactoryBean bean, ServletConfig servletConfig)
{
         setInterceptors(bean, servletConfig, OUT_INTERCEPTORS_PARAM);
         setInterceptors(bean, servletConfig, IN_INTERCEPTORS_PARAM);
@@ -266,6 +296,7 @@ public class CXFNonSpringJaxrsServlet ex
         String ignoreParam = servletConfig.getInitParameter(IGNORE_APP_PATH_PARAM);
         JAXRSServerFactoryBean bean = ResourceUtils.createApplication(app, MessageUtils.isTrue(ignoreParam));
         setAllInterceptors(bean, servletConfig);
+        setExtensions(bean, servletConfig);
         bean.setBus(getBus());
         bean.create();
     }



Mime
View raw message