resteasy

RestEasyClient JAX RS possible resource leak if not done correctly

放肆的年华 提交于 2019-12-11 14:57:11
问题 Issue: I had a rest client that was supposed to send request to a URL. The java application was a standalone java Application ( started with java -jar ) and then on exit all application context were closed. but the application would end but not shutdown and the PID remained for the java process. On each request I was doing an async call and getting the response in an InvocationCallback implementation. client = new ResteasyClientBuilder().connectTimeout(timeout, TimeUnit.SECONDS).readTimeout

Use JSON.stringify and JSON.parse in resteasy

放肆的年华 提交于 2019-12-11 14:48:43
问题 I need to use JSON.stringify and JSON.parse in a java class that contains resteasy services to exchange information with a Jquery script. Which library should import the java class or what should I do ?, because in the script itself let me do it by default. Thank you very much. 回答1: So from my understanding you want to be able to serialize and deserialize JSON to and from Java object, as that's what JSON.stringify and JSON.parse does for Javascript. To be able to handle that, we need a

Unable to test Jax-rs with JSON entity

夙愿已清 提交于 2019-12-11 11:32:30
问题 I am trying to test a Jax-rs resource by following this https://jersey.java.net/documentation/latest/test-framework.html, and I am using container jersey-test-framework-provider-jdk-http I can assert status code. However, when I try to readEntity, I get exception: javax.ws.rs.ProcessingException: Unable to find a MessageBodyReader of content-type application/json and type class java.lang.String at org.jboss.resteasy.core.interception.ClientReaderInterceptorContext.throwReaderNotFound

JSON response: Spring with JAXB

我是研究僧i 提交于 2019-12-11 10:18:39
问题 Tech Stack: Java 1.6, JAXB, Spring 3, JAX-RS (RESTEasy), XSD Hello, I am using Spring with JAX-RS to create RestFul Webservice. Everything is working fine except that the generated responses contain the setters info e.g. { ... "setName": true, "setId": true, "setAddress": true, "setAge": true, } I don't know what might be causing this? How can I turn this off? Adi UPDATE 1: The PersonRequest class is generated by the JAXB and contains all the javax.xml.bind.annotation.* annotations.

Resteasy not working with @ApplicationPath

大城市里の小女人 提交于 2019-12-11 09:16:09
问题 I am not being able to get JAX-RS working with Resteasy 2.3.5 usingh simple @ApplicationPath annotation. Here is the code I am using: @ApplicationPath("/rest") public class MyApplication extends Application { @Override public Set<Class<?>> getClasses() { final Set<Class<?>> s = new HashSet<Class<?>>(); s.add(ViewController.class); return s; } } @Path("/") public class ViewController { @GET @Path("/test") public String test() { return "Yes!"; } } Requesting on "/uri-context/rest/test/" throws

error in simple RESTtful web service implementation

[亡魂溺海] 提交于 2019-12-11 08:08:46
问题 Softwares used : Java Version : "1.7.0_21" Eclipse Version : Kepler Application Server : wildfly-8.1.0.Final(with RESTeasy bundle) My try : I want to implement REST web service. My resources is university. package com.nagarro.university; import javax.ws.rs.ApplicationPath; import javax.ws.rs.GET; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Application; import javax.ws.rs.core.MediaType; @ApplicationPath("

Swagger UI with Tynamo Resteasy for Tapestry 5.4

早过忘川 提交于 2019-12-11 05:47:25
问题 I am using tynamo resteasy with my Tapestry 5.4 project. I'd like to incorporate Swagger to document and share API with other other teams. While I see that swagger is already in RestEasy's project dependency, it does not work "out of the box" I've added @Api to the "Resource" class (located in /rest/ package) and @ApiOperation to the GET method Do I need to change AppModule or web.xml in anyway to hook the swagger UI? Is there an example (github etc.) anywhere that I can follow? Also, will

org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token

让人想犯罪 __ 提交于 2019-12-11 05:16:41
问题 I have developed a Spring MVC+ RestEasy+Hibernate example and looking to test it using Junit, but see the below error: Also I can call those web services through jsp or rest client. org.jboss.resteasy.spi.ReaderException: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token at [Source: org.jboss.resteasy.client.core.SelfExpandingBufferredInputStream@23c30a20; line: 1, column: 1] at org.jboss.resteasy.client.core

@Consumes doesn't work with JSON

风流意气都作罢 提交于 2019-12-11 04:07:49
问题 I have a following rest service: @Path("/add") @POST @Consumes(MediaType.APPLICATION_JSON) public Response add(SomeEntity entity) { entity = someService.addEntity(entity); return Response.ok("Entity added with id=" + entity.getId()).build(); } After deploying my app to Wildfly I send HTTP request with json: {"id":0,"param1":value1,"param2":value2} and get following error message: Bad arguments passed to org.jboss.resteasy.spi.metadata.ResourceMethod@4ab32ab7 ( java.util.LinkedHashMap {id=0,

Logging in CXF and RestEasy clients

限于喜欢 提交于 2019-12-11 03:17:11
问题 this week I was trying Jersey, CXF and RestEasy clients (using JSON) as a standalone application(testing purposes), and I notice something. In Jersey I can enable logs with one line of code: Client client = Client.create(); client.addFilter(new LoggingFilter(System.out)); WebResource webResource = client.resource("http://localhost:8080/IT1/MB1"); .... String output = response.getEntity(String.class); .... Using the LoggingFilter, I get interesting information about the request and/or response