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
36
votes
6 answers

Jersey 2.0 equivalent to POJOMappingFeature

I have some experience using Jersey < 2.0. Now I am trying to build a war application to provide a JSON Webservice API. I am now struggling for a considerable amount of time trying to configure Moxy and it seams to be way more complicated than what…
Frederick Roth
  • 2,748
  • 4
  • 28
  • 42
28
votes
1 answer

Serializing nulls and empty Strings in dynamic JSON

I have this JSON-Content: {"color":null} And I want to make these Java-Objects out of it (and vice-versa): Container |- List entries |- Entry |- String key = "color" |- String value = null My current solution always…
slartidan
  • 20,403
  • 15
  • 83
  • 131
25
votes
2 answers

Where to include jaxb.properties file?

I have REST (Jersey) webservice that makes use of some data objects that are marshalled/unmarshalled to/from XML. The data objects are in a separate project/jar that the webservice war depends on. I'm using MOXy as my JAXB implementation since I'm…
sdoca
  • 7,832
  • 23
  • 70
  • 127
19
votes
4 answers

Exception in thread "main" javax.xml.bind.PropertyException: name: eclipselink.media-type value: application/json

I'm attempting to follow the example located here but get an javax.xml.bind.PropertyException. I receive this exception because of the following line of code: marshaller.setProperty(MarshallerProperties.MEDIA_TYPE, "application/json"); I have…
user3167333
  • 247
  • 3
  • 4
  • 8
15
votes
5 answers

Jersey 2.0 Content-Length not set

I'm trying to post to a web service that requires the Content-Length header to be set using the following code: // EDIT: added apache connector code ClientConfig clientConfig = new ClientConfig(); ApacheConnector apache = new…
Todd
  • 261
  • 1
  • 2
  • 7
14
votes
3 answers

MOXy exceptions in JavaEE Jersey 2.0 project

Im trying to implement Json support in a JavaEE project but had issues with MOXy related exceptions being generated. I read on jersey.java.net that MOXy should be autodiscoverable but it doesnt seem to work when i try. So to make this easy to…
Base
  • 1,061
  • 1
  • 11
  • 27
14
votes
2 answers

Represent null value as empty element in xml jaxb

I need to display null value as empty element in jaxb. I am using moxy implementation of jaxb. I found this option @XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE) Is there any…
Anand B
  • 2,997
  • 11
  • 34
  • 55
12
votes
2 answers

Force Glassfish4 to use Jackson instead of Moxy

Glassfish4 is using Moxy to serialize REST responses into JSON. Does anybody know how to configure application to use Jackson instead of Moxy?
lstachowiak
  • 344
  • 1
  • 2
  • 7
12
votes
1 answer

Use Moxy as default JAXB Implementation

In order to use Moxy as JAXB Implementation, one has to add a file called jaxb.properties in the folder with the domain classes of the application and include the following…
Edmondo
  • 19,559
  • 13
  • 62
  • 115
11
votes
3 answers

JAXB: Marshal output XML with indentation create empty line break on the first line

When I marshal an XML with this attribute marshal.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); marshal.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); it will generate an empty line break at the very top //Generate empty line…
Thang Pham
  • 38,125
  • 75
  • 201
  • 285
11
votes
2 answers

How to know what JAXB implementation is used?

I am using MOXy as JAXB Implementation but somehow I would like to show the Implementation Name (e.g. Moxy) and the version number on some admin screen (dynamically). How can I retrieve that info from JAXB? Cheers
basZero
  • 4,129
  • 9
  • 51
  • 89
11
votes
5 answers

Remove "type" from JSON output jersey moxy

How to remove the type from the JSON output that I have. I have a class/bean that contains output of a REST service.I'm using jersey-media-moxy to do the conversion. The service @Resource public interface MyBeanResource { @GET …
Rob Audenaerde
  • 19,195
  • 10
  • 76
  • 121
11
votes
2 answers

Jersey 2.0 and Moxy Internal Server Error But No Server Log

I followed the Jersey 2.0 document (https://jersey.java.net/documentation/latest/user-guide.html#json.moxy), modified pom.xml, included jersey-media-moxy artifact, compiled and installed. I could get basic POJO to JSON mapping work for both Produces…
David Bao
  • 136
  • 1
  • 6
11
votes
1 answer

EclipseLink MOXy JSON Serialization

I have got a sample class: class Zoo { public Collection animals; } When serialized with MOXy, I am getting: { "bird": [ { "name": "bird-1", "wingSpan": "6 feets", …
Behzad Pirvali
  • 764
  • 3
  • 10
  • 28
9
votes
1 answer

Can I replace jaxb.properties with code?

I am using some non-standard extensions from EclipseLink's implementation of JAXB, and to enable that implementation, I have to configure it using jaxb.properties. Works well. However, due to a build error, the properties file was not included in…
Thilo
  • 257,207
  • 101
  • 511
  • 656
1
2 3
57 58