jersey

Deploying a Jersey webapp on Jboss AS 7

杀马特。学长 韩版系。学妹 提交于 2019-12-17 09:19:23
问题 Currently running some webapps on Jboss AS 4/5 and I am testing migration to jboss7. When I try to deploy a jersey based webapp on JBoss AS 7 (full profile with standalone-preview config file), I get: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Only one JAX-RS Application Class allowed. I've done a bit of hunting around on it and found that RestEasy is the default JAX-RS implementation embedded into Application Server. Posts like http://community.jboss.org/message/579996

Jackson is not deserialising a generic list that it has serialised

≡放荡痞女 提交于 2019-12-17 07:26:24
问题 When using Apache Jersey with Jackson for JSON serialisation (on both server and client), I'm hitting a problem when deserialising a generic List. The JSON I am producing is as follows, all 3 classes in "data" implement "CheckStatusDetail": { "errorCode" : 0, "errorMessage" : null, "type" : "array", "data" : [ { "@class" : "com.rrr.base.status.module.dto.DiscoveryAgentCheckStatusDetail", "serverInfo" : { "@class" : "com.rrr.base.util.discovery.config.xml.XMLServerInfo", "name" : "java",

Jersey: Print the actual request

对着背影说爱祢 提交于 2019-12-17 06:28:24
问题 How can I view the actual request that Jersey generates and sends to the server? I am having issues with a particular request and the fellow running the webserver asked to see the full request (with headers and the such). 回答1: If you're just using Jersey Client API, LoggingFilter (client filter) should help you: Client client = Client.create(); client.addFilter(new LoggingFilter(System.out)); WebResource webResource = client.resource("http://localhost:9998/"); ClientResponse response =

MessageBodyProviderNotFoundException while running jar from command line

廉价感情. 提交于 2019-12-17 05:13:12
问题 I am using the Java Jersey framework(with Maven), and use IntelliJ as my IDE. I have encountered this runtime exception that ONLY happens when I try to run the code from the command line (using maven to compile and then java -jar ) but NOT when running within IntelliJ, which is strange. I have some Java code that will try to make an HTTP GET on some remote URL and try to read the returned JSON into some Lombok POJO : String targetUrl = "some valid URL"; WebTarget webTarget = client.target

MessageBodyProviderNotFoundException while running jar from command line

▼魔方 西西 提交于 2019-12-17 05:13:05
问题 I am using the Java Jersey framework(with Maven), and use IntelliJ as my IDE. I have encountered this runtime exception that ONLY happens when I try to run the code from the command line (using maven to compile and then java -jar ) but NOT when running within IntelliJ, which is strange. I have some Java code that will try to make an HTTP GET on some remote URL and try to read the returned JSON into some Lombok POJO : String targetUrl = "some valid URL"; WebTarget webTarget = client.target

Java RestFull WebService: JAX-RS implementation with Jersey 2.3.1 libraries

ε祈祈猫儿з 提交于 2019-12-17 05:03:09
问题 I am trying to run a simple "Hallo World" application Jersey 2.3.1 REST service on JBoss jboss-eap-6.1 AS. In web.xml i have disabled restEasy library. During deployment i am getting the error: JBWEB000289: Servlet com.sun.jersey.samples.helloworld.resources.MyApplication threw load() exception: java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map; In POM i put these dependencies: <dependency> <groupId>org.glassfish.jersey.core</groupId> <artifactId>jersey

How can I customize serialization of a list of JAXB objects to JSON?

无人久伴 提交于 2019-12-17 04:19:05
问题 I'm using Jersey to create a REST web service for a server component. The JAXB-annotated object I want to serialize in a list looks like this: @XmlRootElement(name = "distribution") @XmlType(name = "tDistribution", propOrder = { "id", "name" }) public class XMLDistribution { private String id; private String name; // no-args constructor, getters, setters, etc } I have a REST resource to retrieve one distribution which looks like this: @Path("/distribution/{id: [1-9][0-9]*}") public class

How can I customize serialization of a list of JAXB objects to JSON?

别说谁变了你拦得住时间么 提交于 2019-12-17 04:19:03
问题 I'm using Jersey to create a REST web service for a server component. The JAXB-annotated object I want to serialize in a list looks like this: @XmlRootElement(name = "distribution") @XmlType(name = "tDistribution", propOrder = { "id", "name" }) public class XMLDistribution { private String id; private String name; // no-args constructor, getters, setters, etc } I have a REST resource to retrieve one distribution which looks like this: @Path("/distribution/{id: [1-9][0-9]*}") public class

Input and Output binary streams using JERSEY?

只愿长相守 提交于 2019-12-17 02:02:51
问题 I'm using Jersey to implement a RESTful API that is primarily retrieve and serve JSON encoded data. But I have some situations where I need to accomplish the following: Export downloadable documents, such as PDF, XLS, ZIP, or other binary files. Retrieve multipart data, such some JSON plus an uploaded XLS file I have a single-page JQuery-based web client that creates AJAX calls to this web service. At the moment, it doesn't do form submits, and uses GET and POST (with a JSON object). Should I

Combining Spring project and Jersey

风格不统一 提交于 2019-12-16 22:51:11
问题 I've built a project with Spring JPA, and now I want to use it in my Jersey project. I've added my SJPA project as a dependency in my pom.xml I would like to use my service classes from my SJPA when I use GET/POST/PUT/DELETE methods. Is there an easy way to do this with annotations? Or do I have to get AnnotationConfigApplicationContext in each class? Feels kind of waste. @Path("/users") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public final class