jersey

Jersey HK2 Dependency Injection doesn't work after update to v2.27

故事扮演 提交于 2019-12-08 08:22:26
I have a project using Jersey v2.25.1. I was using Jersey's inbuilt HK2 injection to perform dependency injection, and everything worked fine. Fast forward to now, I decided to update to Jersey v2.27. When I ran my project, I got the following exception: java.lang.IllegalStateException: InjectionManagerFactory not found After some googling, I found that I needed to add the jersey-hk2 dependency. Doing so made me get the following exception: org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at SystemInjecteeImpl(requiredType=<MyClass>,parent=

How to create generic json response Object in java?

拈花ヽ惹草 提交于 2019-12-08 08:16:53
问题 I am new to java and creating some Restful services in netbeans using jersey framework. I have created many GET, POST web services which is having different different type of responses which are basically Model Objects and depending upon media type I am getting JSON or XML. Some response is having only a single object which is being shown in JSON inside {}, and some are list which are in []. I want to see a generic response format for all api responses. Example- {"status":"0 or 1", "message":

Configuring Jersey + Jetty + JSP

点点圈 提交于 2019-12-08 08:16:46
问题 How do I configure this project so that it will be able to render JSP files? I would want to have URLS starting with /rest to route to jersey resources and have /* URLS serve JSP files. I don't have any web.xml in this project. Project folder ├───src │ └───main │ └───java/Main.java │ └───resources/HelloResource.java └───WEB-INF └───jsp/NewFile.jsp HelloResource.java package resources; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; @Path("/hello") public class

Weblogic 12.2.1.3 from Moxy to Jackson

落爺英雄遲暮 提交于 2019-12-08 08:16:39
问题 I would like to change the JSON parser from Moxy to Jackson, and I have followed the shared library approach, but without any result, Moxy is still used. Note: the shared library is not necessary!!! The shared library I have created a maven project with the following dependencies and descriptors. pom.xml <properties> <jackson.annotations.release>2.8.6</jackson.annotations.release> <jersey.version>2.22.4</jersey.version> </properties> <dependencies> <dependency> <groupId>com.fasterxml.jackson

NoSuchMethodError javax.ws.rs.core.Application.getProperties()Ljava/util/Map

喜你入骨 提交于 2019-12-08 07:50:30
问题 I am trying my first REST application. Below is my configuration: Java 7 JBoss AS 7.1 Jersey 2.22.2 Below are list of jars downloaded by Maven: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.prasad</groupId> <artifactId>messenger</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT<

REST @FormParam is null

孤人 提交于 2019-12-08 07:47:02
问题 I have the following being passed from browser to server Status Code:204 No Content Request Method:POST Content-Type:application/x-www-form-urlencoded Form Data json:{"clientName":"PACK","status":"success","message":"successful!"} and in jsp code var loginData = { clientName: cList, status: "success", message: "successful!" }; $.ajax({ url: subUrl, type: 'POST', contentType : "application/x-www-form-urlencoded", data: { json: JSON.stringify(loginData) }, success: function (data) {

@Autowired not working on jersey resource

江枫思渺然 提交于 2019-12-08 07:06:56
问题 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

jersey rest services showing exception javax.ws.rs.WebApplicationException: javax.xml.bind.MarshalException

徘徊边缘 提交于 2019-12-08 06:56:56
问题 I am working on jersey services which i mentioned here it is working fine when i am returning a java object. Later i tried to make the java object generic its giving exception javax.ws.rs.WebApplicationException: javax.xml.bind.MarshalException @XmlRootElement public class AppObject<T> implements Serializable { private List<T> list; private String license; public AppObject() { list = new ArrayList<T>(); } public AppObject(List<T> list) { this.list = list; } @XmlAnyElement(lax = true) public

Ajax Post Header

放肆的年华 提交于 2019-12-08 06:19:30
问题 I have the Ajax Call for the Post method and it consumes XML and Produces PDF. How do i set my header in AJAX? Any inputs on the exception would be a great help.I did browse, but did not found much on this. Ext.Ajax.request({ url : "/rest/sample/" + sampleId + "/sam", params : params, form : downloadForm, isUpload : true, method : 'POST', headers: {'Content-Type': 'text/xml'}, scope : this, xmlData: XMLSampleData }); XMLSampleData has the Xml data. Rest : @Path("/sam") @Produces("application

How to return Array in Jersey REST webservice?

不羁岁月 提交于 2019-12-08 05:57:12
问题 I am new to REST webservice, I tried using Jersey implementation and wrote a simple webservice code to return List to calling client: @GET @Produces(MediaType.TEXT_XML) public GenericEntity<List<String>> stringlist() { List<String> list = Arrays.asList("test", "as"); return new GenericEntity<List<String>>(list) { }; } I am not sure how to get the value of the list in my client. I just tried using the below code in my client but I am getting error. service.path("rest") .path("getVal") .accept