jersey-2.0

Spring 2.0.x Jersey 2 Request scoped bean

不羁岁月 提交于 2019-12-24 15:22:39
问题 I m working with a legacy spring 2.0.6 project integrated with jersey 2.x. The application context contains some beans like: <!-- - Application context definition --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema

Using SelectableEntityFiltering in Jersey 2.17

為{幸葍}努か 提交于 2019-12-24 15:07:23
问题 I am new in Jersey and i try to use the SelectableEntityFilteringFeature from the example: http://blog.dejavu.sk/2015/02/04/jerseys-entity-filtering-meets-jackson/#selectable I create a small service with the following classes/files: a resource file called PersonResource.java import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import org.glassfish.jersey.jackson.JacksonFeature; import org.glassfish.jersey.message.filtering.SelectableEntityFilteringFeature; import org

Custom Jersey parameter unmarshalling

扶醉桌前 提交于 2019-12-24 13:52:28
问题 I receive as a query parameter a String line like parameter=123,456,789 What I want to obtain is List<Integer> directly in my controller. Something like this: @GET @Path(REST_PATH) @Produces(MediaType.APPLICATION_JSON) public Response getSomeStuff(@MagicalThing("parameter") List<Integer> requiredList) What can be done except for custom provider and an additional type: https://stackoverflow.com/a/6124014? Update: custom annotation solves the puzzle http://avianey.blogspot.de/2011/12/exception

Getting swagger-core 1.5 to work with Jersey and Grizzly

十年热恋 提交于 2019-12-24 11:51:46
问题 I have a Jersey2 application that runs on an embedded Grizzly server - a setup identical to this example: https://github.com/jersey/jersey/tree/2.18/examples/https-clientserver-grizzly/src/main/java/org/glassfish/jersey/examples/httpsclientservergrizzly I have integrated it with swagger-jersey2-jaxrs_2.10 and it has been working OK. Now that swagger-core 1.5 came out and it produces Swagger 2.0 definitions, I would like to upgrade to that version. Having followed the Swagger setup

Jersey - JerseyTest: Error reading entity from input stream

纵饮孤独 提交于 2019-12-24 03:51:49
问题 I have created a test project in order to learn Jersey. I have created the following classes Book.java (Model), BookDao.java , BookResource.java and so far everything works just fine. My problem is with a JerseyTest i am trying to run ( BookResourceTest.java ). I am using Jackson for JSON serialization. When i run the test i get this error: Error reading entity from input stream . This is the console output: ------------------------------------------------------- T E S T S -------------------

how to customize Date in jackson serialization , @JsonSerialize not working

喜夏-厌秋 提交于 2019-12-24 03:38:12
问题 i want to change the date format in a json that is delivered by a java rest webservice, that is because the json have the dates like this: 2019-05-23T06:00:00Z[UTC] , so the client confuse the [UTC] with an array, because of the '[' and ']' im using glassfish 5 ,jax-rs , jackson 2.9.4 databind, . i have tried to use @JsonSerialize(using = CustomXSerializer.class) in the model object and didn work, also @JsonFormat(shape= JsonFormat.Shape.STRING, pattern="MM-dd-yyyy",timezone="CET") in the

Spring Jersey - java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map

只谈情不闲聊 提交于 2019-12-24 00:59:06
问题 UPDATE: So I just want to point out that before I submitted this question, I attempted the solution that I've seen on similar stackoverflow questions such as this one. It was still giving me runtime errors, so I decided to write this question. mvn dependency:tree is what I was looking for so thanks @dunni. With mvn dependency:tree , I was able to find the actual name of the jersey dependency that was breaking my application and updated the exclusion by changing it from: <exclusions>

Jersey not able to map json request to class

痞子三分冷 提交于 2019-12-23 23:51:50
问题 I m able to run Jersey with Json output and able to get "GET" requests with JSon mapping without any problems. I was also having some JSON methods which were "POST" methods and they are mapping to Java classes like in this method - @POST @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.TEXT_PLAIN}) @Path("/post") public String postPerson(Person pers) For your reference I m following the guide here or here On giving a valid post request on these, they all started to throw the below

Exception while using jersey-declarative-linking

佐手、 提交于 2019-12-23 21:50:20
问题 I am trying to use Jersey descriptive linking. My Jersey JARs are from jaxrs-ri-2.11.zip bundle. I use jersey-declarative-linking-2.11.jar that was downloaded separately from the bundle. Here what's happening: My application: ... import org.glassfish.jersey.linking.DeclarativeLinkingFeature; ... @PostConstruct private void setup() { ... register(DeclarativeLinkingFeature.class); } ... At this moment the following exception is logged in th eTomcat stdout.log (sorry for a long trace): SEVERE:

org.glassfish.jersey.server.ContainerException: java.io.IOException: Stream closed

社会主义新天地 提交于 2019-12-23 17:43:52
问题 I have register two ContainerRequestFilter filters and one ContainerResponseFilter in my application class that extends a JAX-RS Application: filters as : register(LoggingResponseFilter.class); register(AuthorizationRequestFilter.class); register(LikeRequestFilter.class); and when I tries to call a targeted method resource I have an Exception. Resource method as : @Override @POST @Path("/{userId}/like") @TokenResource @GMTResource // to validate GMT of client and server @Like // for like