jersey

Combining Starter POMs in Spring Boot

走远了吗. 提交于 2020-01-05 14:28:30
问题 Are the Spring Boot Starters meant to be combined? For example, I want to use Jersey and JPA in my Spring Boot application. Everything works OK if I start out with just spring-boot-starter-jersey but when I add spring-boot-starter-data-jpa to the POM the build fails with missing dependencies: 2015-01-12 15:34:48.731 WARN 9396 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory

Jersey - validate REST service parameters

一个人想着一个人 提交于 2020-01-05 14:04:56
问题 is there any tool to simply validate query params using Jersey (and Maven)? I'm trying to do something like this using @NotNull annotation (jersey-bean-validation): @GET @Path("/count") @Produces(MediaType.APPLICATION_XML) public Response count(@NotNull @QueryParam("my_param") String my_param) { //TODO automatically return 400 Bad Request if my_param is null return Response.ok("This is a response", MediaType.APPLICATION_XML).build(); } I'd like the method to automatically validate query

Jersey - validate REST service parameters

扶醉桌前 提交于 2020-01-05 14:04:39
问题 is there any tool to simply validate query params using Jersey (and Maven)? I'm trying to do something like this using @NotNull annotation (jersey-bean-validation): @GET @Path("/count") @Produces(MediaType.APPLICATION_XML) public Response count(@NotNull @QueryParam("my_param") String my_param) { //TODO automatically return 400 Bad Request if my_param is null return Response.ok("This is a response", MediaType.APPLICATION_XML).build(); } I'd like the method to automatically validate query

How to add a Jersey REST webservice into embedded tomcat?

被刻印的时光 ゝ 提交于 2020-01-05 10:19:09
问题 Basically I want to run some Rest classes in Tomcat 8 embedded. I am unsure how to add them to the tomcat embedded instance I am creating. So this is what I do. Here is just that Jersey class: import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import static javax.ws.rs.core.MediaType.*; @Path("register") public class RegisterRestAPI { private MerchantRegistrationService merchantRegistrationService; public RegisterRestAPI

Creating Parent Property in JSON

 ̄綄美尐妖づ 提交于 2020-01-05 09:36:07
问题 I have requirement to create a parent and child property of JSON from same object which means it should be like {"employee": { "name":"skanda", "id":"123", "employee":[ {"id":"345"} ] } } Here is my Java Object. Please let me know how can I do this. Should I create Inner classes and have instance of one more Employee object. Please advise. I have to design in such a way that the same should also be De-serialized on other end when passed through Rest WS. If I can use annotations please advise

JSP 2.2 EL it keyword in Jersey Viewable - where is it documented?

爱⌒轻易说出口 提交于 2020-01-05 08:17:15
问题 I've found out that if I have a Viewable (jersey) passing a model to a JSP, then the way to access it is by prefixing the map key with it e.g. index.jsp <html> <body> <h2>Hello World ${it.foo}!</h2> </body> </html> The JAX-RS resource method: @GET @Path("index") public Viewable index(@Context HttpServletRequest request) { System.out.println("/INDEX called"); HashMap<String, String> model = new HashMap<String, String>(); model.put("foo","bar"); return new Viewable("/index.jsp", model); } I was

error when deploying jersey/helloworld-osgi-webapp on glassfish 3.1.2.2

偶尔善良 提交于 2020-01-05 07:49:09
问题 When trying to deploy the sample jersey war bundle code (helloworld-osgi-webapp on git: https://github.com/jersey/jersey-1.x/tree/master/jersey/samples/helloworld-osgi-webapp) on Glassfish 3.1.2.2, I am getting the following osgi error: remote failure: Error occurred during deployment: Exception while loading the app: org.osgi.framework.BundleException: Unresolved constraint in bundle war-bundle [344]: Unable to resolve 344.0: missing requirement [344.0] osgi.wiring.package; (&(osgi.wiring

Jersey Http Client replying with 411 on POST request

蓝咒 提交于 2020-01-05 04:07:32
问题 I'm using Jersey HTTP Client for sending POST request and receiving 411 Content Length missing in response. However this error is not thrown in all the cases. There are some calls where I'm using json content type and it is working fine. For this particular request where I'm sending the request to a specific URL I'm receiving 411 Content Length required. While with the same payload when I'm using a different URL it is working fine. This is how I'm setting Form Entity in Jersey Client Request

JAX-RS Rest services stopped deploying on Eclipse Glassfish

女生的网名这么多〃 提交于 2020-01-04 14:02:21
问题 I've been developing a Jersey JAX-RS application on Glassfish 4.1.1 using Eclipse for about a year now. Earlier today, I was making some normal changes to some of the classes, but Eclipse was not updating the classes when I would try and do a build. I searched here on Stack Overflow, and found this answer. So I did the following steps: Project > Clean on the project you're working on. Project > Build Automatically - turned on so the code rebuilds in your workspace on saved changes. Window >

when I am running test cases that time entity manager is injected successfully but while running web app its throwing NullPointerException

纵然是瞬间 提交于 2020-01-04 06:29:02
问题 I have a strange problem. I am injecting the entity manager using PersistenceContext using applicatioContext bean. But problem is that when I am running test cases that time entity manager is injected successfully but while running web app its throwing NullPointerException this is abstractRepository where I am injecting entityManager package com.ajit.retail.repository; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence