Questions tagged [moxy]

MOXy is the object-to-XML and object-to-JSON component of EclipseLink. It is a JAXB (JSR-222) implementation with extensions for supporting: XPath based mapping, JPA entities, and infoset preservation.

MOXy is the object-to-XML and object-to-JSON component of EclipseLink. It is a JAXB (JSR-222) implementation with extensions for supporting: XPath based mapping, JPA entities, and infoset preservation.

868 questions
4
votes
1 answer

How to handle java.util.Date with MOXy bindings file

i'm new to MOXy and JaxB in general and I'm facing a problem with java.util.Date conversion. I'm unmarshaling an XML file (which I have no control of) to objects using a mapping file (I can neither manually annotate existing classes nor change…
Drewman
  • 947
  • 11
  • 23
4
votes
1 answer

Moxy Xpath :: "Lifting" attributes

I have an XML representing a hierarchical DOM where each element is an with zero or more children each. Each has a ton of attributes and I don't want to litter the Element class with all those attributes, given it has a bunch…
AweSIM
  • 1,651
  • 4
  • 18
  • 37
4
votes
1 answer

Instead of @JsonbIgnore, is it possible to require explicit inclusion of an object's fields on jax-rs (jersey+moxy) JSON serialization?

I have a JPA entity implementing an interface and I want to expose via jax-rs endpoint only the fields that are defined by that interface. Something that looks like: public interface ConnectedAppExternal { String getId(); String…
NotGaeL
  • 8,344
  • 5
  • 40
  • 70
4
votes
2 answers

Parsing xml file with JAXB

I'm implementing a simple xml parser and faced with a problem: exception is thrown when initialising JAXBContext. Here is my code(maybe too much for this question, but I've tried to include only important parts): Parser itself: package…
Andrei Yusupau
  • 587
  • 1
  • 11
  • 30
4
votes
1 answer

Staying DRY with JAXB

I'm developing a number of Java classes that must serialize to XML in the following format: In the beginning, Foo.java looked something like…
Matt Ball
  • 354,903
  • 100
  • 647
  • 710
4
votes
1 answer

How does MOXy's xml-transient declaration work?

I have a set of a beans in a separate project that I'm unable to alter. These beans have both JPA and JAXB annotations, and are being used in a RESTful implementation. Most of my relationships are lazy-loaded, and I was hoping to achieve some more…
Fil
  • 2,016
  • 18
  • 29
4
votes
1 answer

JAXB 2.x: Abstract methods get marshalled as Attribute

I have an abstract root class, let's say A. And I have several implementation classes extending A. A has FIELD annotation as well as some @XmlElement annotated properties. A also has an abstract method. When marshalling (B extends A), the value…
basZero
  • 4,129
  • 9
  • 51
  • 89
4
votes
2 answers

Spring Boot + JAXB MOXY

I'm trying to use MOXY with Spring Boot. To that end I included the following in my Gradle build file: org.eclipse.persistence:org.eclipse.persistence.moxy:2.7.1 And added a jaxb.properties file…
Ari
  • 4,121
  • 8
  • 40
  • 56
4
votes
1 answer

Jersey (MOXy) truncating JSON dates

I am using Jersey 1.21.1 and am getting strange behavior when unmarshalling dates. Simplified version of my POJO: @XmlRootElement public class Invoice { private Date invoiceDate; private Date invoiceDate2; } My resource…
Bampfer
  • 2,120
  • 16
  • 25
4
votes
0 answers

Using Spring-WS getWebServiceTemplate().marshalSendAndReceive How do I specify Jaxb2Marshaller to use Eclipse Moxy Jaxb Implementation

I need to marshall an object using eclipse moxy with spring-ws. I'm running a spring-boot project with spring-ws. I have included the moxy jar and all of the jaxb.properties files in all of the model directories. How do I make Spring-WS use the moxy…
4
votes
1 answer

How to return a JSON object from a HashMap with Moxy and Jersey

I am using Jersey 2.17 with Moxy and I have functions like : @Produces(APPLICATION_JSON) @Restricted public List getFriends( @PathParam("user") String user ) { return userDAO.getFriends(user); } User.preferences is a HashMap. It…
arisalexis
  • 2,079
  • 2
  • 21
  • 42
4
votes
1 answer

eclipselink + @convert(json) + postgres + list property

I'm using eclipselink 2.6 as a persistence provider of spring data jpa, that in my understanding, now allows you to serialize a subtree of an entity as json using the internal moxy serializer. So I'm trying to mix this to migrate from embedded…
fer.marino
  • 497
  • 1
  • 5
  • 20
4
votes
1 answer

Moxy can't marshal List into JSON

I have a Tomcat server running a servlet using the Jersey 2.6 framework. Within the servlet, I am using Jackson for JSON <--> POJO marshalling. I've recently learned of Moxy and am trying to switch to it, as it seems to be preferred by…
4
votes
1 answer

Marshaling / Demarshaling JSON with Java EE 7 / Glassfish 4.1 results in null object

I upgraded to Java EE 7 from Java EE 6 and some of my REST services stopped working. Narrowing it down, it appears this change seems to have come about when Jersey switched from Jackson to MOXy in Java EE 7. My service looks…
andand
  • 17,134
  • 11
  • 53
  • 79
4
votes
1 answer

Moxy ignore invalid fields in json

When I send this request: {"invalidField": "value", "date": "value"} to my rest service: @PUT @Consumes("application/json") public void putJson(Test content) { System.out.println(content.toString()); } I expected to get an exception…