moxy

Reusable complexType, and xml-registry, xml-element-decl usage

你说的曾经没有我的故事 提交于 2019-12-11 06:58:35
问题 I've the below TimePeriodType <xs:simpleType name="UnitOfTimePeriodType"> <xs:restriction base="xs:token"> <xs:enumeration value="Months"/> <xs:enumeration value="Days"/> <xs:enumeration value="Years"/> </xs:restriction> </xs:simpleType> <xs:complexType name="TimePeriodType"> <xs:sequence> <xs:element name="Length" type="digit1-3"/> </xs:sequence> <xs:attribute name="unitOfLength" type="UnitOfTimePeriodType" use="optional" default="Months"/> </xs:complexType> which gets used in multiple types

Equivalent to Jackson's ACCEPT_SINGLE_VALUE_AS_ARRAY in MOXy?

空扰寡人 提交于 2019-12-11 06:24:27
问题 I'm using Jersey 2.10.4 and EclipseLink 2.5.2 (both bundled with GlassFish 4.1). I use MOXy for JSON (un)marshalling. I'd like to have a REST web service that consumes either a single resource or an array of multiple resources of the same type. It is not possible to use two different JAX-RS methods with signatures like this (I replaced my actual resource/URL with a generic customer example - this class uses JAXB annotations) due to the ambiguity of the URL/media type combination ( A resource

How do I get Json generated by MOXy to understand when model are numbers

允我心安 提交于 2019-12-11 06:23:03
问题 To solve another problem I have moved from using Jersey to EclipseLink MOXy to generate JSON from a JAXB created object model ( created by Sun JAXB 2.1.12). One difference I've noticed is that in the object model numeric attribute are defined as @XmlSchemaType(name = "nonNegativeInteger") protected BigInteger count; Jersey converts to "count":1, but MOXy gives "count" : "1", How can I get MOXy to realize its a numeric field and not quote it. 回答1: UPDATE A fix has been checked into the

Use of Multiple Inheritance in EclipseLink MOXy

陌路散爱 提交于 2019-12-11 03:34:27
问题 I'm trying to use spring ( @Autowire annotation into Jaxb Model class) ..... @XmlAttribute(name = "object-id") @XmlSchemaType(name = "positiveInteger") protected BigInteger objectId; @XmlTransient @Autowired MediationCacheManager cacheManager; Where MediationCacheManager is extended from three interfaces On creation of JaxbContext i catch an exception: Exception [EclipseLink-50089] (Eclipse Persistence Services - 2.5.0.v20121116-8650760): org.eclipse.persistence.exceptions.JAXBException

Weblogic 12.2.1.2 - How to tune the object Serializer to use Jackson 2 and strange phenomena on jaxrs enablement for application/json endpoints

大憨熊 提交于 2019-12-11 03:23:09
问题 On Weblogic JEE 7 (version 12.2.1.2), I am finding it quite strange to understand the behavior of the application server in relation to the enablement and configuration of the JAX-RS web services. The first point that I am trying to understand is a phenomena that I find quite inexplicable. On a sample application where I was testing a trivial jax-rs web service where initially there were only to components: Component (A) @ApplicationPath("rest") public class RestApplication extends

JAXB-Eclipselink: Mapping abstract “getter” to XML

╄→尐↘猪︶ㄣ 提交于 2019-12-11 02:58:48
问题 I am using the EclipseLink implementation (2.3) of JAXB to map POJOs to XML and encountering a problem with following usecase: public abstract class A { public abstract Set<X> getX(); // There is no setter } public class B extends A { // Set via constructor private Set<X> x; @Override public Set<X> getX(); } I am defining the mapping itself completely in an external bindings-file, i set class A to be transient like so: <java-type name="foo.A" xml-transient="true"/> and for class B: <java-type

@XmlPath(“.”) conflicts with @XmlAdapter

亡梦爱人 提交于 2019-12-11 02:57:31
问题 having this Jaxb Xml definition, i try to remove the Map Elements Wrapper by adding @XmlPath(".") but it cause exception during the unmarchaling @XmlRootElement public abstract class ViewElement{ @XmlJavaTypeAdapter(value=EventAdapter.class) public Map<Event, String> getEvents() { } private transient Class entityType; public Class getEntityType() { return entityType; } } And the EventAdapter is public class EventAdapter extends XmlAdapter<EventAdapter.AdaptedMap, Map<Event, String>> { public

Dynamic JAXB exceptions

你。 提交于 2019-12-11 02:11:51
问题 I am using eclipse link(v2.5.0) Dynamic JAXB to convert XML to JSON and viceversa using a multiple schemas. emp.xsd <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:emp="Employee:2:0" targetNamespace="Employee:2:0" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="2.0"> <xsd:element name="searchManager" type="emp:SearchManager" /> <xsd:complexType name="SearchManager"> <xsd:sequence> <xsd:element name="CompanyName

How do I get EclipseLink JAXB (MOXy) to not display namespaces in XML output

允我心安 提交于 2019-12-10 22:54:22
问题 I'm trying to move from the JAXB reference implementation to EclipseLink JAXB (MOXy) because it appears to solve JAXB outputting invalid XML when data contains non-displayable chars but I have a problem with it displaying namespace tags. This is how I create a JAXBContext return JAXBContext.newInstance("org.musicbrainz.mmd2"); and this is the output I get <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <metadata created="2013-02-27T12:12:13.305Z" xmlns="http://musicbrainz.org/ns/mmd-2

What is the moxy equivalent to Jackson's JsonAnySetter?

别说谁变了你拦得住时间么 提交于 2019-12-10 18:26:20
问题 I'm attempting to move to Jersey 2.0. Which is giving me pains with Jackson, and the docs recommend using Moxy. I got Moxy working for get and post calls where everything matches nicely however I have a need to deal with possible unknown elements. // Handle unknown deserialization parameters @JsonAnySetter protected void handleUnknown(String key, Object value) { if (unknownParameters == null) { unknownParameters = new HashMap<>(); } unknownParameters.put(key, value); } This worked well with