jax-rs

is it possible to call one jax-rs method from another?

白昼怎懂夜的黑 提交于 2019-12-22 01:55:11
问题 suppose i have some jax-rs resource class: @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public class ResourceA { @GET public Something get(@Context UriInfo uriInfo) { if (...) { //how to get to ResourceB ? } } } and i want to conditionally redirect the call to some other jax-rs resource: public class ResourceB { @GET @Path("{identifier}") public Other get(@PathParam("identifier")String someArg) { } } how do i do this? note that i dont want this to be visible to

SNI configuration in cxf client(3.1.2)

我们两清 提交于 2019-12-21 22:03:27
问题 I want to set custom SNI hostname(SNI configuration) while making rest call using CXF client(3.1.2). I'm using java 8.I'm able to do the same thing using HTTPClient(see below strong textcode snipped for reference), but I'm not able to figure out how to do the same using CXF client. // For HTTP client private SSLConnectionSocketFactory createSSLConnectionSocketFactory(String sniHostanme, SSLContext sslContext){ // Fix for host name verifier, need to implement----------------------

RESTful Webservice does not handle Request Method properly

牧云@^-^@ 提交于 2019-12-21 21:42:19
问题 I am retreiving values from multiple RESTful Web Service methods. In this case two methods interfere with one another, due to a problem with the Request Method. @GET @Path("/person/{name}") @Produces("application/xml") public Person getPerson(@PathParam("name") String name) { System.out.println("@GET /person/" + name); return people.byName(name); } @POST @Path("/person") @Consumes("application/xml") public void createPerson(Person person) { System.out.println("@POST /person"); System.out

What scope do JAX-RS 2 filters have?

♀尐吖头ヾ 提交于 2019-12-21 21:32:44
问题 I am using RestEasy 3.0.2 which is one of the first JAX-RS 2 implementations and run my application within a Tomcat 7. I also make use of injection in my application via WELD which is integrated with RestEasy via its CDI adaptor. Everything works fine so far. Now, I wrote an implementation of a ContainerRequestFilter to perform authentication of incoming requests before they hit a resource. The JAX-RS standard says that injection is possible for every resource and every other JAX-RS component

Can Resteasy look into parameter's type for JAX-RS methods?

只愿长相守 提交于 2019-12-21 20:24:21
问题 We were using Resteasy 3.0.9 for our JAX-RS webservices, and recently switched to 3.0.19, where we started to see a lot of RESTEASY002142: Multiple resource methods match request warnings. For example, we have methods like: @Path("/{id}") public String getSome(UUID id) @Path("/{id}") public String getSome(int id) I'm not sure how it worked in 3.0.9, probably, we just were very lucky as Resteasy seems to select first method from all candidates (and 3.0.19 sorts candidate methods). One solution

Upgrading jax-rs shared library on weblogic

試著忘記壹切 提交于 2019-12-21 19:54:15
问题 Normally weblogic 12c doesnt support jax-rs 2.0 but by the help of jax-rs shared library which comes with weblogic itself it is possible to upgrade jax-rs version from 1.1 to 2.0. The problem is library implementation is jersey 2.5 which doesnt satisfy my needs. I found a link about upgrading jersey version on weblogic which looks a lil bit complex. Is it enough to replace jersey jars 2.5 with my jersey version 2.13? Do i need to do anything else? 回答1: I have created a simple maven project to

Ajax request with JAX-RS/RESTEasy implementing CORS

烂漫一生 提交于 2019-12-21 17:47:59
问题 I have two servers (Apache and JBoss AS7) and I need to provide access to all http methods to a client. All these request must be sent via ajax. Example of the client code: $.ajax({ type: "get", url: "http://localhost:9080/myproject/services/mobile/list", crossDomain: true, cache: false, dataType: "json", success: function(response) { console.log(response); }, error: function (jqXHR, textStatus, errorThrown) { console.log(textStatus); console.log(jqXHR.responseText); console.log(errorThrown);

Automatic Jax-RS registration in Weblogic 12.2.1 when adding eclipselink artifact

别等时光非礼了梦想. 提交于 2019-12-21 17:33:20
问题 I have observed a very strange behavior in the latest Weblogic server, version 12.2.1.2. When an eclipselink dependency is added to your Java servlet application, Weblogic server is going to automatically trigger Jax-RS Jersey REST service under /resources/* path. To remove any doubts, I have created a very simple helloworld war file. A sample war file can be created by following the instruction from this page (http://geekabyte.blogspot.com/2015/07/how-to-create-war-files-with-intellij.html)

JAX-RS: How can I return my list of objects as JSON?

不想你离开。 提交于 2019-12-21 17:27:23
问题 I looked at the documentation of Jackson, and it left me confused :( My entity looks like : @Entity @Table(name = "variable") public class Variable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; @Column(unique = true, nullable = false) private String name; @Column @Enumerated(EnumType.STRING) private VariableType type; @Column(nullable = false) private String units; @Temporal(TemporalType.TIMESTAMP) @Column(name = "created_on", nullable = false) private Date

Getting Response in ContainerResponseFilter's (JAX-RS 2)

别等时光非礼了梦想. 提交于 2019-12-21 14:59:57
问题 I am trying to port this CORS filter to JAX-RS 2. However, I do not see how to get the Response object (as in the old code) from the ContainerResponseContext I get passed in the overridden method of ContainerResponseFilter. If there is a more elegant way to do CORS with JAX-RS 2, that would be preferrable of course. Thanks in advance. 回答1: Thre response is directly accessible as the ContainerResponseContext : @Provider public class ResponseCorsFilter implements ContainerResponseFilter{