jersey

@Autowired not working on jersey resource

痞子三分冷 提交于 2019-12-06 15:21:04
workflowService is null. The bean configuration is correct because manual injection works fine in other portions of the application. Here's my resource: @Path("/workflowProcess") @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) public class WorkflowProcessResource { @Autowired WorkflowService workflowService; @Autowired WorkflowProcessService workflowProcessService; @GET @Path ("/getWorkflowProcesses/{uuid}") public Collection<WorkflowProcessEntity> getWorkflows (@PathParam("uuid") String uuid) { WorkflowEntity workflowEntity = workflowService.findByUUID(uuid);

jersey 2 multipart pojo is always null

﹥>﹥吖頭↗ 提交于 2019-12-06 15:11:09
I'm trying to write a rest service to upload a file along with some other file information, using Jersey + Jackson. Using multipart, the file is uploaded correctly, and simple fields are OK as well, but the POJO that's supposed to contain additional data, is always null. Simplified example POJO: public class Test { public String name; public Test() {} public String getName() { return name; } public void setName(String name) { this.name = name; } } Application: @ApplicationPath("myapp") public class JerseyApp extends ResourceConfig { public JerseyApp() { register(MultiPartFeature.class);

No AuthenticationProvider found using spring security

落爺英雄遲暮 提交于 2019-12-06 14:21:28
问题 I have been trying to authenticate a user via LDAP using their x509 certificate and cannot seem to get it working. I have an authentication provider declared, but I am still getting an error thrown saying there is no provider. Here is my debugged output: INFO: Initiating Jersey application, version 'Jersey: 1.12 02/15/2012 04:51 PM' DEBUG: o.s.security.web.FilterChainProxy - /x509 at position 1 of 8 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter' DEBUG: o.s.s.w.c

Issue with importing com.sun.jersey.api.client.ClientResponse;

回眸只為那壹抹淺笑 提交于 2019-12-06 13:56:48
I have a basic java project wherein I have imported the jersey-client-1.19.jar externally in my java build (using eclipse). I am trying to write a basic jersey client to make a RESTful call to a web service. As soon as I try to import the ClientResponse class, eclipse complains about - the type javax.ws.rs.ext.runtimedelegate$headerdelegate cannot be resolved. It is indirectly referenced from required .class files. Eclipse auto correct takes me to my build paths. But I have had no luck fixing this. Googled for this but did not find anything. I am missing something basic here. Any help is

Jersey response's reason phrase is inconsistent in tomcat 7 and 8.5

允我心安 提交于 2019-12-06 13:50:24
问题 I'm using Tomcat 8.5 in one server and Tomcat 7 in different server and I have the following jersey resource: @Path("main") public class MyResource { @POST @Path("path") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public PojoResponse sendMailTemplate(PojoRequest paramsMap) throws Exception { return service.execute(paramsMap); } Which is register to MyApplication ( extends ResourceConfig ) with @ApplicationPath("root") When submitting request using JMeter

Jersey 2 singleton dependency injection creates multiple instances

£可爱£侵袭症+ 提交于 2019-12-06 13:44:20
Here I have a singleton, that I whant to inject to my application @Singleton @Path("singleton-bean") public class MyContext { private MyContext() { instances++; } private static MyContext instance; public static MyContext getInstance(){ if (instance == null) instance = new MyContext(); return instance; } public static int instances = 0; } Here's how I register it: @ApplicationPath("webresources") public class ApplicationConfig extends Application { @Override public Set<Object> getSingletons() { final Set<Object> singletons = new HashSet<>(); singletons.add(MyContext.getInstance()); return

Using @Produces for different methods [closed]

萝らか妹 提交于 2019-12-06 13:43:24
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I am learning Jersey webservices and came across the usage of @Produces , so to understand it I have written a small program like this: @Path("users/{username: [a-zA-Z][a-zA-Z_0-9]*}") public class UserResource { @GET @Produces("text/plain") public String getUser(@PathParam("username") String userName) { return "Hello " + userName; } @GET @Produces({"application/xml", "application/json"}) public String

How to tell Swagger an attribute is a Map

帅比萌擦擦* 提交于 2019-12-06 13:32:25
问题 I am developing a restful service with Jersey. However, I am using Swagger for documentation. My Model has a property with Type of Map. Swagger shows that this attribute as an Object (not a specific type). So how can I tell Swagger that this property is from type Map ? public class Model { private String name; private Map<Integer, String> myMap; public Model(){ super(); } public String getName() { return name; } public void setName(String name) { this.name = name; } public Map<Integer, String

failed Jersey REST Service: java.lang.IncompatibleClassChangeError: Implementing class

五迷三道 提交于 2019-12-06 13:25:01
I was hopeful that Jersey would deploy easily to Google App Engine, as it is supposedly supported ( http://code.google.com/p/googleappengine/wiki/WillItPlayInJava ) and several people mention they made it work ( http://tugdualgrall.blogspot.ca/2010/02/create-and-deploy-jax-rs-rest-service.html ) But it does not work... I created a new project with the gae plugin for eclipse (using gae sdk 1.7.3) I added to my web.xml : <servlet> <servlet-name>Jersey REST Service</servlet-name> <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> <init-param> <param-name>com.sun

Initialize singleton in Java Jersey 2 JAX-RS

风流意气都作罢 提交于 2019-12-06 12:43:31
I'm new to Jersey (2.22.2), so bear with me please. I am creating a REST service that interfaces with an LDAP server for storing, removing, and retrieving user data. The service acts as a security intermediary by performing encryption/decryption. There is quite a bit of initialization that must take place before the REST services can be utilized, and I would like to only perform this initialization once (when the application is deployed on the server). So this service would be run as a singleton. Would appreciate if someone could give me some pointers on the best way to go about doing this?