cxf-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=1174416&view=rev
Log:
Merged revisions 1174408 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.4.x-fixes

................
  r1174408 | sergeyb | 2011-09-22 22:56:58 +0100 (Thu, 22 Sep 2011) | 9 lines
  
  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.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 22 22:10:08 2011
@@ -1,2 +1,2 @@
-/cxf/branches/2.4.x-fixes:1172584,1173057,1173766,1174040
-/cxf/trunk:1172522,1173027,1173997-1173998
+/cxf/branches/2.4.x-fixes:1172584,1173057,1173766,1174040,1174408
+/cxf/trunk:1172522,1173027,1173997-1173998,1174404

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

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java?rev=1174416&r1=1174415&r2=1174416&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
Thu Sep 22 22:10:08 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";
@@ -98,9 +100,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);
@@ -265,6 +295,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.create();
     }
     



Mime
View raw message