jersey-2.0

Url encoding issue with Jersey Client

℡╲_俬逩灬. 提交于 2019-12-23 14:59:13
问题 I need to make a service call such as this: http://myservice.com/path?var1=value1&var2=value2 The issue I have is value1 and value2 ends up getting encoded, and this makes the service call fail. For example, value1 is something like "a=b&b=c;2&&="... it contains special characters, basically. I am guessing that this is an issue for the service to fix - to properly handle decoding encoded characters, which I do not think it is currently doing. Here is a sample of how I am making these requests

Jersey 2: filters and @Context injections

风流意气都作罢 提交于 2019-12-23 12:18:35
问题 I've the following question: ContainerRequestFilter is a singleton, but reading this: Jaxrs-2_0 Oracle Spec in chapter 9.2, they say: Context is specific to a particular request but instances of certain JAX-RS components (providers and resource classes with a lifecycle other than per-request) may need to support multiple concurrent requests. When injecting an instance of one of the types listed in Section 9.2, the instance supplied MUST be capable of selecting the correct context for a

HK2 MethodInterceptor with Jersey resource

半城伤御伤魂 提交于 2019-12-23 10:34:17
问题 How can I set up an aop MethodInterceptor to work with Jersey resources? Here is what I've tried, following this documentation: Step 1 - InterceptionService public class MyInterceptionService implements InterceptionService { private final Provider<AuthFilter> authFilterProvider; @Inject public HK2MethodInterceptionService(Provider<AuthFilter> authFilterProvider) { this.authFilterProvider = authFilterProvider; } /** * Match any class. */ @Override public Filter getDescriptorFilter() { return

HK2 MethodInterceptor with Jersey resource

回眸只為那壹抹淺笑 提交于 2019-12-23 10:34:03
问题 How can I set up an aop MethodInterceptor to work with Jersey resources? Here is what I've tried, following this documentation: Step 1 - InterceptionService public class MyInterceptionService implements InterceptionService { private final Provider<AuthFilter> authFilterProvider; @Inject public HK2MethodInterceptionService(Provider<AuthFilter> authFilterProvider) { this.authFilterProvider = authFilterProvider; } /** * Match any class. */ @Override public Filter getDescriptorFilter() { return

JAX-RS resource error: Couldn't find JAX-B element for class java.lang.String and some more exceptions

℡╲_俬逩灬. 提交于 2019-12-23 09:35:06
问题 When I do an OPTIONS call on the rest resource 'queue' from the Java EE 7 SDK example 'async-chat', I get many exceptions, when the log level for jersey is set to FINE (org.glassfish.jersey.level=FINE). The same exceptions happen in my code, given below. Both applications run correctly. Are these exceptions irrelevant (just thrown when the logging level is on FINE)? If not, why are they thrown? I tested several GlassFish 4 installations and also GlassFish 4.0.1. They all show the same

AsyncResponse ConnectionCallback does not fire in Jersey

只谈情不闲聊 提交于 2019-12-23 07:10:08
问题 For asynchronous programming, Jersey (JAX-RS) provides a ConnectionCallback callback that is to be executed when a connection is broken. From the Jersey docs: As some async requests may take long time to process the client may decide to terminate its connection to the server before the response has been resumed or before it has been fully written to the client. To deal with these use cases a ConnectionCallback can be used. This callback will be executed only if the connection was prematurely

Guice + Jersey integration injects null objects

蓝咒 提交于 2019-12-23 05:01:26
问题 Following the excellent step-by-step given in Up and running on AppEngine with Maven, Jersey and Guice - Part 3, I have been able to get everything working except injecting objects into a Jersey POJO. The only difference I have from that configuration is that I also have Objectify integrated, but that is working. The TestClass instance (a singleton) injected into HelloWorldServlet works, but the TestClass and SecondTest ( RequestScoped ) objects injected into the HeyResource POJO are always

Jersey, Jackson and JAX-RS POST multiple JSON formats

风流意气都作罢 提交于 2019-12-23 04:45:53
问题 I am trying to be able to define the following code: public class MyObject { private String name; ... // Other attributes } @Path(...) @Stateless public class MyRestResource { @POST @Consumes(MediaType.APPLICATION_JSON) public Response create(List<MyObject> myObjects) { // Do some stuff there } } I know that I need to use: DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true to setup correctly my object mapper to be able to accept single value as array on my rest resources. I

NoSuchMethodError on Values.lazy (Jersey 2.5.1)

雨燕双飞 提交于 2019-12-23 03:02:07
问题 I am officially perplexed by this blocker. I had upgraded Jersey from 2.4.1 to 2.5.1 because Jersey/Oracle fixed a package scanning bug that was affecting getting Swagger working. 2.4.1 was working relatively "okay" after lots of hacks to integrate with our Spring-based server (spring-jersey3 was not working at all.) Now since upgrading to 2.5.1 (and now, 2.6-SNAPSHOT), I receive the error below each time I make a request to anything matching the API URL pattern. What I have done: Redeployed

Jersey2, Hk2 dependency injection (automatically) gives AbstractMethodError: org.jvnet.hk2.internal.DynamicConfigurationImpl.addIdempotentFilter

天大地大妈咪最大 提交于 2019-12-23 02:56:12
问题 Stuck on this problem for a while. I'm trying to integrate Tomcat 9, JDK 10, Jersey 2.23, HK2 (for DI) along with Automatic dependency injection. I've followed this tutorial, but getting below error, I've searched a lot but couldn't find anything on that. I've used dependency to generate "META-INF/hk2-locator/default" which is getting generate properly. Dependency <dependency> <groupId>org.glassfish.hk2</groupId> <artifactId>hk2-metadata-generator</artifactId> <version>2.4.0</version> <