Reputation: 857
I am using jersey
2.25.1 and I am encountering a lots of changes. I've figured out most of them but I am stuck to declare the headers. I changed ClientResponse to Response and it seems like there is no header() method in the WebTarget to return Response.
Response response = webTarget
.header( KeyConstants.REST_URI_APPENDERS, stringBuilder)
.header( DocusignRESTContants.CONTENT_TYPE, MediaType.APPLICATION_JSON )
.header( DocusignRESTContants.X_DOCUSIGN_AUTHENTICATION, getDocusignAuthHeader( cu ) )
.accept( MediaType.APPLICATION_XML )
.get( Response.class );
Is there a way to declare this in jersey 2.25.1
Thanks
Upvotes: 1
Views: 2187
Reputation: 2171
Setting header is not part of web target. It is part of Request builder(Invocation.Builder) actually as shown below.
Response response = webTarget.request().
.header( KeyConstants.REST_URI_APPENDERS, stringBuilder)
.header( DocusignRESTContants.CONTENT_TYPE, MediaType.APPLICATION_JSON )
.header( DocusignRESTContants.X_DOCUSIGN_AUTHENTICATION, getDocusignAuthHeader( cu ) )
.accept( MediaType.APPLICATION_XML )
.get(Response.class);
Upvotes: 5