Salman Alaoui
Salman Alaoui

Reputation: 63

Spring JAX-RS client - get response status

I have injected a JAX-RS client via a spring context like this :

<jaxrs:client id="restClient"
       address="http://localhost:${testutil.ports.BookServerRestSoap}/test/services/rest"
       serviceClass="org.apache.cxf.systest.jaxrs.BookStoreJaxrsJaxws">
</jaxrs:client>

How can I access the response status in the case of a success response (200, 202, 204) ?

Upvotes: 1

Views: 368

Answers (2)

Sun
Sun

Reputation: 3564

I followed the same steps defined in this post https://java2blog.com/restful-web-services-jaxrs-crud-example/#comment-11493 . I did not change any file in my local yet. But finally, http://localhost:8080/JAXRSJsonCRUDExample/rest/countries saying 404 issue. http://localhost:8080/JAXRSJsonCRUDExample/ is showing “Hello World” in the browser.

Upvotes: 0

kuhajeyan
kuhajeyan

Reputation: 11017

try as follows,

org.apache.cxf.systest.jaxrs.BookStoreJaxrsJaxws proxy = ctx.getBean(org.apache.cxf.systest.jaxrs.BookStoreJaxrsJaxws.class);

Response response = proxy.method();

Upvotes: 3

Related Questions