moxy

How to replace EclipseLink 2.3.2 with EclipseLink 2.5 in WebLogic Server 12c

梦想与她 提交于 2019-12-04 06:03:42
I currrently try to run Docx4j in WebLogic Server 12c. WebLogic Server 12c comes with EclipseLink 2.3.2. There is a similar Post describing the situation which unfortunately yield no answer. Docx4j does not work with the JAXB (MOXy) implementation which is part of EclipseLink 2.3.2. I got Docx4j running standalone with EclipseLink 2.5. So I am very confident that using EclipseLink 2.5 with Weblogic Server 12c will solve the issue with Docx4j. How can I replace the EclipseLink Vesion 2.3.2 the WebLogic Server 12c is running on with EclipseLink Version 2.5? You can created a shared library in

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

匆匆过客 提交于 2019-12-03 22:38:27
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 literally copy/pasted the example listed above so my code is exactly what you see there. Searching SO and Google for this has not been helpful, and thought I'd bring this to the geniuses at SO for some help. Any help would be most appreciated, (de)serialization with JSON and XML with json.org, Jackson, and JAXB has turned into a black and bottomless pit

How to know what JAXB implementation is used?

限于喜欢 提交于 2019-12-03 11:55:52
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 You could do something like the following to figure out the JAXB impl being used: import javax.xml.bind.JAXBContext; public class Demo { private static final String MOXY_JAXB_CONTEXT = "org.eclipse.persistence.jaxb.JAXBContext"; private static final String METRO_JAXB_CONTEXT = "com.sun.xml.bind.v2.runtime.JAXBContextImpl"; public static void main(String[] args) throws Exception {

Jersey 2.0 Content-Length not set

依然范特西╮ 提交于 2019-12-03 05:39:15
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 ApacheConnector(clientConfig); // setup client to log requests and responses and their entities client.register(new LoggingFilter(Logger.getLogger("com.example.app"), true)); Part part = new Part("123"); WebTarget target = client.target("https://api.thing.com/v1.0/thing/{thingId}"); Response jsonResponse = target.resolveTemplate("thingId", "abcdefg") .request(MediaType

Can I get MOXy to rename an element when generating json?

别说谁变了你拦得住时间么 提交于 2019-12-02 14:29:27
问题 From a common JAXB model the xml generated can be of the form <ipi-list><ipi>1001</ipi><ipi>1002</ipi></ipi-list> because in json we have arrays we dont need both elements, so by using MOXy's oxml extensions I can flatten the output to give "ipi" : [ "1001", "1002" ], but because ipi now refers to an array of things I would like it to be called ipis not ipi "ipis" : [ "1001", "1002" ], Is there a way to get MOXy to rename an element ? 回答1: You could use EclipseLink JAXB (MOXy)'s external

Mapping xml to jpa entities using JAXB

£可爱£侵袭症+ 提交于 2019-12-02 13:08:52
问题 Isn't it possible to map xml to jpa entities using JAXB? Will Eclipselink Moxy be helpful? 回答1: Note: I'm the EclipseLink JAXB (MOXy) lead and a member of the JAXB 2 (JSR-222) expert group. Yes you can map JPA entities to XML, and the following are some ways that EclipseLink JAXB (MOXy) makes this easier. 1. Bidirectional Mappings Customer import javax.persistence.*; @Entity public class Customer { @Id private long id; @OneToOne(mappedBy="customer", cascade={CascadeType.ALL}) private Address

Can I get MOXy to not output an attribute when generating json?

岁酱吖の 提交于 2019-12-02 11:37:33
问题 An instance of my JAXB Object model contains an attribute that I want output when I generate Xml for the instance but not when I generate json i.e I want <release-group type="Album"> <title>Fred</title> </release-group> and "release-group" : { "title" : "fred", }, but have "release-group" : { "type" : "Album", "title" : "fred" }, Can I do this using the oxml.xml mapping file 回答1: Since your JSON binding is slightly different from your XML binding I would use EclipseLink JAXB (MOXy)'s external

Unmarshalling LocalDate/LocalDateTime with MOXy

扶醉桌前 提交于 2019-12-02 08:01:37
How can I get MOXy to unmarshal JSON into LocalDate and LocalDateTime ? I've got an @GET method which produces a sample instance with three fields of types LocalDate , LocalDateTime and Date , respectively. Hitting that endpoint, I get: { "localDate": "2017-07-11", "localDateTime": "2017-07-11T10:11:10.817", "date": "2017-07-11T10:11:10.817+02:00" } I then POST the above data to my @POST method, which simply returns the data again: { "date": "2017-07-11T10:11:10.817+02:00" } As you can see, both localDate and localDateTime are lost in the process, because MOXy does not initialize those two

MessageBodyWriter not found for media type=application/json

两盒软妹~` 提交于 2019-12-02 06:26:00
问题 I'm making a small RESTful service using Jetty. Using Maven as the build tool. When I try to call a GET method that tries to access a JSON representation of an object, I get an "MessageBodyWriter" error. The method in question is as follows, @Path("/gtfs-rt-feed") public class GtfsRtFeed { @GET @Produces(MediaType.APPLICATION_JSON) public Response getGtfsRtFeed(){ GtfsRtFeedModel feedInfo = new GtfsRtFeedModel(); feedInfo.setStartTime(121334); feedInfo.setGtfsId(1); feedInfo.setGtfsUrl("http:

Can I get MOXy to rename an element when generating json?

北城余情 提交于 2019-12-02 03:56:57
From a common JAXB model the xml generated can be of the form <ipi-list><ipi>1001</ipi><ipi>1002</ipi></ipi-list> because in json we have arrays we dont need both elements, so by using MOXy's oxml extensions I can flatten the output to give "ipi" : [ "1001", "1002" ], but because ipi now refers to an array of things I would like it to be called ipis not ipi "ipis" : [ "1001", "1002" ], Is there a way to get MOXy to rename an element ? You could use EclipseLink JAXB (MOXy) 's external mapping document to tweak the mapping for either the XML or JSON representation. IPIList Below is a domain