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/10/17 17:15:21 UTC
svn commit: r1533109 - in /cxf/branches/2.7.x-fixes: ./
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ rt/front...
Author: sergeyb
Date: Thu Oct 17 15:15:20 2013
New Revision: 1533109
URL: http://svn.apache.org/r1533109
Log:
Merged revisions 1532894 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1532894 | sergeyb | 2013-10-16 21:29:59 +0100 (Wed, 16 Oct 2013) | 1 line
[CXF-5336] Various WADLGenerator improvements
........
Modified:
cxf/branches/2.7.x-fixes/ (props changed)
cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ResourceTypes.java
cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Merged /cxf/trunk:r1532894
Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ResourceTypes.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ResourceTypes.java?rev=1533109&r1=1533108&r2=1533109&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ResourceTypes.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ResourceTypes.java Thu Oct 17 15:15:20 2013
@@ -27,6 +27,7 @@ import javax.xml.namespace.QName;
public class ResourceTypes {
private Map<Class<?>, Type> allTypes = new HashMap<Class<?>, Type>();
private Map<Class<?>, QName> collectionMap = new HashMap<Class<?>, QName>();
+ private Map<Class<?>, QName> xmlNameMap = new HashMap<Class<?>, QName>();
public Map<Class<?>, Type> getAllTypes() {
return allTypes;
}
@@ -36,7 +37,7 @@ public class ResourceTypes {
public Map<Class<?>, QName> getCollectionMap() {
return collectionMap;
}
- public void setCollectionMap(Map<Class<?>, QName> collectionMap) {
- this.collectionMap = collectionMap;
+ public Map<Class<?>, QName> getXmlNameMap() {
+ return xmlNameMap;
}
}
Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java?rev=1533109&r1=1533108&r2=1533109&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java Thu Oct 17 15:15:20 2013
@@ -54,8 +54,10 @@ import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.ext.MessageBodyWriter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.XMLStreamException;
@@ -98,6 +100,7 @@ import org.apache.cxf.jaxrs.model.Parame
import org.apache.cxf.jaxrs.model.ParameterType;
import org.apache.cxf.jaxrs.model.ResourceTypes;
import org.apache.cxf.jaxrs.model.URITemplate;
+import org.apache.cxf.jaxrs.provider.ProviderFactory;
import org.apache.cxf.jaxrs.utils.AnnotationUtils;
import org.apache.cxf.jaxrs.utils.InjectionUtils;
import org.apache.cxf.jaxrs.utils.JAXRSUtils;
@@ -133,6 +136,7 @@ public class WadlGenerator implements Re
private boolean linkJsonToXmlSchema;
private boolean useJaxbContextForQnames = true;
private boolean supportCollections = true;
+ private boolean supportJaxbXmlType = true;
private List<String> externalSchemasCache;
private List<URI> externalSchemaLinks;
@@ -146,22 +150,37 @@ public class WadlGenerator implements Re
private String nsPrefix = DEFAULT_NS_PREFIX;
private MediaType defaultMediaType = DEFAULT_MEDIA_TYPE;
+ private Bus bus;
+
public WadlGenerator() {
}
+ public WadlGenerator(Bus bus) {
+ this.bus = bus;
+ }
+
public WadlGenerator(WadlGenerator other) {
this.wadlNamespace = other.wadlNamespace;
this.externalQnamesMap = other.externalQnamesMap;
this.externalSchemaLinks = other.externalSchemaLinks;
this.externalSchemasCache = other.externalSchemasCache;
this.ignoreMessageWriters = other.ignoreMessageWriters;
+ this.ignoreForwardSlash = other.ignoreForwardSlash;
+ this.ignoreRequests = other.ignoreRequests;
+ this.linkJsonToXmlSchema = other.linkJsonToXmlSchema;
this.privateAddresses = other.privateAddresses;
this.resolver = other.resolver;
this.addResourceAndMethodIds = other.addResourceAndMethodIds;
this.singleResourceMultipleMethods = other.singleResourceMultipleMethods;
this.useJaxbContextForQnames = other.useJaxbContextForQnames;
this.useSingleSlashResource = other.useSingleSlashResource;
+ this.supportCollections = other.supportCollections;
+ this.supportJaxbXmlType = other.supportJaxbXmlType;
+ this.nsPrefix = other.nsPrefix;
+ this.applicationTitle = other.applicationTitle;
+ this.defaultMediaType = other.defaultMediaType;
+ this.bus = other.bus;
}
public Response handleRequest(Message m, ClassResourceInfo resource) {
@@ -214,7 +233,11 @@ public class WadlGenerator implements Re
List<ClassResourceInfo> cris = getResourcesList(m, resource);
- ResourceTypes resourceTypes = ResourceUtils.getAllRequestResponseTypes(cris, useJaxbContextForQnames);
+ MessageBodyWriter<?> jaxbWriter = useJaxbContextForQnames
+ ? ProviderFactory.getInstance(m).getRegisteredJaxbWriter() : null;
+ ResourceTypes resourceTypes = ResourceUtils.getAllRequestResponseTypes(cris,
+ useJaxbContextForQnames,
+ jaxbWriter);
Set<Class<?>> allTypes = resourceTypes.getAllTypes().keySet();
JAXBContext jaxbContext = useJaxbContextForQnames ? ResourceUtils
@@ -728,19 +751,20 @@ public class WadlGenerator implements Re
sb.append("</representation>");
} else {
boolean isCollection = InjectionUtils.isSupportedCollectionOrArray(type);
+ Class<?> theActualType = null;
if (isCollection) {
- type = InjectionUtils.getActualType(!inbound ? opMethod.getGenericReturnType() : opMethod
+ theActualType = InjectionUtils.getActualType(!inbound ? opMethod.getGenericReturnType() : opMethod
.getGenericParameterTypes()[getRequestBodyParam(ori).getIndex()]);
} else {
- type = ResourceUtils.getActualJaxbType(type, opMethod, inbound);
+ theActualType = ResourceUtils.getActualJaxbType(type, opMethod, inbound);
}
if (isJson) {
- sb.append(" element=\"").append(type.getSimpleName()).append("\"");
+ sb.append(" element=\"").append(theActualType.getSimpleName()).append("\"");
} else if (qnameResolver != null
&& (mt.getSubtype().contains("xml") || linkJsonToXmlSchema
&& mt.getSubtype().contains("json"))
- && jaxbTypes.contains(type)) {
- generateQName(sb, qnameResolver, clsMap, type, isCollection,
+ && jaxbTypes.contains(theActualType)) {
+ generateQName(sb, qnameResolver, clsMap, theActualType, isCollection,
getBodyAnnotations(ori, inbound));
}
addDocsAndCloseElement(sb, anns, "representation", docCategory, allowDefault, isJson);
@@ -953,13 +977,14 @@ public class WadlGenerator implements Re
clsMap.put(type, qname);
} else {
XMLName name = AnnotationUtils.getAnnotation(annotations, XMLName.class);
- QName collectionName = null;
+ String localPart = null;
if (name != null) {
- QName tempQName = JAXRSUtils.convertStringToQName(name.value());
- collectionName = new QName(qname.getNamespaceURI(), tempQName.getLocalPart(),
- qname.getPrefix());
- writeQName(sb, collectionName);
+ localPart = JAXRSUtils.convertStringToQName(name.value()).getLocalPart();
+ } else {
+ localPart = qname.getLocalPart() + "s";
}
+ QName collectionName = new QName(qname.getNamespaceURI(), localPart, qname.getPrefix());
+ writeQName(sb, collectionName);
}
}
}
@@ -981,17 +1006,58 @@ public class WadlGenerator implements Re
String.class,
DOMResult.class))) {
Document doc = (Document)r.getNode();
+ ElementQNameResolver theResolver = createElementQNameResolver(context);
+ String tns = doc.getDocumentElement().getAttribute("targetNamespace");
+
+ String tnsDecl =
+ doc.getDocumentElement().getAttribute("xmlns:tns");
+ String tnsPrefix = tnsDecl != null && tnsDecl.equals(tns) ? "tns:" : "";
+
+ if (supportJaxbXmlType) {
+ for (Class<?> cls : resourceTypes.getAllTypes().keySet()) {
+ if (cls.getAnnotation(XmlRootElement.class) != null) {
+ continue;
+ }
+ XmlType root = cls.getAnnotation(XmlType.class);
+ if (root != null) {
+ QName typeName = theResolver.resolve(cls, new Annotation[] {},
+ Collections.<Class<?>, QName> emptyMap());
+ if (typeName != null && tns.equals(typeName.getNamespaceURI())) {
+ QName elementName = resourceTypes.getXmlNameMap().get(cls);
+ if (elementName == null) {
+ elementName = typeName;
+ }
+ Element newElement = doc
+ .createElementNS(XmlSchemaConstants.XSD_NAMESPACE_URI, "xs:element");
+ newElement.setAttribute("name", elementName.getLocalPart());
+ newElement.setAttribute("type", tnsPrefix + typeName.getLocalPart());
+ doc.getDocumentElement().appendChild(newElement);
+ }
+ }
+ }
+ }
if (supportCollections && !resourceTypes.getCollectionMap().isEmpty()) {
- ElementQNameResolver theResolver = createElementQNameResolver(context);
- String tns = doc.getDocumentElement().getAttribute("targetNamespace");
for (Map.Entry<Class<?>, QName> entry : resourceTypes.getCollectionMap().entrySet()) {
- if (tns.equals(entry.getValue().getNamespaceURI())) {
+ QName colQName = entry.getValue();
+ if (colQName == null) {
+ colQName = theResolver.resolve(entry.getKey(), new Annotation[] {},
+ Collections.<Class<?>, QName> emptyMap());
+ if (colQName != null) {
+ colQName = new QName(colQName.getNamespaceURI(),
+ colQName.getLocalPart() + "s",
+ colQName.getPrefix());
+ }
+ }
+ if (colQName == null) {
+ continue;
+ }
+ if (tns.equals(colQName.getNamespaceURI())) {
QName typeName = theResolver.resolve(entry.getKey(), new Annotation[] {},
- Collections.<Class<?>, QName> emptyMap());
+ Collections.<Class<?>, QName> emptyMap());
if (typeName != null) {
Element newElement = doc
.createElementNS(XmlSchemaConstants.XSD_NAMESPACE_URI, "xs:element");
- newElement.setAttribute("name", entry.getValue().getLocalPart());
+ newElement.setAttribute("name", colQName.getLocalPart());
Element ctElement = doc.createElementNS(XmlSchemaConstants.XSD_NAMESPACE_URI,
"xs:complexType");
newElement.appendChild(ctElement);
@@ -1001,7 +1067,7 @@ public class WadlGenerator implements Re
Element xsElement = doc.createElementNS(XmlSchemaConstants.XSD_NAMESPACE_URI,
"xs:element");
seqElement.appendChild(xsElement);
- xsElement.setAttribute("ref", "tns:" + typeName.getLocalPart());
+ xsElement.setAttribute("ref", tnsPrefix + typeName.getLocalPart());
xsElement.setAttribute("minOccurs", "0");
xsElement.setAttribute("maxOccurs", "unbounded");
@@ -1012,8 +1078,6 @@ public class WadlGenerator implements Re
}
DOMSource source = new DOMSource(doc, r.getSystemId());
schemas.add(source);
- String tns = ((Document)source.getNode()).getDocumentElement()
- .getAttribute("targetNamespace");
if (!StringUtils.isEmpty(tns)) {
targetNamespaces.add(tns);
}
@@ -1032,20 +1096,26 @@ public class WadlGenerator implements Re
return xmlSchemaCollection;
}
+ private QName getJaxbQName(String name, String namespace, Class<?> type, Map<Class<?>, QName> clsMap) {
+
+ QName qname = getQNameFromParts(name, namespace, type, clsMap);
+ if (qname != null) {
+ return qname;
+ }
+ String ns = JAXBUtils.getPackageNamespace(type);
+ if (ns != null) {
+ return getQNameFromParts(name, ns, type, clsMap);
+ } else {
+ return null;
+ }
+
+ }
+
private QName getJaxbQName(JAXBContextProxy jaxbProxy, Class<?> type, Map<Class<?>, QName> clsMap) {
XmlRootElement root = type.getAnnotation(XmlRootElement.class);
if (root != null) {
- QName qname = getQNameFromParts(root.name(), root.namespace(), type, clsMap);
- if (qname != null) {
- return qname;
- }
- String ns = JAXBUtils.getPackageNamespace(type);
- if (ns != null) {
- return getQNameFromParts(root.name(), ns, type, clsMap);
- } else {
- return null;
- }
+ return getJaxbQName(root.name(), root.namespace(), type, clsMap);
}
try {
@@ -1244,7 +1314,7 @@ public class WadlGenerator implements Re
if (d.docuri().startsWith(CLASSPATH_PREFIX)) {
String path = d.docuri().substring(CLASSPATH_PREFIX.length());
is = ResourceUtils.getClasspathResourceStream(path, SchemaHandler.class,
- BusFactory.getDefaultBus());
+ bus == null ? BusFactory.getDefaultBus() : bus);
if (is != null) {
try {
sb.append(IOUtils.toString(is));
@@ -1297,7 +1367,8 @@ public class WadlGenerator implements Re
}
private void loadSchemasIntoCache(String loc) throws Exception {
- InputStream is = ResourceUtils.getResourceStream(loc, BusFactory.getDefaultBus());
+ InputStream is = ResourceUtils.getResourceStream(loc,
+ bus == null ? BusFactory.getDefaultBus() : bus);
if (is == null) {
return;
}
@@ -1504,7 +1575,22 @@ public class WadlGenerator implements Re
}
public QName resolve(Class<?> type, Annotation[] annotations, Map<Class<?>, QName> clsMap) {
- return getJaxbQName(proxy, type, clsMap);
+ QName qname = WadlGenerator.this.getJaxbQName(proxy, type, clsMap);
+ if (qname == null && supportJaxbXmlType) {
+ XmlType root = type.getAnnotation(XmlType.class);
+ if (root != null) {
+ XMLName name = AnnotationUtils.getAnnotation(annotations, XMLName.class);
+ if (name == null) {
+ qname = getJaxbQName(root.name(), root.namespace(), type, clsMap);
+ } else {
+ QName tempQName = JAXRSUtils.convertStringToQName(name.value());
+ qname = new QName(tempQName.getNamespaceURI(),
+ tempQName.getLocalPart(),
+ getPrefix(tempQName.getNamespaceURI(), clsMap));
+ }
+ }
+ }
+ return qname;
}
}
@@ -1600,6 +1686,10 @@ public class WadlGenerator implements Re
this.defaultMediaType = JAXRSUtils.toMediaType(mt);
}
+ public void setSupportJaxbXmlType(boolean supportJaxbXmlType) {
+ this.supportJaxbXmlType = supportJaxbXmlType;
+ }
+
private static class SchemaConverter extends DelegatingXMLStreamWriter {
private static final String SCHEMA_LOCATION = "schemaLocation";
private Map<String, String> locsMap;
Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java?rev=1533109&r1=1533108&r2=1533109&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java Thu Oct 17 15:15:20 2013
@@ -100,6 +100,7 @@ public abstract class AbstractJAXBProvid
protected Map<String, String> jaxbElementClassMap = Collections.emptyMap();
protected boolean unmarshalAsJaxbElement;
protected boolean marshalAsJaxbElement;
+ protected boolean xmlTypeAsJaxbElementOnly;
protected Map<String, String> outElementsMap;
protected Map<String, String> outAppendMap;
@@ -217,6 +218,10 @@ public abstract class AbstractJAXBProvid
marshalAsJaxbElement = value;
}
+ public void setXmlTypeAsJaxbElementOnly(boolean value) {
+ this.xmlTypeAsJaxbElementOnly = value;
+ }
+
public void setJaxbElementClassNames(List<String> names) {
jaxbElementClassNames = names;
}
@@ -239,10 +244,14 @@ public abstract class AbstractJAXBProvid
return null;
}
- protected static boolean isXmlRoot(Class<?> cls) {
+ protected boolean isXmlRoot(Class<?> cls) {
return cls.getAnnotation(XmlRootElement.class) != null;
}
+ protected boolean isXmlType(Class<?> cls) {
+ return cls.getAnnotation(XmlType.class) != null;
+ }
+
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Object convertToJaxbElementIfNeeded(Object obj, Class<?> cls, Type genericType)
throws Exception {
@@ -298,7 +307,8 @@ public abstract class AbstractJAXBProvid
}
}
- return marshalAsJaxbElement || isSupported(type, genericType, anns);
+ return marshalAsJaxbElement && (!xmlTypeAsJaxbElementOnly || isXmlType(type))
+ || isSupported(type, genericType, anns);
}
public void writeTo(T t, Type genericType, Annotation annotations[],
MediaType mediaType,
@@ -351,7 +361,7 @@ public abstract class AbstractJAXBProvid
XmlRootElement root = cls.getAnnotation(XmlRootElement.class);
if (root != null) {
return getQNameFromNamespaceAndName(root.namespace(), root.name(), cls, pluralName);
- } else if (cls.getAnnotation(XmlType.class) != null) {
+ } else if (isXmlType(cls)) {
XmlType xmlType = cls.getAnnotation(XmlType.class);
return getQNameFromNamespaceAndName(xmlType.namespace(), xmlType.name(), cls, pluralName);
} else {
Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java?rev=1533109&r1=1533108&r2=1533109&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java Thu Oct 17 15:15:20 2013
@@ -1675,4 +1675,13 @@ public final class ProviderFactory {
return handler;
}
}
+
+ public MessageBodyWriter<?> getRegisteredJaxbWriter() {
+ for (ProviderInfo<MessageBodyWriter<?>> pi : this.messageWriters) {
+ if (pi.getProvider().getClass().getName().equals(JAXB_PROVIDER_NAME)) {
+ return pi.getProvider();
+ }
+ }
+ return null;
+ }
}
Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java?rev=1533109&r1=1533108&r2=1533109&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java Thu Oct 17 15:15:20 2013
@@ -57,10 +57,12 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -525,9 +527,15 @@ public final class ResourceUtils {
public static ResourceTypes getAllRequestResponseTypes(List<ClassResourceInfo> cris,
boolean jaxbOnly) {
+ return getAllRequestResponseTypes(cris, jaxbOnly, null);
+ }
+
+ public static ResourceTypes getAllRequestResponseTypes(List<ClassResourceInfo> cris,
+ boolean jaxbOnly,
+ MessageBodyWriter<?> jaxbWriter) {
ResourceTypes types = new ResourceTypes();
for (ClassResourceInfo resource : cris) {
- getAllTypesForResource(resource, types, jaxbOnly);
+ getAllTypesForResource(resource, types, jaxbOnly, jaxbWriter);
}
return types;
}
@@ -545,7 +553,8 @@ public final class ResourceUtils {
private static void getAllTypesForResource(ClassResourceInfo resource,
ResourceTypes types,
- boolean jaxbOnly) {
+ boolean jaxbOnly,
+ MessageBodyWriter<?> jaxbWriter) {
for (OperationResourceInfo ori : resource.getMethodDispatcher().getOperationResourceInfos()) {
Method method = ori.getMethodToInvoke();
Class<?> realReturnType = method.getReturnType();
@@ -556,7 +565,7 @@ public final class ResourceUtils {
Type type = method.getGenericReturnType();
if (jaxbOnly) {
checkJaxbType(cls, realReturnType == Response.class ? cls : type, types,
- method.getAnnotations());
+ method.getAnnotations(), jaxbWriter);
} else {
types.getAllTypes().put(cls, type);
}
@@ -567,7 +576,7 @@ public final class ResourceUtils {
Type paramType = method.getGenericParameterTypes()[pm.getIndex()];
if (jaxbOnly) {
checkJaxbType(inType, paramType, types,
- method.getParameterAnnotations()[pm.getIndex()]);
+ method.getParameterAnnotations()[pm.getIndex()], jaxbWriter);
} else {
types.getAllTypes().put(inType, paramType);
}
@@ -579,7 +588,7 @@ public final class ResourceUtils {
for (ClassResourceInfo sub : resource.getSubResources()) {
if (!isRecursiveSubResource(resource, sub)) {
- getAllTypesForResource(sub, types, jaxbOnly);
+ getAllTypesForResource(sub, types, jaxbOnly, jaxbWriter);
}
}
}
@@ -597,26 +606,40 @@ public final class ResourceUtils {
private static void checkJaxbType(Class<?> type,
Type genericType,
ResourceTypes types,
- Annotation[] anns) {
+ Annotation[] anns,
+ MessageBodyWriter<?> jaxbWriter) {
+ boolean isCollection = false;
if (InjectionUtils.isSupportedCollectionOrArray(type)) {
type = InjectionUtils.getActualType(genericType);
- XMLName name = AnnotationUtils.getAnnotation(anns, XMLName.class);
- if (name != null) {
- types.getCollectionMap().put(type, JAXRSUtils.convertStringToQName(name.value()));
- }
+ isCollection = true;
+ }
+ if (type == null
+ || InjectionUtils.isPrimitive(type)
+ || JAXBElement.class.isAssignableFrom(type)
+ || Response.class.isAssignableFrom(type)
+ || type.isInterface()) {
+ return;
}
- JAXBElementProvider<?> provider = new JAXBElementProvider<Object>();
- if (type != null
- && !InjectionUtils.isPrimitive(type)
- && !JAXBElement.class.isAssignableFrom(type)
- && provider.isReadable(type, type, new Annotation[0], MediaType.APPLICATION_XML_TYPE)) {
+
+ MessageBodyWriter<?> writer = jaxbWriter;
+ if (writer == null) {
+ writer = new JAXBElementProvider<Object>();
+ }
+ if (writer.isWriteable(type, type, anns, MediaType.APPLICATION_XML_TYPE)) {
types.getAllTypes().put(type, type);
-
Class<?> genCls = InjectionUtils.getActualType(genericType);
if (genCls != type && genCls != null && genCls != Object.class
&& !InjectionUtils.isSupportedCollectionOrArray(genCls)) {
types.getAllTypes().put(genCls, genCls);
}
+
+ XMLName name = AnnotationUtils.getAnnotation(anns, XMLName.class);
+ QName qname = name != null ? JAXRSUtils.convertStringToQName(name.value()) : null;
+ if (isCollection) {
+ types.getCollectionMap().put(type, qname);
+ } else {
+ types.getXmlNameMap().put(type, qname);
+ }
}
}
Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java?rev=1533109&r1=1533108&r2=1533109&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java Thu Oct 17 15:15:20 2013
@@ -67,6 +67,16 @@ public class BookStore implements BookDe
public List<Book> getBooks(@PathParam("id") Long id) {
return Collections.emptyList();
}
+
+ @GET
+ @Path("thebooks2")
+ @Produces("application/xml")
+ @Descriptions({
+ @Description(value = "Get Books2", target = DocTarget.METHOD)
+ })
+ public List<Book2> getBooks2(@PathParam("id") Long id) {
+ return Collections.emptyList();
+ }
@GET
@Produces("text/plain")
Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java?rev=1533109&r1=1533108&r2=1533109&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java Thu Oct 17 15:15:20 2013
@@ -45,6 +45,7 @@ import org.apache.cxf.endpoint.EndpointI
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.jaxrs.JAXRSServiceImpl;
import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.provider.ProviderFactory;
import org.apache.cxf.jaxrs.utils.ResourceUtils;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.ExchangeImpl;
@@ -216,7 +217,7 @@ public class WadlGeneratorTest extends A
checkResponse(r);
Document doc = StaxUtils.read(new StringReader(r.getEntity().toString()));
checkDocs(doc.getDocumentElement(), "My Application", "", "");
- checkGrammars(doc.getDocumentElement(), "thebook", "books", "thebook2", "thechapter");
+ checkGrammars(doc.getDocumentElement(), "thebook", "books", "thebook2s", "thebook2", "thechapter");
List<Element> els = getWadlResourcesInfo(doc, "http://localhost:8080/baz", 1);
checkBookStoreInfo(els.get(0),
"ns1:thebook",
@@ -310,7 +311,7 @@ public class WadlGeneratorTest extends A
r.getMetadata().getFirst(HttpHeaders.CONTENT_TYPE));
String wadl = r.getEntity().toString();
Document doc = StaxUtils.read(new StringReader(wadl));
- checkGrammars(doc.getDocumentElement(), "thebook", "books", "thebook2", "thechapter");
+ checkGrammars(doc.getDocumentElement(), "thebook", "books", "thebook2s", "thebook2", "thechapter");
List<Element> els = getWadlResourcesInfo(doc, "http://localhost:8080/baz", 2);
checkBookStoreInfo(els.get(0), "prefix1:thebook", "prefix1:thebook2", "prefix1:thechapter");
Element orderResource = els.get(1);
@@ -321,27 +322,30 @@ public class WadlGeneratorTest extends A
String bookEl,
String book2El,
String chapterEl) {
- checkGrammars(appElement, bookEl, null, book2El, chapterEl);
+ checkGrammars(appElement, bookEl, null, null, book2El, chapterEl);
}
private void checkGrammars(Element appElement,
String bookEl,
String booksEl,
+ String booksEl2,
String book2El,
String chapterEl) {
List<Element> grammarEls = DOMUtils.getChildrenWithName(appElement, WadlGenerator.WADL_NS,
"grammars");
assertEquals(1, grammarEls.size());
List<Element> schemasEls = DOMUtils.getChildrenWithName(grammarEls.get(0),
- XmlSchemaConstants.XSD_NAMESPACE_URI, "schema");
+ XmlSchemaConstants.XSD_NAMESPACE_URI,
+ "schema");
assertEquals(1, schemasEls.size());
assertEquals("http://superbooks", schemasEls.get(0).getAttribute("targetNamespace"));
List<Element> elementEls = DOMUtils.getChildrenWithName(schemasEls.get(0),
- XmlSchemaConstants.XSD_NAMESPACE_URI, "element");
+ XmlSchemaConstants.XSD_NAMESPACE_URI,
+ "element");
int size = book2El == null ? 2 : 3;
int elementSize = size;
if (booksEl != null) {
- elementSize++;
+ elementSize += 2;
}
assertEquals(elementSize, elementEls.size());
@@ -354,9 +358,13 @@ public class WadlGeneratorTest extends A
if (booksEl != null) {
assertTrue(checkElement(elementEls, booksEl, "books"));
}
+ if (booksEl2 != null) {
+ assertTrue(checkElement(elementEls, booksEl2, "thebook2s"));
+ }
List<Element> complexTypesEls = DOMUtils.getChildrenWithName(schemasEls.get(0),
- XmlSchemaConstants.XSD_NAMESPACE_URI, "complexType");
+ XmlSchemaConstants.XSD_NAMESPACE_URI,
+ "complexType");
assertEquals(size, complexTypesEls.size());
assertTrue(checkComplexType(complexTypesEls, "book"));
@@ -402,7 +410,8 @@ public class WadlGeneratorTest extends A
if (type.equals(expectedType1) || type.equals(expectedType2)) {
return true;
}
- } else if ("books".equals(name)) {
+ } else if ("books".equals(name) || "thebook2s".equals(name)) {
+ boolean thebooks2 = "thebook2s".equals(name);
Element ctElement =
(Element)e.getElementsByTagNameNS(XmlSchemaConstants.XSD_NAMESPACE_URI,
"complexType").item(0);
@@ -413,8 +422,8 @@ public class WadlGeneratorTest extends A
(Element)seqElement.getElementsByTagNameNS(XmlSchemaConstants.XSD_NAMESPACE_URI,
"element").item(0);
String ref = xsElement.getAttribute("ref");
- String expectedRef = "tns:thebook";
- String expectedRef2 = "os:thebook";
+ String expectedRef = thebooks2 ? "tns:thebook2" : "tns:thebook";
+ String expectedRef2 = thebooks2 ? "os:thebook2" : "os:thebook";
if (ref.equals(expectedRef) || ref.equals(expectedRef2)) {
return true;
}
@@ -440,16 +449,17 @@ public class WadlGeneratorTest extends A
checkDocs(resource, "book store \"resource\"", "super resource", "en-us");
- List<Element> resourceEls = getElements(resource, "resource", 8);
+ List<Element> resourceEls = getElements(resource, "resource", 9);
assertEquals("/book2", resourceEls.get(0).getAttribute("path"));
assertEquals("/books/{bookid}", resourceEls.get(1).getAttribute("path"));
assertEquals("/chapter", resourceEls.get(2).getAttribute("path"));
assertEquals("/chapter2", resourceEls.get(3).getAttribute("path"));
- assertEquals("/books/\"{bookid}\"", resourceEls.get(4).getAttribute("path"));
- assertEquals("/booksubresource", resourceEls.get(5).getAttribute("path"));
- assertEquals("/form", resourceEls.get(6).getAttribute("path"));
- assertEquals("/itself", resourceEls.get(7).getAttribute("path"));
+ assertEquals("/thebooks2", resourceEls.get(4).getAttribute("path"));
+ assertEquals("/books/\"{bookid}\"", resourceEls.get(5).getAttribute("path"));
+ assertEquals("/booksubresource", resourceEls.get(6).getAttribute("path"));
+ assertEquals("/form", resourceEls.get(7).getAttribute("path"));
+ assertEquals("/itself", resourceEls.get(8).getAttribute("path"));
// verify root resource starting with "/"
// must have a single template parameter
@@ -530,12 +540,12 @@ public class WadlGeneratorTest extends A
// verify resource starting from /booksubresource
// should have 2 parameters
- verifyParameters(resourceEls.get(5), 2,
+ verifyParameters(resourceEls.get(6), 2,
new Param("id", "template", "xs:int"),
new Param("mid", "matrix", "xs:int"));
- checkDocs(resourceEls.get(5), "", "Book subresource", "");
+ checkDocs(resourceEls.get(6), "", "Book subresource", "");
// should have 4 child resources
- List<Element> subResourceEls = getElements(resourceEls.get(5), "resource", 6);
+ List<Element> subResourceEls = getElements(resourceEls.get(6), "resource", 6);
assertEquals("/book", subResourceEls.get(0).getAttribute("path"));
assertEquals("/form1", subResourceEls.get(1).getAttribute("path"));
@@ -771,6 +781,8 @@ public class WadlGeneratorTest extends A
Endpoint endpoint = new EndpointImpl(null, null, epr);
e.put(Endpoint.class, endpoint);
+ endpoint.put(ProviderFactory.class.getName(), ProviderFactory.getInstance());
+
e.setDestination(d);
BindingInfo bi = control.createMock(BindingInfo.class);
epr.setBinding(bi);
Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java?rev=1533109&r1=1533108&r2=1533109&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java (original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java Thu Oct 17 15:15:20 2013
@@ -118,6 +118,7 @@ public class JAXRSUtilsTest extends Asse
@Test
public void testFormParametersUTF8Encoding() throws Exception {
+ JAXRSUtils.intersectMimeTypes("application/json", "application/json+v2");
doTestFormParamsWithEncoding("UTF-8", true);
doTestFormParamsWithEncoding("UTF-8", false);
}
Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java?rev=1533109&r1=1533108&r2=1533109&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java (original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java Thu Oct 17 15:15:20 2013
@@ -19,6 +19,7 @@
package org.apache.cxf.systest.jaxrs;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
@@ -31,6 +32,8 @@ import java.net.URL;
import java.net.URLConnection;
import java.util.List;
+import javax.xml.stream.XMLStreamReader;
+
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -60,7 +63,7 @@ public class JAXRSClientServerResourceCr
@Test
public void testBasePetStoreWithoutTrailingSlash() throws Exception {
- String endpointAddress = "http://localhost:" + PORT + "/webapp/resources";
+ String endpointAddress = "http://localhost:" + PORT + "/webapp/pets";
WebClient client = WebClient.create(endpointAddress);
HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
conduit.getClient().setReceiveTimeout(1000000);
@@ -72,7 +75,7 @@ public class JAXRSClientServerResourceCr
@Test
public void testBasePetStore() throws Exception {
- String endpointAddress = "http://localhost:" + PORT + "/webapp/resources/";
+ String endpointAddress = "http://localhost:" + PORT + "/webapp/pets/";
WebClient client = WebClient.create(endpointAddress);
HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
conduit.getClient().setReceiveTimeout(1000000);
@@ -84,12 +87,12 @@ public class JAXRSClientServerResourceCr
@Test
public void testMultipleRootsWadl() throws Exception {
List<Element> resourceEls = getWadlResourcesInfo("http://localhost:" + PORT + "/webapp/resources",
- "http://localhost:" + PORT + "/webapp/resources", 3);
+ "http://localhost:" + PORT + "/webapp/resources", 2);
String path1 = resourceEls.get(0).getAttribute("path");
int bookStoreInd = path1.contains("/bookstore") ? 0 : 1;
int petStoreInd = bookStoreInd == 0 ? 1 : 0;
checkBookStoreInfo(resourceEls.get(bookStoreInd));
- checkPetStoreInfo(resourceEls.get(petStoreInd));
+ checkServletInfo(resourceEls.get(petStoreInd));
}
@Test
@@ -101,9 +104,20 @@ public class JAXRSClientServerResourceCr
@Test
public void testPetStoreWadl() throws Exception {
- List<Element> resourceEls = getWadlResourcesInfo("http://localhost:" + PORT + "/webapp/resources",
- "http://localhost:" + PORT + "/webapp/resources/petstore", 1);
+ List<Element> resourceEls = getWadlResourcesInfo("http://localhost:" + PORT + "/webapp/pets",
+ "http://localhost:" + PORT + "/webapp/pets/", 1);
checkPetStoreInfo(resourceEls.get(0));
+ XMLStreamReader reader = StaxUtils.createXMLStreamReader(
+ (Element)resourceEls.get(0).getParentNode().getParentNode());
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ StaxUtils.copy(reader, bos);
+ String s = bos.toString();
+ assertTrue(s.contains("<xs:element name=\"elstatus\" type=\"petStoreStatusElement\"/>"));
+ assertTrue(s.contains("<xs:element name=\"status\" type=\"status\"/>"));
+ assertTrue(s.contains("<xs:element name=\"statuses\""));
+ assertTrue(s.contains("element=\"prefix1:status\""));
+ assertTrue(s.contains("element=\"prefix1:elstatus\""));
+ assertTrue(s.contains("element=\"prefix1:statuses\""));
}
@Test
@@ -127,6 +141,10 @@ public class JAXRSClientServerResourceCr
assertEquals("/bookstore", resource.getAttribute("path"));
}
+ private void checkServletInfo(Element resource) {
+ assertEquals("/servlet", resource.getAttribute("path"));
+ }
+
private void checkPetStoreInfo(Element resource) {
assertEquals("/", resource.getAttribute("path"));
}
@@ -222,7 +240,7 @@ public class JAXRSClientServerResourceCr
public void testPostPetStatus() throws Exception {
String endpointAddress =
- "http://localhost:" + PORT + "/webapp/resources/petstore/pets";
+ "http://localhost:" + PORT + "/webapp/pets/petstore/pets";
URL url = new URL(endpointAddress);
HttpURLConnection httpUrlConnection = (HttpURLConnection)url.openConnection();
Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java?rev=1533109&r1=1533108&r2=1533109&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java (original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/PetStore.java Thu Oct 17 15:15:20 2013
@@ -19,6 +19,9 @@
package org.apache.cxf.systest.jaxrs;
+import java.util.Collections;
+import java.util.List;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -28,6 +31,10 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.cxf.jaxrs.model.wadl.XMLName;
@Path("/")
public class PetStore {
@@ -52,6 +59,30 @@ public class PetStore {
return Response.ok(CLOSED).build();
}
+
+ @GET
+ @Path("/petstore/jaxb/status/")
+ @Produces("text/xml")
+ public PetStoreStatus getJaxbStatus() {
+
+ return new PetStoreStatus();
+ }
+
+ @GET
+ @Path("/petstore/jaxb/status/elements")
+ @Produces({"text/xml", "application/json" })
+ @XMLName("{http://pets}statuses")
+ public List<PetStoreStatusElement> getJaxbStatusElements() {
+ return Collections.singletonList(new PetStoreStatusElement());
+ }
+
+ @GET
+ @Path("/petstore/jaxb/status/element")
+ @Produces("text/xml")
+ public PetStoreStatusElement getJaxbStatusElement() {
+
+ return new PetStoreStatusElement();
+ }
@POST
@Path("/petstore/pets/")
@@ -60,4 +91,22 @@ public class PetStore {
public Response updateStatus(MultivaluedMap<String, String> params) throws Exception {
return Response.ok(params.getFirst("status")).build();
}
+
+ @XmlType(name = "status", namespace = "http://pets")
+ public static class PetStoreStatus {
+ private String status = PetStore.CLOSED;
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ }
+
+ @XmlRootElement(name = "elstatus", namespace = "http://pets")
+ public static class PetStoreStatusElement extends PetStoreStatus {
+ }
}
Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt?rev=1533109&r1=1533108&r2=1533109&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt (original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt Thu Oct 17 15:15:20 2013
@@ -1,4 +1,4 @@
-POST /webapp/resources/petstore/pets HTTP/1.1
+POST /webapp/pets/petstore/pets HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: en-ie
Content-Type: application/x-www-form-urlencoded
Modified: cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml?rev=1533109&r1=1533108&r2=1533109&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml (original)
+++ cxf/branches/2.7.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml Thu Oct 17 15:15:20 2013
@@ -30,7 +30,6 @@ http://cxf.apache.org/schemas/jaxrs.xsd"
<jaxrs:server id="bookservice"
address="/resources">
<jaxrs:serviceBeans>
- <ref bean="petstore"/>
<ref bean="bookstore"/>
<ref bean="servletconfigstore"/>
</jaxrs:serviceBeans>
@@ -41,6 +40,22 @@ http://cxf.apache.org/schemas/jaxrs.xsd"
<ref bean="plainTextProvider"/>
</jaxrs:providers>
</jaxrs:server>
+
+ <jaxrs:server id="petservice" address="/pets">
+ <jaxrs:serviceBeans>
+ <ref bean="petstore"/>
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <bean class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
+ <property name="marshallAsJaxbElement" value="true"/>
+ <property name="xmlTypeAsJaxbElementOnly" value="true"/>
+ </bean>
+ <bean class="org.apache.cxf.jaxrs.model.wadl.WadlGenerator">
+ <property name="linkJsonToXmlSchema" value="true"/>
+ </bean>
+ </jaxrs:providers>
+ </jaxrs:server>
+
<bean id="bookstore" class="org.apache.cxf.systest.jaxrs.BookStore"/>
<bean id="petstore" class="org.apache.cxf.systest.jaxrs.PetStore"/>
<bean id="servletconfigstore" class="org.apache.cxf.systest.jaxrs.SpringServletConfigStore"/>