You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2013/02/13 13:50:17 UTC
svn commit: r1445575 -
/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
Author: sergeyb
Date: Wed Feb 13 12:50:16 2013
New Revision: 1445575
URL: http://svn.apache.org/r1445575
Log:
[CXF-4799] Making it a bit simpler to customize the way JAXB context is created
Modified:
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java?rev=1445575&r1=1445574&r2=1445575&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java Wed Feb 13 12:50:16 2013
@@ -108,11 +108,10 @@ public abstract class AbstractJAXBProvid
protected List<String> inDropElements;
protected Map<String, String> inElementsMap;
protected Map<String, String> inAppendMap;
+ protected Map<String, JAXBContext> packageContexts = new HashMap<String, JAXBContext>();
+ protected Map<Class<?>, JAXBContext> classContexts = new HashMap<Class<?>, JAXBContext>();
private boolean attributesToElements;
- private Map<String, JAXBContext> packageContexts = new HashMap<String, JAXBContext>();
- private Map<Class<?>, JAXBContext> classContexts = new HashMap<Class<?>, JAXBContext>();
-
private MessageContext mc;
private Schema schema;
@@ -456,12 +455,14 @@ public abstract class AbstractJAXBProvid
}
}
- JAXBContext context = getPackageContext(type);
+ JAXBContext context = getPackageContext(type, genericType);
- return context != null ? context : getClassContext(type);
+ return context != null ? context : getClassContext(type, genericType);
}
-
public JAXBContext getClassContext(Class<?> type) throws JAXBException {
+ return getClassContext(type, type);
+ }
+ protected JAXBContext getClassContext(Class<?> type, Type genericType) throws JAXBException {
synchronized (classContexts) {
JAXBContext context = classContexts.get(type);
if (context == null) {
@@ -480,8 +481,10 @@ public abstract class AbstractJAXBProvid
return context;
}
}
-
public JAXBContext getPackageContext(Class<?> type) {
+ return getPackageContext(type, type);
+ }
+ protected JAXBContext getPackageContext(Class<?> type, Type genericType) {
if (type == null || type == JAXBElement.class) {
return null;
}